diff --git a/src/Security/Security.Autorest/Az.Security.csproj b/src/Security/Security.Autorest/Az.Security.csproj new file mode 100644 index 000000000000..f77edd62a2eb --- /dev/null +++ b/src/Security/Security.Autorest/Az.Security.csproj @@ -0,0 +1,10 @@ + + + Security + Security + Security.Autorest + + + + + diff --git a/src/Security/Security.Autorest/Az.Security.format.ps1xml b/src/Security/Security.Autorest/Az.Security.format.ps1xml new file mode 100644 index 000000000000..a5c48ee6dcf6 --- /dev/null +++ b/src/Security/Security.Autorest/Az.Security.format.ps1xml @@ -0,0 +1,4073 @@ + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ActionableRemediation + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ActionableRemediation#Multiple + + + + + + + + + + + + + + + InheritFromParentState + + + State + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ApiCollection + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ApiCollection#Multiple + + + + + + + + + + + + + + + Name + + + ResourceGroupName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ApiCollectionList + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ApiCollectionList#Multiple + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ApiCollectionProperties + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ApiCollectionProperties#Multiple + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + BaseUrl + + + DiscoveredVia + + + DisplayName + + + NumberOfApiEndpoint + + + NumberOfApiEndpointsWithSensitiveDataExposed + + + NumberOfExternalApiEndpoint + + + NumberOfInactiveApiEndpoint + + + NumberOfUnauthenticatedApiEndpoint + + + ProvisioningState + + + SensitivityLabel + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.Authorization + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.Authorization#Multiple + + + + + + + + + + + + Code + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AwsEnvironment + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AwsEnvironment#Multiple + + + + + + + + + + + + + + + + + + EnvironmentType + + + AccountName + + + ScanInterval + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AwsOrganizationalData + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AwsOrganizationalData#Multiple + + + + + + + + + + + + OrganizationMembershipType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AwsOrganizationalDataMaster + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AwsOrganizationalDataMaster#Multiple + + + + + + + + + + + + + + + OrganizationMembershipType + + + StacksetName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AwsOrganizationalDataMember + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AwsOrganizationalDataMember#Multiple + + + + + + + + + + + + + + + OrganizationMembershipType + + + ParentHierarchyId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsOrg + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsOrg#Multiple + + + + + + + + + + + + + + + Name + + + ResourceGroupName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsOrganizationConfiguration + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsOrganizationConfiguration#Multiple + + + + + + + + + + + + AutoDiscovery + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsOrgListResponse + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsOrgListResponse#Multiple + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsOrgProperties + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsOrgProperties#Multiple + + + + + + + + + + + + + + + + + + + + + OnboardingState + + + ProvisioningState + + + ProvisioningStatusMessage + + + ProvisioningStatusUpdateTimeUtc + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsProject + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsProject#Multiple + + + + + + + + + + + + + + + Name + + + ResourceGroupName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsProjectConfiguration + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsProjectConfiguration#Multiple + + + + + + + + + + + + AutoDiscovery + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsProjectListResponse + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsProjectListResponse#Multiple + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsProjectProperties + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsProjectProperties#Multiple + + + + + + + + + + + + + + + + + + + + + + + + + + + OnboardingState + + + ParentOrgName + + + ProjectId + + + ProvisioningState + + + ProvisioningStatusMessage + + + ProvisioningStatusUpdateTimeUtc + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsRepository + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsRepository#Multiple + + + + + + + + + + + + + + + Name + + + ResourceGroupName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsRepositoryListResponse + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsRepositoryListResponse#Multiple + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsRepositoryProperties + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsRepositoryProperties#Multiple + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OnboardingState + + + ParentOrgName + + + ParentProjectName + + + ProvisioningState + + + ProvisioningStatusMessage + + + ProvisioningStatusUpdateTimeUtc + + + RepoId + + + RepoUrl + + + Visibility + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsScopeEnvironment + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsScopeEnvironment#Multiple + + + + + + + + + + + + EnvironmentType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureTrackedResourceLocation + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureTrackedResourceLocation#Multiple + + + + + + + + + + + + Location + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.BaseResourceConfiguration + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.BaseResourceConfiguration#Multiple + + + + + + + + + + + + DesiredOnboardingState + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CategoryConfiguration + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CategoryConfiguration#Multiple + + + + + + + + + + + + + + + Category + + + MinimumSeverityLevel + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CloudErrorBody + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CloudErrorBody#Multiple + + + + + + + + + + + + + + + + + + Code + + + Message + + + Target + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CloudOffering + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CloudOffering#Multiple + + + + + + + + + + + + + + + Description + + + OfferingType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CspmMonitorAwsOffering + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CspmMonitorAwsOffering#Multiple + + + + + + + + + + + + + + + Description + + + OfferingType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CspmMonitorAwsOfferingNativeCloudConnection + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CspmMonitorAwsOfferingNativeCloudConnection#Multiple + + + + + + + + + + + + CloudRoleArn + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CspmMonitorAzureDevOpsOffering + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CspmMonitorAzureDevOpsOffering#Multiple + + + + + + + + + + + + + + + Description + + + OfferingType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CspmMonitorGcpOffering + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CspmMonitorGcpOffering#Multiple + + + + + + + + + + + + + + + Description + + + OfferingType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CspmMonitorGcpOfferingNativeCloudConnection + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CspmMonitorGcpOfferingNativeCloudConnection#Multiple + + + + + + + + + + + + + + + ServiceAccountEmailAddress + + + WorkloadIdentityProviderId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CspmMonitorGithubOffering + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CspmMonitorGithubOffering#Multiple + + + + + + + + + + + + + + + Description + + + OfferingType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CspmMonitorGitLabOffering + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CspmMonitorGitLabOffering#Multiple + + + + + + + + + + + + + + + Description + + + OfferingType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOffering + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOffering#Multiple + + + + + + + + + + + + + + + Description + + + OfferingType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingCiemDiscovery + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingCiemDiscovery#Multiple + + + + + + + + + + + + CloudRoleArn + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingCiemOidc + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingCiemOidc#Multiple + + + + + + + + + + + + + + + AzureActiveDirectoryAppName + + + CloudRoleArn + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingDatabasesDspm + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingDatabasesDspm#Multiple + + + + + + + + + + + + + + + CloudRoleArn + + + Enabled + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingDataSensitivityDiscovery + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingDataSensitivityDiscovery#Multiple + + + + + + + + + + + + + + + CloudRoleArn + + + Enabled + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S#Multiple + + + + + + + + + + + + + + + CloudRoleArn + + + Enabled + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingMdcContainersImageAssessment + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingMdcContainersImageAssessment#Multiple + + + + + + + + + + + + + + + CloudRoleArn + + + Enabled + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingVMScanners + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingVMScanners#Multiple + + + + + + + + + + + + Enabled + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingVMScannersConfiguration + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingVMScannersConfiguration#Multiple + + + + + + + + + + + + + + + CloudRoleArn + + + ScanningMode + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingVMScannersConfigurationExclusionTags + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingVMScannersConfigurationExclusionTags#Multiple + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmGcpOffering + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmGcpOffering#Multiple + + + + + + + + + + + + + + + Description + + + OfferingType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmGcpOfferingCiemDiscovery + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmGcpOfferingCiemDiscovery#Multiple + + + + + + + + + + + + + + + + + + AzureActiveDirectoryAppName + + + ServiceAccountEmailAddress + + + WorkloadIdentityProviderId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmGcpOfferingDataSensitivityDiscovery + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmGcpOfferingDataSensitivityDiscovery#Multiple + + + + + + + + + + + + + + + + + + Enabled + + + ServiceAccountEmailAddress + + + WorkloadIdentityProviderId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S#Multiple + + + + + + + + + + + + + + + + + + Enabled + + + ServiceAccountEmailAddress + + + WorkloadIdentityProviderId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmGcpOfferingMdcContainersImageAssessment + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmGcpOfferingMdcContainersImageAssessment#Multiple + + + + + + + + + + + + + + + + + + Enabled + + + ServiceAccountEmailAddress + + + WorkloadIdentityProviderId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmGcpOfferingVMScanners + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmGcpOfferingVMScanners#Multiple + + + + + + + + + + + + Enabled + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmGcpOfferingVMScannersConfiguration + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmGcpOfferingVMScannersConfiguration#Multiple + + + + + + + + + + + + ScanningMode + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmGcpOfferingVMScannersConfigurationExclusionTags + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmGcpOfferingVMScannersConfigurationExclusionTags#Multiple + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderFoDatabasesAwsOfferingArcAutoProvisioning + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderFoDatabasesAwsOfferingArcAutoProvisioning#Multiple + + + + + + + + + + + + + + + CloudRoleArn + + + Enabled + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderFoDatabasesAwsOfferingArcAutoProvisioningConfiguration + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderFoDatabasesAwsOfferingArcAutoProvisioningConfiguration#Multiple + + + + + + + + + + + + + + + PrivateLinkScope + + + Proxy + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderFoDatabasesAwsOfferingDatabasesDspm + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderFoDatabasesAwsOfferingDatabasesDspm#Multiple + + + + + + + + + + + + + + + CloudRoleArn + + + Enabled + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderFoDatabasesAwsOfferingRds + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderFoDatabasesAwsOfferingRds#Multiple + + + + + + + + + + + + + + + CloudRoleArn + + + Enabled + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersAwsOffering + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersAwsOffering#Multiple + + + + + + + + + + + + + + + + + + + + + + + + + + + Description + + + OfferingType + + + AutoProvisioning + + + EnableContainerVulnerabilityAssessment + + + KubeAuditRetentionTime + + + ScubaExternalId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersAwsOfferingCloudWatchToKinesis + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersAwsOfferingCloudWatchToKinesis#Multiple + + + + + + + + + + + + CloudRoleArn + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersAwsOfferingContainerVulnerabilityAssessment + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersAwsOfferingContainerVulnerabilityAssessment#Multiple + + + + + + + + + + + + CloudRoleArn + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTask + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTask#Multiple + + + + + + + + + + + + CloudRoleArn + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersAwsOfferingKinesisToS3 + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersAwsOfferingKinesisToS3#Multiple + + + + + + + + + + + + CloudRoleArn + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersAwsOfferingKubernetesScubaReader + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersAwsOfferingKubernetesScubaReader#Multiple + + + + + + + + + + + + CloudRoleArn + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersAwsOfferingKubernetesService + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersAwsOfferingKubernetesService#Multiple + + + + + + + + + + + + CloudRoleArn + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S#Multiple + + + + + + + + + + + + + + + CloudRoleArn + + + Enabled + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersAwsOfferingMdcContainersImageAssessment + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersAwsOfferingMdcContainersImageAssessment#Multiple + + + + + + + + + + + + + + + CloudRoleArn + + + Enabled + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersGcpOffering + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersGcpOffering#Multiple + + + + + + + + + + + + + + + + + + + + + + + + Description + + + OfferingType + + + AuditLogsAutoProvisioningFlag + + + DefenderAgentAutoProvisioningFlag + + + PolicyAgentAutoProvisioningFlag + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection#Multiple + + + + + + + + + + + + + + + ServiceAccountEmailAddress + + + WorkloadIdentityProviderId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S#Multiple + + + + + + + + + + + + + + + + + + Enabled + + + ServiceAccountEmailAddress + + + WorkloadIdentityProviderId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersGcpOfferingMdcContainersImageAssessment + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersGcpOfferingMdcContainersImageAssessment#Multiple + + + + + + + + + + + + + + + + + + Enabled + + + ServiceAccountEmailAddress + + + WorkloadIdentityProviderId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersGcpOfferingNativeCloudConnection + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersGcpOfferingNativeCloudConnection#Multiple + + + + + + + + + + + + + + + ServiceAccountEmailAddress + + + WorkloadIdentityProviderId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForDatabasesAwsOffering + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForDatabasesAwsOffering#Multiple + + + + + + + + + + + + + + + Description + + + OfferingType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForDatabasesGcpOffering + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForDatabasesGcpOffering#Multiple + + + + + + + + + + + + + + + Description + + + OfferingType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForDatabasesGcpOfferingArcAutoProvisioning + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForDatabasesGcpOfferingArcAutoProvisioning#Multiple + + + + + + + + + + + + Enabled + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration#Multiple + + + + + + + + + + + + + + + PrivateLinkScope + + + Proxy + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning#Multiple + + + + + + + + + + + + + + + ServiceAccountEmailAddress + + + WorkloadIdentityProviderId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForDevOpsAzureDevOpsOffering + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForDevOpsAzureDevOpsOffering#Multiple + + + + + + + + + + + + + + + Description + + + OfferingType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForDevOpsGithubOffering + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForDevOpsGithubOffering#Multiple + + + + + + + + + + + + + + + Description + + + OfferingType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForDevOpsGitLabOffering + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForDevOpsGitLabOffering#Multiple + + + + + + + + + + + + + + + Description + + + OfferingType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOffering + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOffering#Multiple + + + + + + + + + + + + + + + Description + + + OfferingType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingArcAutoProvisioning + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingArcAutoProvisioning#Multiple + + + + + + + + + + + + + + + CloudRoleArn + + + Enabled + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingArcAutoProvisioningConfiguration + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingArcAutoProvisioningConfiguration#Multiple + + + + + + + + + + + + + + + PrivateLinkScope + + + Proxy + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingDefenderForServers + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingDefenderForServers#Multiple + + + + + + + + + + + + CloudRoleArn + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingMdeAutoProvisioning + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingMdeAutoProvisioning#Multiple + + + + + + + + + + + + Enabled + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingVaAutoProvisioning + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingVaAutoProvisioning#Multiple + + + + + + + + + + + + Enabled + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingVMScanners + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingVMScanners#Multiple + + + + + + + + + + + + Enabled + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingVMScannersConfiguration + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingVMScannersConfiguration#Multiple + + + + + + + + + + + + + + + CloudRoleArn + + + ScanningMode + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingVMScannersConfigurationExclusionTags + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingVMScannersConfigurationExclusionTags#Multiple + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOffering + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOffering#Multiple + + + + + + + + + + + + + + + Description + + + OfferingType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingArcAutoProvisioning + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingArcAutoProvisioning#Multiple + + + + + + + + + + + + Enabled + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingArcAutoProvisioningConfiguration + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingArcAutoProvisioningConfiguration#Multiple + + + + + + + + + + + + + + + PrivateLinkScope + + + Proxy + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingDefenderForServers + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingDefenderForServers#Multiple + + + + + + + + + + + + + + + ServiceAccountEmailAddress + + + WorkloadIdentityProviderId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingMdeAutoProvisioning + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingMdeAutoProvisioning#Multiple + + + + + + + + + + + + Enabled + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingVaAutoProvisioning + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingVaAutoProvisioning#Multiple + + + + + + + + + + + + Enabled + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingVMScanners + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingVMScanners#Multiple + + + + + + + + + + + + Enabled + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingVMScannersConfiguration + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingVMScannersConfiguration#Multiple + + + + + + + + + + + + ScanningMode + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingVMScannersConfigurationExclusionTags + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingVMScannersConfigurationExclusionTags#Multiple + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DevOpsConfiguration + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DevOpsConfiguration#Multiple + + + + + + + + + + + + + + + Name + + + ResourceGroupName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DevOpsConfigurationListResponse + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DevOpsConfigurationListResponse#Multiple + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DevOpsConfigurationProperties + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DevOpsConfigurationProperties#Multiple + + + + + + + + + + + + + + + + + + + + + AutoDiscovery + + + ProvisioningState + + + ProvisioningStatusMessage + + + ProvisioningStatusUpdateTimeUtc + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorDetail + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorDetail#Multiple + + + + + + + + + + + + + + + + + + Code + + + Message + + + Target + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorDetailAutoGenerated + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorDetailAutoGenerated#Multiple + + + + + + + + + + + + + + + + + + Code + + + Message + + + Target + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ETag + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ETag#Multiple + + + + + + + + + + + + Etag + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GcpOrganizationalData + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GcpOrganizationalData#Multiple + + + + + + + + + + + + OrganizationMembershipType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GcpOrganizationalDataMember + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GcpOrganizationalDataMember#Multiple + + + + + + + + + + + + + + + + + + OrganizationMembershipType + + + ManagementProjectNumber + + + ParentHierarchyId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GcpOrganizationalDataOrganization + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GcpOrganizationalDataOrganization#Multiple + + + + + + + + + + + + + + + + + + + + + OrganizationMembershipType + + + OrganizationName + + + ServiceAccountEmailAddress + + + WorkloadIdentityProviderId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GcpProjectDetails + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GcpProjectDetails#Multiple + + + + + + + + + + + + + + + + + + + + + ProjectId + + + ProjectName + + + ProjectNumber + + + WorkloadIdentityPoolId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GcpProjectEnvironment + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GcpProjectEnvironment#Multiple + + + + + + + + + + + + + + + EnvironmentType + + + ScanInterval + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitHubOwner + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitHubOwner#Multiple + + + + + + + + + + + + + + + Name + + + ResourceGroupName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitHubOwnerConfiguration + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitHubOwnerConfiguration#Multiple + + + + + + + + + + + + AutoDiscovery + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitHubOwnerListResponse + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitHubOwnerListResponse#Multiple + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitHubOwnerProperties + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitHubOwnerProperties#Multiple + + + + + + + + + + + + + + + + + + + + + + + + + + + GitHubInternalId + + + OnboardingState + + + OwnerUrl + + + ProvisioningState + + + ProvisioningStatusMessage + + + ProvisioningStatusUpdateTimeUtc + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitHubRepository + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitHubRepository#Multiple + + + + + + + + + + + + + + + Name + + + ResourceGroupName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitHubRepositoryListResponse + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitHubRepositoryListResponse#Multiple + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitHubRepositoryProperties + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitHubRepositoryProperties#Multiple + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OnboardingState + + + ParentOwnerName + + + ProvisioningState + + + ProvisioningStatusMessage + + + ProvisioningStatusUpdateTimeUtc + + + RepoFullName + + + RepoId + + + RepoName + + + RepoUrl + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitHubScopeEnvironment + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitHubScopeEnvironment#Multiple + + + + + + + + + + + + EnvironmentType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitLabGroup + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitLabGroup#Multiple + + + + + + + + + + + + + + + Name + + + ResourceGroupName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitLabGroupConfiguration + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitLabGroupConfiguration#Multiple + + + + + + + + + + + + AutoDiscovery + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitLabGroupListResponse + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitLabGroupListResponse#Multiple + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitLabGroupProperties + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitLabGroupProperties#Multiple + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + FullyQualifiedFriendlyName + + + FullyQualifiedName + + + OnboardingState + + + ProvisioningState + + + ProvisioningStatusMessage + + + ProvisioningStatusUpdateTimeUtc + + + Url + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitLabProject + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitLabProject#Multiple + + + + + + + + + + + + + + + Name + + + ResourceGroupName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitLabProjectListResponse + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitLabProjectListResponse#Multiple + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitLabProjectProperties + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitLabProjectProperties#Multiple + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + FullyQualifiedFriendlyName + + + FullyQualifiedName + + + FullyQualifiedParentGroupName + + + OnboardingState + + + ProvisioningState + + + ProvisioningStatusMessage + + + ProvisioningStatusUpdateTimeUtc + + + Url + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitLabScopeEnvironment + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitLabScopeEnvironment#Multiple + + + + + + + + + + + + EnvironmentType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.InformationProtectionAwsOffering + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.InformationProtectionAwsOffering#Multiple + + + + + + + + + + + + + + + Description + + + OfferingType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.InformationProtectionAwsOfferingInformationProtection + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.InformationProtectionAwsOfferingInformationProtection#Multiple + + + + + + + + + + + + CloudRoleArn + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.OperationStatusResult + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.OperationStatusResult#Multiple + + + + + + + + + + + + + + + + + + + + + + + + + + + EndTime + + + Name + + + PercentComplete + + + ResourceGroupName + + + StartTime + + + Status + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ProxyResource + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ProxyResource#Multiple + + + + + + + + + + + + Name + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.Resource + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.Resource#Multiple + + + + + + + + + + + + Name + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ResourceAutoGenerated + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ResourceAutoGenerated#Multiple + + + + + + + + + + + + Name + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ResourceKind + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ResourceKind#Multiple + + + + + + + + + + + + Kind + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SecurityConnector + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SecurityConnector#Multiple + + + + + + + + + + + + + + + + + + + + + + + + Name + + + ResourceGroupName + + + EnvironmentName + + + Location + + + HierarchyIdentifier + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SecurityConnectorEnvironment + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SecurityConnectorEnvironment#Multiple + + + + + + + + + + + + EnvironmentType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SecurityConnectorProperties + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SecurityConnectorProperties#Multiple + + + + + + + + + + + + + + + + + + EnvironmentName + + + HierarchyIdentifier + + + HierarchyIdentifierTrialEndDate + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SecurityConnectorsList + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SecurityConnectorsList#Multiple + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SecurityIdentity + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SecurityIdentity#Multiple + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ApiId + + + GroupFqName + + + OperationResultId + + + OrgName + + + OwnerName + + + ProjectName + + + RepoName + + + ResourceGroupName + + + SecurityConnectorName + + + ServiceName + + + SubscriptionId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SystemData + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SystemData#Multiple + + + + + + + + + + + + + + + + + + + + + + + + + + + CreatedAt + + + CreatedBy + + + CreatedByType + + + LastModifiedAt + + + LastModifiedBy + + + LastModifiedByType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.Tags + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.Tags#Multiple + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.TargetBranchConfiguration + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.TargetBranchConfiguration#Multiple + + + + + + + + + + + + AnnotateDefaultBranch + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.TrackedResource + + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.TrackedResource#Multiple + + + + + + + + + + + + + + + + + + + + + Etag + + + Kind + + + Location + + + Name + + + + + + + + \ No newline at end of file diff --git a/src/Security/Security.Autorest/Az.Security.psd1 b/src/Security/Security.Autorest/Az.Security.psd1 new file mode 100644 index 000000000000..d2a355dfd745 --- /dev/null +++ b/src/Security/Security.Autorest/Az.Security.psd1 @@ -0,0 +1,23 @@ +@{ + GUID = '6f1c0dfd-dfcd-4e5b-b77c-a64a9d355ebf' + RootModule = './Az.Security.psm1' + ModuleVersion = '1.5.1' + CompatiblePSEditions = 'Core', 'Desktop' + Author = 'Microsoft Corporation' + CompanyName = 'Microsoft Corporation' + Copyright = 'Microsoft Corporation. All rights reserved.' + Description = 'Microsoft Azure PowerShell: Security cmdlets' + PowerShellVersion = '5.1' + DotNetFrameworkVersion = '4.7.2' + RequiredAssemblies = './bin/Az.Security.private.dll' + FormatsToProcess = './Az.Security.format.ps1xml' + FunctionsToExport = 'Get-AzSecurityApiCollection', 'Get-AzSecurityConnector', 'Get-AzSecurityConnectorAzureDevOpsOrg', 'Get-AzSecurityConnectorAzureDevOpsOrgAvailable', 'Get-AzSecurityConnectorAzureDevOpsProject', 'Get-AzSecurityConnectorAzureDevOpsRepo', 'Get-AzSecurityConnectorDevOpsConfiguration', 'Get-AzSecurityConnectorGitHubOwner', 'Get-AzSecurityConnectorGitHubOwnerAvailable', 'Get-AzSecurityConnectorGitHubRepo', 'Get-AzSecurityConnectorGitLabGroup', 'Get-AzSecurityConnectorGitLabGroupAvailable', 'Get-AzSecurityConnectorGitLabProject', 'Get-AzSecurityConnectorGitLabSubgroup', 'Invoke-AzSecurityApiCollectionApimOffboard', 'Invoke-AzSecurityApiCollectionApimOnboard', 'New-AzSecurityAwsEnvironmentObject', 'New-AzSecurityAwsOrganizationalDataMasterObject', 'New-AzSecurityAwsOrganizationalDataMemberObject', 'New-AzSecurityAzureDevOpsScopeEnvironmentObject', 'New-AzSecurityConnector', 'New-AzSecurityConnectorActionableRemediationObject', 'New-AzSecurityConnectorDevOpsConfiguration', 'New-AzSecurityCspmMonitorAwsOfferingObject', 'New-AzSecurityCspmMonitorAzureDevOpsOfferingObject', 'New-AzSecurityCspmMonitorGcpOfferingObject', 'New-AzSecurityCspmMonitorGithubOfferingObject', 'New-AzSecurityCspmMonitorGitLabOfferingObject', 'New-AzSecurityDefenderCspmAwsOfferingObject', 'New-AzSecurityDefenderCspmGcpOfferingObject', 'New-AzSecurityDefenderForContainersAwsOfferingObject', 'New-AzSecurityDefenderForContainersGcpOfferingObject', 'New-AzSecurityDefenderForDatabasesAwsOfferingObject', 'New-AzSecurityDefenderForDatabasesGcpOfferingObject', 'New-AzSecurityDefenderForServersAwsOfferingObject', 'New-AzSecurityDefenderForServersGcpOfferingObject', 'New-AzSecurityGcpOrganizationalDataMemberObject', 'New-AzSecurityGcpOrganizationalDataOrganizationObject', 'New-AzSecurityGcpProjectEnvironmentObject', 'New-AzSecurityGitHubScopeEnvironmentObject', 'New-AzSecurityGitLabScopeEnvironmentObject', 'New-AzSecurityInformationProtectionAwsOfferingObject', 'Remove-AzSecurityConnector', 'Remove-AzSecurityConnectorDevOpsConfiguration', 'Update-AzSecurityConnector', 'Update-AzSecurityConnectorAzureDevOpsOrg', 'Update-AzSecurityConnectorAzureDevOpsProject', 'Update-AzSecurityConnectorAzureDevOpsRepo', 'Update-AzSecurityConnectorDevOpsConfiguration' + PrivateData = @{ + PSData = @{ + Tags = 'Azure', 'ResourceManager', 'ARM', 'PSModule', 'Security' + LicenseUri = 'https://aka.ms/azps-license' + ProjectUri = 'https://github.com/Azure/azure-powershell' + ReleaseNotes = '' + } + } +} diff --git a/src/Security/Security.Autorest/Az.Security.psm1 b/src/Security/Security.Autorest/Az.Security.psm1 new file mode 100644 index 000000000000..dccdc942f532 --- /dev/null +++ b/src/Security/Security.Autorest/Az.Security.psm1 @@ -0,0 +1,115 @@ +# region Generated + # ---------------------------------------------------------------------------------- + # Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. + # ---------------------------------------------------------------------------------- + # Load required Az.Accounts module + $accountsName = 'Az.Accounts' + $accountsModule = Get-Module -Name $accountsName + if(-not $accountsModule) { + $localAccountsPath = Join-Path $PSScriptRoot 'generated\modules' + if(Test-Path -Path $localAccountsPath) { + $localAccounts = Get-ChildItem -Path $localAccountsPath -Recurse -Include 'Az.Accounts.psd1' | Select-Object -Last 1 + if($localAccounts) { + $accountsModule = Import-Module -Name ($localAccounts.FullName) -Scope Global -PassThru + } + } + if(-not $accountsModule) { + $hasAdequateVersion = (Get-Module -Name $accountsName -ListAvailable | Where-Object { $_.Version -ge [System.Version]'2.7.5' } | Measure-Object).Count -gt 0 + if($hasAdequateVersion) { + $accountsModule = Import-Module -Name $accountsName -MinimumVersion 2.7.5 -Scope Global -PassThru + } + } + } + + if(-not $accountsModule) { + Write-Error "`nThis module requires $accountsName version 2.7.5 or greater. For installation instructions, please see: https://learn.microsoft.com/powershell/azure/install-az-ps" -ErrorAction Stop + } elseif (($accountsModule.Version -lt [System.Version]'2.7.5') -and (-not $localAccounts)) { + Write-Error "`nThis module requires $accountsName version 2.7.5 or greater. An earlier version of Az.Accounts is imported in the current PowerShell session. If you are running test, please try to add the switch '-RegenerateSupportModule' when executing 'test-module.ps1'. Otherwise please open a new PowerShell session and import this module again.`nAdditionally, this error could indicate that multiple incompatible versions of Azure PowerShell modules are installed on your system. For troubleshooting information, please see: https://aka.ms/azps-version-error" -ErrorAction Stop + } + Write-Information "Loaded Module '$($accountsModule.Name)'" + + # Load the private module dll + $null = Import-Module -Name (Join-Path $PSScriptRoot './bin/Az.Security.private.dll') + + # Get the private module's instance + $instance = [Microsoft.Azure.PowerShell.Cmdlets.Security.Module]::Instance + + # Ask for the shared functionality table + $VTable = Register-AzModule + + # Tweaks the pipeline on module load + $instance.OnModuleLoad = $VTable.OnModuleLoad + + # Following two delegates are added for telemetry + $instance.GetTelemetryId = $VTable.GetTelemetryId + $instance.Telemetry = $VTable.Telemetry + + + # Tweaks the pipeline per call + $instance.OnNewRequest = $VTable.OnNewRequest + + # Gets shared parameter values + $instance.GetParameterValue = $VTable.GetParameterValue + + # Allows shared module to listen to events from this module + $instance.EventListener = $VTable.EventListener + + # Gets shared argument completers + $instance.ArgumentCompleter = $VTable.ArgumentCompleter + + # The name of the currently selected Azure profile + $instance.ProfileName = $VTable.ProfileName + + + # Load the custom module + $customModulePath = Join-Path $PSScriptRoot './custom/Az.Security.custom.psm1' + if(Test-Path $customModulePath) { + $null = Import-Module -Name $customModulePath + } + + # Export nothing to clear implicit exports + Export-ModuleMember + + # Export proxy cmdlet scripts + $exportsPath = Join-Path $PSScriptRoot './exports' + $directories = Get-ChildItem -Directory -Path $exportsPath + $profileDirectory = $null + if($instance.ProfileName) { + if(($directories | ForEach-Object { $_.Name }) -contains $instance.ProfileName) { + $profileDirectory = $directories | Where-Object { $_.Name -eq $instance.ProfileName } + } else { + # Don't export anything if the profile doesn't exist for the module + $exportsPath = $null + Write-Warning "Selected Azure profile '$($instance.ProfileName)' does not exist for module '$($instance.Name)'. No cmdlets were loaded." + } + } elseif(($directories | Measure-Object).Count -gt 0) { + # Load the last folder if no profile is selected + $profileDirectory = $directories | Select-Object -Last 1 + } + + if($profileDirectory) { + Write-Information "Loaded Azure profile '$($profileDirectory.Name)' for module '$($instance.Name)'" + $exportsPath = $profileDirectory.FullName + } + + if($exportsPath) { + Get-ChildItem -Path $exportsPath -Recurse -Include '*.ps1' -File | ForEach-Object { . $_.FullName } + $cmdletNames = Get-ScriptCmdlet -ScriptFolder $exportsPath + Export-ModuleMember -Function $cmdletNames -Alias (Get-ScriptCmdlet -ScriptFolder $exportsPath -AsAlias) + } + + # Finalize initialization of this module + $instance.Init(); + Write-Information "Loaded Module '$($instance.Name)'" +# endregion diff --git a/src/Security/Security.Autorest/README.md b/src/Security/Security.Autorest/README.md new file mode 100644 index 000000000000..bf75826e0ded --- /dev/null +++ b/src/Security/Security.Autorest/README.md @@ -0,0 +1,184 @@ + +# Az.Security +This directory contains the PowerShell module for the Security service. + +--- +## Info +- Modifiable: yes +- Generated: all +- Committed: yes +- Packaged: yes + +--- +## Detail +This module was primarily generated via [AutoRest](https://github.com/Azure/autorest) using the [PowerShell](https://github.com/Azure/autorest.powershell) extension. + +## Module Requirements +- [Az.Accounts module](https://www.powershellgallery.com/packages/Az.Accounts/), version 2.7.5 or greater + +## Authentication +AutoRest does not generate authentication code for the module. Authentication is handled via Az.Accounts by altering the HTTP payload before it is sent. + +## Development +For information on how to develop for `Az.Security`, see [how-to.md](how-to.md). + + +### AutoRest Configuration +> see https://aka.ms/autorest + +### +``` yaml +commit: 6c4497e6b0aaad8127f2dd50fa8a29aaf68f24e6 +require: + - $(this-folder)/../../readme.azure.noprofile.md +input-file: + - $(repo)/specification/security/resource-manager/Microsoft.Security/preview/2023-10-01-preview/securityConnectors.json + - $(repo)/specification/security/resource-manager/Microsoft.Security/preview/2023-09-01-preview/securityConnectorsDevOps.json + - $(repo)/specification/security/resource-manager/Microsoft.Security/stable/2023-11-15/apiCollections.json + +title: Security +module-version: 1.5.1 +subject-prefix: $(service-name) +enable-parent-pipeline-input: false + +directive: + - rename-model: + from: EnvironmentData + to: SecurityConnectorEnvironment + - rename-model: + from: AwsEnvironmentData + to: AwsEnvironment + - rename-model: + from: GcpProjectEnvironmentData + to: GcpProjectEnvironment + - rename-model: + from: AzureDevOpsScopeEnvironmentData + to: AzureDevOpsScopeEnvironment + - rename-model: + from: GitlabScopeEnvironmentData + to: GitLabScopeEnvironment + - rename-model: + from: GithubScopeEnvironmentData + to: GitHubScopeEnvironment + + - from: securityConnectors.json + where: $.definitions + debug: true + transform: > + $.defenderFoDatabasesAwsOffering['x-ms-client-name'] = 'DefenderForDatabasesAwsOffering' + + - from: types.json + where: $.definitions.Kind + transform: > + $['x-ms-client-name'] = 'ResourceKind'; + + - from: apiCollections.json + where: $.paths..operationId + transform: > + return $.replace(/OffboardAzureApiManagementApi$/g, "ApiCollectionAPIM_Delete") + + - where: + verb: Invoke + subject: ^AzureApiCollection$ + set: + subject: ApiCollectionApimOnboard + + - where: + verb: Remove + subject: ^ApiCollectionApim$ + set: + verb: Invoke + subject: ApiCollectionApimOffboard + + # New-* cmdlets, ViaIdentity is not required + - where: + variant: ^(Create|Update)(?!.*?Expanded|JsonFilePath|JsonString) + remove: true + - where: + variant: ^CreateViaIdentity.*$ + remove: true + + # Remove the set-* cmdlet + - where: + verb: Set + remove: true + + - where: + subject: ^(DevOpsConfiguration|AzureDevOps|GitHub|GitLab)(.*) + set: + subject-prefix: SecurityConnector + + - where: + subject: (.*)(AzureDevOpsRepos)$ + set: + subject: $1AzureDevOpsRepo + + - where: + subject: (.*)(GitHubRepos)$ + set: + subject: $1GitHubRepo + + - where: + verb: New + subject: ^(AzureDevOpsOrg|AzureDevOpsProject|AzureDevOpsRepo)(.*) + remove: true + + - where: + subject: ^(DevOpsOperationResult)(.*) + remove: true + + - where: + subject: ^(DevOpsConfiguration|AzureDevOps|GitHub|GitLab)(.*) + parameter-name: ProvisioningState + hide: true + + - where: + verb: Update + subject: ^(AzureDevOps)(.*) + parameter-name: OnboardingState + hide: true + + - where: + model-name: SecurityConnector + set: + format-table: + properties: + - Name + - ResourceGroupName + - EnvironmentName + - Location + - HierarchyIdentifier + + - no-inline: + - SecurityConnectorEnvironment + - AwsOrganizationalData + - GcpOrganizationalData + - ActionableRemediation + + - model-cmdlet: + - model-name: AwsEnvironment + - model-name: AwsOrganizationalDataMaster + - model-name: AwsOrganizationalDataMember + - model-name: GcpProjectEnvironment + - model-name: GcpOrganizationalDataOrganization + - model-name: GcpOrganizationalDataMember + - model-name: AzureDevOpsScopeEnvironment + - model-name: GitLabScopeEnvironment + - model-name: GitHubScopeEnvironment + - model-name: CspmMonitorAwsOffering + - model-name: CspmMonitorGcpOffering + - model-name: CspmMonitorGithubOffering + - model-name: CspmMonitorAzureDevOpsOffering + - model-name: CspmMonitorGitLabOffering + - model-name: DefenderCspmAwsOffering + - model-name: DefenderCspmGcpOffering + - model-name: DefenderForContainersAwsOffering + - model-name: DefenderForContainersGcpOffering + - model-name: DefenderForDatabasesAwsOffering + - model-name: DefenderForDatabasesGcpOffering + - model-name: DefenderForServersAwsOffering + - model-name: DefenderForServersGcpOffering + - model-name: InformationProtectionAwsOffering + - model-name: ActionableRemediation + cmdlet-name: New-AzSecurityConnectorActionableRemediationObject +``` diff --git a/src/Security/Security.Autorest/UX/Microsoft.ApiManagement/service-apiCollections.json b/src/Security/Security.Autorest/UX/Microsoft.ApiManagement/service-apiCollections.json new file mode 100644 index 000000000000..cac1371c5a4e --- /dev/null +++ b/src/Security/Security.Autorest/UX/Microsoft.ApiManagement/service-apiCollections.json @@ -0,0 +1,138 @@ +{ + "resourceType": "service/apiCollections", + "apiVersion": "2023-11-15", + "learnMore": { + "url": "https://learn.microsoft.com/powershell/module/az.security" + }, + "commands": [ + { + "name": "Get-AzSecurityApiCollection", + "description": "Gets an Azure API Management API if it has been onboarded to Microsoft Defender for APIs.\nIf an Azure API Management API is onboarded to Microsoft Defender for APIs, the system will monitor the operations within the Azure API Management API for intrusive behaviors and provide alerts for attacks that have been detected.", + "path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/providers/Microsoft.Security/apiCollections/{apiId}", + "help": { + "learnMore": { + "url": "https://learn.microsoft.com/powershell/module/az.security/get-azsecurityapicollection" + }, + "parameterSets": [ + { + "parameters": [ + "-ApiId ", + "-ResourceGroupName ", + "-ServiceName ", + "[-SubscriptionId ]" + ] + } + ] + }, + "examples": [ + { + "description": "Gets an Azure API Management API if it has been onboarded to Microsoft Defender for APIs. If an Azure API Management API is onboarded to Microsoft Defender for APIs, the system will monitor the operations within the Azure API Management API for intrusive behaviors and provide alerts for attacks that have been detected.", + "parameters": [ + { + "name": "-ApiId", + "value": "[Path.apiId]" + }, + { + "name": "-ResourceGroupName", + "value": "[Path.resourceGroupName]" + }, + { + "name": "-ServiceName", + "value": "[Path.serviceName]" + }, + { + "name": "-SubscriptionId", + "value": "[Path.subscriptionId]" + } + ] + } + ] + }, + { + "name": "Invoke-AzSecurityApiCollectionApimOffboard", + "description": "Offboard an Azure API Management API from Microsoft Defender for APIs.\nThe system will stop monitoring the operations within the Azure API Management API for intrusive behaviors.", + "path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/providers/Microsoft.Security/apiCollections/{apiId}", + "help": { + "learnMore": { + "url": "https://learn.microsoft.com/powershell/module/az.security/invoke-azsecurityapicollectionapimoffboard" + }, + "parameterSets": [ + { + "parameters": [ + "-ApiId ", + "-ResourceGroupName ", + "-ServiceName ", + "[-SubscriptionId ]" + ] + } + ] + }, + "examples": [ + { + "description": "Offboard an Azure API Management API from Microsoft Defender for APIs. The system will stop monitoring the operations within the Azure API Management API for intrusive behaviors.", + "parameters": [ + { + "name": "-ApiId", + "value": "[Path.apiId]" + }, + { + "name": "-ResourceGroupName", + "value": "[Path.resourceGroupName]" + }, + { + "name": "-ServiceName", + "value": "[Path.serviceName]" + }, + { + "name": "-SubscriptionId", + "value": "[Path.subscriptionId]" + } + ] + } + ] + }, + { + "name": "Invoke-AzSecurityApiCollectionApimOnboard", + "description": "Onboard an Azure API Management API to Microsoft Defender for APIs.\nThe system will start monitoring the operations within the Azure Management API for intrusive behaviors and provide alerts for attacks that have been detected.", + "path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/providers/Microsoft.Security/apiCollections/{apiId}", + "help": { + "learnMore": { + "url": "https://learn.microsoft.com/powershell/module/az.security/invoke-azsecurityapicollectionapimonboard" + }, + "parameterSets": [ + { + "parameters": [ + "-ApiId ", + "-ResourceGroupName ", + "-ServiceName ", + "[-SubscriptionId ]" + ] + } + ] + }, + "examples": [ + { + "description": "Onboard an Azure API Management API to Microsoft Defender for APIs. The system will start monitoring the operations within the Azure Management API for intrusive behaviors and provide alerts for attacks that have been detected.", + "parameters": [ + { + "name": "-ApiId", + "value": "[Path.apiId]" + }, + { + "name": "-ResourceGroupName", + "value": "[Path.resourceGroupName]" + }, + { + "name": "-ServiceName", + "value": "[Path.serviceName]" + }, + { + "name": "-SubscriptionId", + "value": "[Path.subscriptionId]" + } + ] + } + ] + } + ] +} diff --git a/src/Security/Security.Autorest/UX/Microsoft.Security/securityConnectors-azureDevOpsOrgs-projects-repos.json b/src/Security/Security.Autorest/UX/Microsoft.Security/securityConnectors-azureDevOpsOrgs-projects-repos.json new file mode 100644 index 000000000000..19fdc4d4e2f2 --- /dev/null +++ b/src/Security/Security.Autorest/UX/Microsoft.Security/securityConnectors-azureDevOpsOrgs-projects-repos.json @@ -0,0 +1,62 @@ +{ + "resourceType": "securityConnectors/azureDevOpsOrgs/projects/repos", + "apiVersion": "2023-09-01-preview", + "learnMore": { + "url": "https://learn.microsoft.com/powershell/module/az.security" + }, + "commands": [ + { + "name": "Get-AzSecurityConnectorAzureDevOpsRepo", + "description": "Returns a monitored Azure DevOps repository resource.", + "path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}/projects/{projectName}/repos/{repoName}", + "help": { + "learnMore": { + "url": "https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorazuredevopsrepo" + }, + "parameterSets": [ + { + "parameters": [ + "-OrgName ", + "-ProjectName ", + "-RepoName ", + "-ResourceGroupName ", + "-SecurityConnectorName ", + "[-SubscriptionId ]" + ] + } + ] + }, + "examples": [ + { + "description": "Returns a monitored Azure DevOps repository resource.", + "parameters": [ + { + "name": "-OrgName", + "value": "[Path.orgName]" + }, + { + "name": "-ProjectName", + "value": "[Path.projectName]" + }, + { + "name": "-RepoName", + "value": "[Path.repoName]" + }, + { + "name": "-ResourceGroupName", + "value": "[Path.resourceGroupName]" + }, + { + "name": "-SecurityConnectorName", + "value": "[Path.securityConnectorName]" + }, + { + "name": "-SubscriptionId", + "value": "[Path.subscriptionId]" + } + ] + } + ] + } + ] +} diff --git a/src/Security/Security.Autorest/UX/Microsoft.Security/securityConnectors-azureDevOpsOrgs-projects.json b/src/Security/Security.Autorest/UX/Microsoft.Security/securityConnectors-azureDevOpsOrgs-projects.json new file mode 100644 index 000000000000..cb182ff966ff --- /dev/null +++ b/src/Security/Security.Autorest/UX/Microsoft.Security/securityConnectors-azureDevOpsOrgs-projects.json @@ -0,0 +1,57 @@ +{ + "resourceType": "securityConnectors/azureDevOpsOrgs/projects", + "apiVersion": "2023-09-01-preview", + "learnMore": { + "url": "https://learn.microsoft.com/powershell/module/az.security" + }, + "commands": [ + { + "name": "Get-AzSecurityConnectorAzureDevOpsProject", + "description": "Returns a monitored Azure DevOps project resource.", + "path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}/projects/{projectName}", + "help": { + "learnMore": { + "url": "https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorazuredevopsproject" + }, + "parameterSets": [ + { + "parameters": [ + "-OrgName ", + "-ProjectName ", + "-ResourceGroupName ", + "-SecurityConnectorName ", + "[-SubscriptionId ]" + ] + } + ] + }, + "examples": [ + { + "description": "Returns a monitored Azure DevOps project resource.", + "parameters": [ + { + "name": "-OrgName", + "value": "[Path.orgName]" + }, + { + "name": "-ProjectName", + "value": "[Path.projectName]" + }, + { + "name": "-ResourceGroupName", + "value": "[Path.resourceGroupName]" + }, + { + "name": "-SecurityConnectorName", + "value": "[Path.securityConnectorName]" + }, + { + "name": "-SubscriptionId", + "value": "[Path.subscriptionId]" + } + ] + } + ] + } + ] +} diff --git a/src/Security/Security.Autorest/UX/Microsoft.Security/securityConnectors-azureDevOpsOrgs.json b/src/Security/Security.Autorest/UX/Microsoft.Security/securityConnectors-azureDevOpsOrgs.json new file mode 100644 index 000000000000..3c5f2a744375 --- /dev/null +++ b/src/Security/Security.Autorest/UX/Microsoft.Security/securityConnectors-azureDevOpsOrgs.json @@ -0,0 +1,52 @@ +{ + "resourceType": "securityConnectors/azureDevOpsOrgs", + "apiVersion": "2023-09-01-preview", + "learnMore": { + "url": "https://learn.microsoft.com/powershell/module/az.security" + }, + "commands": [ + { + "name": "Get-AzSecurityConnectorAzureDevOpsOrg", + "description": "Returns a monitored Azure DevOps organization resource.", + "path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}", + "help": { + "learnMore": { + "url": "https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorazuredevopsorg" + }, + "parameterSets": [ + { + "parameters": [ + "-OrgName ", + "-ResourceGroupName ", + "-SecurityConnectorName ", + "[-SubscriptionId ]" + ] + } + ] + }, + "examples": [ + { + "description": "Returns a monitored Azure DevOps organization resource.", + "parameters": [ + { + "name": "-OrgName", + "value": "[Path.orgName]" + }, + { + "name": "-ResourceGroupName", + "value": "[Path.resourceGroupName]" + }, + { + "name": "-SecurityConnectorName", + "value": "[Path.securityConnectorName]" + }, + { + "name": "-SubscriptionId", + "value": "[Path.subscriptionId]" + } + ] + } + ] + } + ] +} diff --git a/src/Security/Security.Autorest/UX/Microsoft.Security/securityConnectors-gitHubOwners-repos.json b/src/Security/Security.Autorest/UX/Microsoft.Security/securityConnectors-gitHubOwners-repos.json new file mode 100644 index 000000000000..a851a37d8a7c --- /dev/null +++ b/src/Security/Security.Autorest/UX/Microsoft.Security/securityConnectors-gitHubOwners-repos.json @@ -0,0 +1,57 @@ +{ + "resourceType": "securityConnectors/gitHubOwners/repos", + "apiVersion": "2023-09-01-preview", + "learnMore": { + "url": "https://learn.microsoft.com/powershell/module/az.security" + }, + "commands": [ + { + "name": "Get-AzSecurityConnectorGitHubRepo", + "description": "Returns a monitored GitHub repository.", + "path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitHubOwners/{ownerName}/repos/{repoName}", + "help": { + "learnMore": { + "url": "https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorgithubrepo" + }, + "parameterSets": [ + { + "parameters": [ + "-OwnerName ", + "-RepoName ", + "-ResourceGroupName ", + "-SecurityConnectorName ", + "[-SubscriptionId ]" + ] + } + ] + }, + "examples": [ + { + "description": "Returns a monitored GitHub repository.", + "parameters": [ + { + "name": "-OwnerName", + "value": "[Path.ownerName]" + }, + { + "name": "-RepoName", + "value": "[Path.repoName]" + }, + { + "name": "-ResourceGroupName", + "value": "[Path.resourceGroupName]" + }, + { + "name": "-SecurityConnectorName", + "value": "[Path.securityConnectorName]" + }, + { + "name": "-SubscriptionId", + "value": "[Path.subscriptionId]" + } + ] + } + ] + } + ] +} diff --git a/src/Security/Security.Autorest/UX/Microsoft.Security/securityConnectors-gitHubOwners.json b/src/Security/Security.Autorest/UX/Microsoft.Security/securityConnectors-gitHubOwners.json new file mode 100644 index 000000000000..c4f40ff560d8 --- /dev/null +++ b/src/Security/Security.Autorest/UX/Microsoft.Security/securityConnectors-gitHubOwners.json @@ -0,0 +1,52 @@ +{ + "resourceType": "securityConnectors/gitHubOwners", + "apiVersion": "2023-09-01-preview", + "learnMore": { + "url": "https://learn.microsoft.com/powershell/module/az.security" + }, + "commands": [ + { + "name": "Get-AzSecurityConnectorGitHubOwner", + "description": "Returns a monitored GitHub owner.", + "path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitHubOwners/{ownerName}", + "help": { + "learnMore": { + "url": "https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorgithubowner" + }, + "parameterSets": [ + { + "parameters": [ + "-OwnerName ", + "-ResourceGroupName ", + "-SecurityConnectorName ", + "[-SubscriptionId ]" + ] + } + ] + }, + "examples": [ + { + "description": "Returns a monitored GitHub owner.", + "parameters": [ + { + "name": "-OwnerName", + "value": "[Path.ownerName]" + }, + { + "name": "-ResourceGroupName", + "value": "[Path.resourceGroupName]" + }, + { + "name": "-SecurityConnectorName", + "value": "[Path.securityConnectorName]" + }, + { + "name": "-SubscriptionId", + "value": "[Path.subscriptionId]" + } + ] + } + ] + } + ] +} diff --git a/src/Security/Security.Autorest/UX/Microsoft.Security/securityConnectors-gitLabGroups-projects.json b/src/Security/Security.Autorest/UX/Microsoft.Security/securityConnectors-gitLabGroups-projects.json new file mode 100644 index 000000000000..a479a7df06dd --- /dev/null +++ b/src/Security/Security.Autorest/UX/Microsoft.Security/securityConnectors-gitLabGroups-projects.json @@ -0,0 +1,57 @@ +{ + "resourceType": "securityConnectors/gitLabGroups/projects", + "apiVersion": "2023-09-01-preview", + "learnMore": { + "url": "https://learn.microsoft.com/powershell/module/az.security" + }, + "commands": [ + { + "name": "Get-AzSecurityConnectorGitLabProject", + "description": "Returns a monitored GitLab Project resource for a given fully-qualified group name and project name.", + "path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitLabGroups/{groupFQName}/projects/{projectName}", + "help": { + "learnMore": { + "url": "https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorgitlabproject" + }, + "parameterSets": [ + { + "parameters": [ + "-GroupFqName ", + "-ProjectName ", + "-ResourceGroupName ", + "-SecurityConnectorName ", + "[-SubscriptionId ]" + ] + } + ] + }, + "examples": [ + { + "description": "Returns a monitored GitLab Project resource for a given fully-qualified group name and project name.", + "parameters": [ + { + "name": "-GroupFqName", + "value": "[Path.groupFQName]" + }, + { + "name": "-ProjectName", + "value": "[Path.projectName]" + }, + { + "name": "-ResourceGroupName", + "value": "[Path.resourceGroupName]" + }, + { + "name": "-SecurityConnectorName", + "value": "[Path.securityConnectorName]" + }, + { + "name": "-SubscriptionId", + "value": "[Path.subscriptionId]" + } + ] + } + ] + } + ] +} diff --git a/src/Security/Security.Autorest/UX/Microsoft.Security/securityConnectors-gitLabGroups.json b/src/Security/Security.Autorest/UX/Microsoft.Security/securityConnectors-gitLabGroups.json new file mode 100644 index 000000000000..947f059620ef --- /dev/null +++ b/src/Security/Security.Autorest/UX/Microsoft.Security/securityConnectors-gitLabGroups.json @@ -0,0 +1,52 @@ +{ + "resourceType": "securityConnectors/gitLabGroups", + "apiVersion": "2023-09-01-preview", + "learnMore": { + "url": "https://learn.microsoft.com/powershell/module/az.security" + }, + "commands": [ + { + "name": "Get-AzSecurityConnectorGitLabGroup", + "description": "Returns a monitored GitLab Group resource for a given fully-qualified name.", + "path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitLabGroups/{groupFQName}", + "help": { + "learnMore": { + "url": "https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorgitlabgroup" + }, + "parameterSets": [ + { + "parameters": [ + "-GroupFqName ", + "-ResourceGroupName ", + "-SecurityConnectorName ", + "[-SubscriptionId ]" + ] + } + ] + }, + "examples": [ + { + "description": "Returns a monitored GitLab Group resource for a given fully-qualified name.", + "parameters": [ + { + "name": "-GroupFqName", + "value": "[Path.groupFQName]" + }, + { + "name": "-ResourceGroupName", + "value": "[Path.resourceGroupName]" + }, + { + "name": "-SecurityConnectorName", + "value": "[Path.securityConnectorName]" + }, + { + "name": "-SubscriptionId", + "value": "[Path.subscriptionId]" + } + ] + } + ] + } + ] +} diff --git a/src/Security/Security.Autorest/UX/Microsoft.Security/securityConnectors.json b/src/Security/Security.Autorest/UX/Microsoft.Security/securityConnectors.json new file mode 100644 index 000000000000..55f55e7c98ca --- /dev/null +++ b/src/Security/Security.Autorest/UX/Microsoft.Security/securityConnectors.json @@ -0,0 +1,161 @@ +{ + "resourceType": "securityConnectors", + "apiVersion": "2023-09-01-preview", + "learnMore": { + "url": "https://learn.microsoft.com/powershell/module/az.security" + }, + "commands": [ + { + "name": "Get-AzSecurityConnectorDevOpsConfiguration", + "description": "Gets a DevOps Configuration.", + "path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default", + "help": { + "learnMore": { + "url": "https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectordevopsconfiguration" + }, + "parameterSets": [ + { + "parameters": [ + "-ResourceGroupName ", + "-SecurityConnectorName ", + "[-SubscriptionId ]" + ] + } + ] + }, + "examples": [ + { + "description": "Gets a DevOps Configuration.", + "parameters": [ + { + "name": "-ResourceGroupName", + "value": "[Path.resourceGroupName]" + }, + { + "name": "-SecurityConnectorName", + "value": "[Path.securityConnectorName]" + }, + { + "name": "-SubscriptionId", + "value": "[Path.subscriptionId]" + } + ] + } + ] + }, + { + "name": "Get-AzSecurityConnector", + "description": "Retrieves details of a specific security connector", + "path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}", + "help": { + "learnMore": { + "url": "https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnector" + }, + "parameterSets": [ + { + "parameters": [ + "-Name ", + "-ResourceGroupName ", + "[-SubscriptionId ]" + ] + } + ] + }, + "examples": [ + { + "description": "Retrieves details of a specific security connector", + "parameters": [ + { + "name": "-Name", + "value": "[Path.securityConnectorName]" + }, + { + "name": "-ResourceGroupName", + "value": "[Path.resourceGroupName]" + }, + { + "name": "-SubscriptionId", + "value": "[Path.subscriptionId]" + } + ] + } + ] + }, + { + "name": "Remove-AzSecurityConnectorDevOpsConfiguration", + "description": "Deletes a DevOps Connector.", + "path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default", + "help": { + "learnMore": { + "url": "https://learn.microsoft.com/powershell/module/az.security/remove-azsecurityconnectordevopsconfiguration" + }, + "parameterSets": [ + { + "parameters": [ + "-ResourceGroupName ", + "-SecurityConnectorName ", + "[-SubscriptionId ]" + ] + } + ] + }, + "examples": [ + { + "description": "Deletes a DevOps Connector.", + "parameters": [ + { + "name": "-ResourceGroupName", + "value": "[Path.resourceGroupName]" + }, + { + "name": "-SecurityConnectorName", + "value": "[Path.securityConnectorName]" + }, + { + "name": "-SubscriptionId", + "value": "[Path.subscriptionId]" + } + ] + } + ] + }, + { + "name": "Remove-AzSecurityConnector", + "description": "Deletes a security connector.", + "path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}", + "help": { + "learnMore": { + "url": "https://learn.microsoft.com/powershell/module/az.security/remove-azsecurityconnector" + }, + "parameterSets": [ + { + "parameters": [ + "-Name ", + "-ResourceGroupName ", + "[-SubscriptionId ]" + ] + } + ] + }, + "examples": [ + { + "description": "Deletes a security connector.", + "parameters": [ + { + "name": "-Name", + "value": "[Path.securityConnectorName]" + }, + { + "name": "-ResourceGroupName", + "value": "[Path.resourceGroupName]" + }, + { + "name": "-SubscriptionId", + "value": "[Path.subscriptionId]" + } + ] + } + ] + } + ] +} diff --git a/src/Security/Security.Autorest/build-module.ps1 b/src/Security/Security.Autorest/build-module.ps1 new file mode 100644 index 000000000000..bd565f03461c --- /dev/null +++ b/src/Security/Security.Autorest/build-module.ps1 @@ -0,0 +1,180 @@ +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- +param([switch]$NotIsolated, [switch]$Run, [switch]$Test, [switch]$Docs, [switch]$Pack, [switch]$Code, [switch]$Release, [switch]$Debugger, [switch]$NoDocs, [switch]$UX) +$ErrorActionPreference = 'Stop' + +if($PSEdition -ne 'Core') { + Write-Error 'This script requires PowerShell Core to execute. [Note] Generated cmdlets will work in both PowerShell Core or Windows PowerShell.' +} + +if(-not $NotIsolated -and -not $Debugger) { + Write-Host -ForegroundColor Green 'Creating isolated process...' + $pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path + & "$pwsh" -NonInteractive -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -NotIsolated + + if($LastExitCode -ne 0) { + # Build failed. Don't attempt to run the module. + return + } + + if($Test) { + . (Join-Path $PSScriptRoot 'test-module.ps1') + if($LastExitCode -ne 0) { + # Tests failed. Don't attempt to run the module. + return + } + } + + if($Docs) { + . (Join-Path $PSScriptRoot 'generate-help.ps1') + if($LastExitCode -ne 0) { + # Docs generation failed. Don't attempt to run the module. + return + } + } + + if($UX) { + . (Join-Path $PSScriptRoot 'generate-portal-ux.ps1') + if($LastExitCode -ne 0) { + # UX generation failed. Don't attempt to run the module. + return + } + } + + if($Pack) { + . (Join-Path $PSScriptRoot 'pack-module.ps1') + if($LastExitCode -ne 0) { + # Packing failed. Don't attempt to run the module. + return + } + } + + $runModulePath = Join-Path $PSScriptRoot 'run-module.ps1' + if($Code) { + . $runModulePath -Code + } elseif($Run) { + . $runModulePath + } else { + Write-Host -ForegroundColor Cyan "To run this module in an isolated PowerShell session, run the 'run-module.ps1' script or provide the '-Run' parameter to this script." + } + return +} + +$binFolder = Join-Path $PSScriptRoot 'bin' +$objFolder = Join-Path $PSScriptRoot 'obj' + +if(-not $Debugger) { + Write-Host -ForegroundColor Green 'Cleaning build folders...' + $null = Remove-Item -Recurse -ErrorAction SilentlyContinue -Path $binFolder, $objFolder + + if((Test-Path $binFolder) -or (Test-Path $objFolder)) { + Write-Host -ForegroundColor Cyan 'Did you forget to exit your isolated module session before rebuilding?' + Write-Error 'Unable to clean ''bin'' or ''obj'' folder. A process may have an open handle.' + } + + Write-Host -ForegroundColor Green 'Compiling module...' + $buildConfig = 'Debug' + if($Release) { + $buildConfig = 'Release' + } + dotnet publish $PSScriptRoot --verbosity quiet --configuration $buildConfig /nologo + if($LastExitCode -ne 0) { + Write-Error 'Compilation failed.' + } + + $null = Remove-Item -Recurse -ErrorAction SilentlyContinue -Path (Join-Path $binFolder 'Debug'), (Join-Path $binFolder 'Release') +} + +$dll = Join-Path $PSScriptRoot 'bin\Az.Security.private.dll' +if(-not (Test-Path $dll)) { + Write-Error "Unable to find output assembly in '$binFolder'." +} + +# Load DLL to use build-time cmdlets +$null = Import-Module -Name $dll + +$modulePaths = $dll +$customPsm1 = Join-Path $PSScriptRoot 'custom\Az.Security.custom.psm1' +if(Test-Path $customPsm1) { + $modulePaths = @($dll, $customPsm1) +} + +$exportsFolder = Join-Path $PSScriptRoot 'exports' +if(Test-Path $exportsFolder) { + $null = Get-ChildItem -Path $exportsFolder -Recurse -Exclude 'README.md' | Remove-Item -Recurse -ErrorAction SilentlyContinue +} +$null = New-Item -ItemType Directory -Force -Path $exportsFolder + +$internalFolder = Join-Path $PSScriptRoot 'internal' +if(Test-Path $internalFolder) { + $null = Get-ChildItem -Path $internalFolder -Recurse -Exclude '*.psm1', 'README.md' | Remove-Item -Recurse -ErrorAction SilentlyContinue +} +$null = New-Item -ItemType Directory -Force -Path $internalFolder + +$psd1 = Join-Path $PSScriptRoot './Az.Security.psd1' +$guid = Get-ModuleGuid -Psd1Path $psd1 +$moduleName = 'Az.Security' +$examplesFolder = Join-Path $PSScriptRoot 'examples' +$null = New-Item -ItemType Directory -Force -Path $examplesFolder + +Write-Host -ForegroundColor Green 'Creating cmdlets for specified models...' +$modelCmdlets = @(@{modelName="AwsEnvironment"; cmdletName=""}, @{modelName="AwsOrganizationalDataMaster"; cmdletName=""}, @{modelName="AwsOrganizationalDataMember"; cmdletName=""}, @{modelName="GcpProjectEnvironment"; cmdletName=""}, @{modelName="GcpOrganizationalDataOrganization"; cmdletName=""}, @{modelName="GcpOrganizationalDataMember"; cmdletName=""}, @{modelName="AzureDevOpsScopeEnvironment"; cmdletName=""}, @{modelName="GitLabScopeEnvironment"; cmdletName=""}, @{modelName="GitHubScopeEnvironment"; cmdletName=""}, @{modelName="CspmMonitorAwsOffering"; cmdletName=""}, @{modelName="CspmMonitorGcpOffering"; cmdletName=""}, @{modelName="CspmMonitorGithubOffering"; cmdletName=""}, @{modelName="CspmMonitorAzureDevOpsOffering"; cmdletName=""}, @{modelName="CspmMonitorGitLabOffering"; cmdletName=""}, @{modelName="DefenderCspmAwsOffering"; cmdletName=""}, @{modelName="DefenderCspmGcpOffering"; cmdletName=""}, @{modelName="DefenderForContainersAwsOffering"; cmdletName=""}, @{modelName="DefenderForContainersGcpOffering"; cmdletName=""}, @{modelName="DefenderForDatabasesAwsOffering"; cmdletName=""}, @{modelName="DefenderForDatabasesGcpOffering"; cmdletName=""}, @{modelName="DefenderForServersAwsOffering"; cmdletName=""}, @{modelName="DefenderForServersGcpOffering"; cmdletName=""}, @{modelName="InformationProtectionAwsOffering"; cmdletName=""}, @{modelName="ActionableRemediation"; cmdletName="New-AzSecurityConnectorActionableRemediationObject"}) +$modelCmdletFolder = Join-Path (Join-Path $PSScriptRoot './custom') 'autogen-model-cmdlets' +if (Test-Path $modelCmdletFolder) { + $null = Remove-Item -Force -Recurse -Path $modelCmdletFolder +} +if ($modelCmdlets.Count -gt 0) { + . (Join-Path $PSScriptRoot 'create-model-cmdlets.ps1') + CreateModelCmdlet($modelCmdlets) +} + +if($NoDocs) { + Write-Host -ForegroundColor Green 'Creating exports...' + Export-ProxyCmdlet -ModuleName $moduleName -ModulePath $modulePaths -ExportsFolder $exportsFolder -InternalFolder $internalFolder -ExcludeDocs -ExamplesFolder $examplesFolder +} else { + Write-Host -ForegroundColor Green 'Creating exports and docs...' + $moduleDescription = 'Microsoft Azure PowerShell: Security cmdlets' + $docsFolder = Join-Path $PSScriptRoot 'docs' + if(Test-Path $docsFolder) { + $null = Get-ChildItem -Path $docsFolder -Recurse -Exclude 'README.md' | Remove-Item -Recurse -ErrorAction SilentlyContinue + } + $null = New-Item -ItemType Directory -Force -Path $docsFolder + $addComplexInterfaceInfo = ![System.Convert]::ToBoolean('true') + Export-ProxyCmdlet -ModuleName $moduleName -ModulePath $modulePaths -ExportsFolder $exportsFolder -InternalFolder $internalFolder -ModuleDescription $moduleDescription -DocsFolder $docsFolder -ExamplesFolder $examplesFolder -ModuleGuid $guid -AddComplexInterfaceInfo:$addComplexInterfaceInfo +} + +Write-Host -ForegroundColor Green 'Creating format.ps1xml...' +$formatPs1xml = Join-Path $PSScriptRoot './Az.Security.format.ps1xml' +Export-FormatPs1xml -FilePath $formatPs1xml + +Write-Host -ForegroundColor Green 'Creating psd1...' +$customFolder = Join-Path $PSScriptRoot 'custom' +Export-Psd1 -ExportsFolder $exportsFolder -CustomFolder $customFolder -Psd1Path $psd1 -ModuleGuid $guid + +Write-Host -ForegroundColor Green 'Creating test stubs...' +$testFolder = Join-Path $PSScriptRoot 'test' +$null = New-Item -ItemType Directory -Force -Path $testFolder +Export-TestStub -ModuleName $moduleName -ExportsFolder $exportsFolder -OutputFolder $testFolder + +Write-Host -ForegroundColor Green 'Creating example stubs...' +Export-ExampleStub -ExportsFolder $exportsFolder -OutputFolder $examplesFolder + +if (Test-Path (Join-Path $PSScriptRoot 'generate-portal-ux.ps1')) +{ + Write-Host -ForegroundColor Green 'Creating ux metadata...' + . (Join-Path $PSScriptRoot 'generate-portal-ux.ps1') +} + +Write-Host -ForegroundColor Green '-------------Done-------------' diff --git a/src/Security/Security.Autorest/check-dependencies.ps1 b/src/Security/Security.Autorest/check-dependencies.ps1 new file mode 100644 index 000000000000..90ca9867ae40 --- /dev/null +++ b/src/Security/Security.Autorest/check-dependencies.ps1 @@ -0,0 +1,65 @@ +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- +param([switch]$NotIsolated, [switch]$Accounts, [switch]$Pester, [switch]$Resources) +$ErrorActionPreference = 'Stop' + +if(-not $NotIsolated) { + Write-Host -ForegroundColor Green 'Creating isolated process...' + $pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path + & "$pwsh" -NoExit -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -NotIsolated + return +} + +function DownloadModule ([bool]$predicate, [string]$path, [string]$moduleName, [string]$versionMinimum, [string]$requiredVersion) { + if($predicate) { + $module = Get-Module -ListAvailable -Name $moduleName + if((-not $module) -or ($versionMinimum -and ($module | ForEach-Object { $_.Version } | Where-Object { $_ -ge [System.Version]$versionMinimum } | Measure-Object).Count -eq 0) -or ($requiredVersion -and ($module | ForEach-Object { $_.Version } | Where-Object { $_ -eq [System.Version]$requiredVersion } | Measure-Object).Count -eq 0)) { + $null = New-Item -ItemType Directory -Force -Path $path + Write-Host -ForegroundColor Green "Installing local $moduleName module into '$path'..." + if ($requiredVersion) { + Find-Module -Name $moduleName -RequiredVersion $requiredVersion -Repository PSGallery | Save-Module -Path $path + }elseif($versionMinimum) { + Find-Module -Name $moduleName -MinimumVersion $versionMinimum -Repository PSGallery | Save-Module -Path $path + } else { + Find-Module -Name $moduleName -Repository PSGallery | Save-Module -Path $path + } + } + } +} + +$ProgressPreference = 'SilentlyContinue' +$all = (@($Accounts.IsPresent, $Pester.IsPresent) | Select-Object -Unique | Measure-Object).Count -eq 1 + +$localModulesPath = Join-Path $PSScriptRoot 'generated\modules' +if(Test-Path -Path $localModulesPath) { + $env:PSModulePath = "$localModulesPath$([IO.Path]::PathSeparator)$env:PSModulePath" +} + +DownloadModule -predicate ($all -or $Accounts) -path $localModulesPath -moduleName 'Az.Accounts' -versionMinimum '2.7.5' +DownloadModule -predicate ($all -or $Pester) -path $localModulesPath -moduleName 'Pester' -requiredVersion '4.10.1' + +$tools = Join-Path $PSScriptRoot 'tools' +$resourceDir = Join-Path $tools 'Resources' +$resourceModule = Join-Path $HOME '.PSSharedModules\Resources\Az.Resources.TestSupport.psm1' + +if ($Resources.IsPresent -and ((-not (Test-Path -Path $resourceModule)) -or $RegenerateSupportModule.IsPresent)) { + Write-Host -ForegroundColor Green "Building local Resource module used for test..." + Set-Location $resourceDir + $null = autorest .\README.md --use:@autorest/powershell@3.0.414 --output-folder=$HOME/.PSSharedModules/Resources + $null = Copy-Item custom/* $HOME/.PSSharedModules/Resources/custom/ + Set-Location $HOME/.PSSharedModules/Resources + $null = .\build-module.ps1 + Set-Location $PSScriptRoot +} diff --git a/src/Security/Security.Autorest/create-model-cmdlets.ps1 b/src/Security/Security.Autorest/create-model-cmdlets.ps1 new file mode 100644 index 000000000000..e7b7b2f56dac --- /dev/null +++ b/src/Security/Security.Autorest/create-model-cmdlets.ps1 @@ -0,0 +1,262 @@ +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +function CreateModelCmdlet { + + param([Hashtable[]]$Models) + + if ($Models.Count -eq 0) + { + return + } + + $ModelCsPath = Join-Path (Join-Path $PSScriptRoot 'generated\api') 'Models' + $OutputDir = Join-Path $PSScriptRoot 'custom\autogen-model-cmdlets' + $null = New-Item -ItemType Directory -Force -Path $OutputDir + if (''.length -gt 0) { + $ModuleName = '' + } else { + $ModuleName = 'Az.Security' + } + $CsFiles = Get-ChildItem -Path $ModelCsPath -Recurse -Filter *.cs + $Content = '' + $null = $CsFiles | ForEach-Object -Process { if ($_.Name.Split('.').count -eq 2 ) + { $Content += get-content $_.fullname -raw + } } + + $Tree = [Microsoft.CodeAnalysis.CSharp.SyntaxFactory]::ParseCompilationUnit($Content) + $Nodes = $Tree.ChildNodes().ChildNodes() + $classConstantMember = @{} + foreach ($Model in $Models) + { + $ModelName = $Model.modelName + $InterfaceNode = $Nodes | Where-Object { ($_.Keyword.value -eq 'interface') -and ($_.Identifier.value -eq "I$ModelName") } + $ClassNode = $Nodes | Where-Object { ($_.Keyword.value -eq 'class') -and ($_.Identifier.value -eq "$ModelName") } + $classConstantMember = @() + foreach ($class in $ClassNode) { + foreach ($member in $class.Members) { + $isConstant = $false + foreach ($attr in $member.AttributeLists) { + $memberName = $attr.Attributes.Name.ToString() + if ($memberName.EndsWith('.Constant')) { + $isConstant = $true + break + } + } + if (($member.Modifiers.ToString() -eq 'public') -and $isConstant) { + $classConstantMember += $member.Identifier.Value + } + } + } + if ($InterfaceNode.count -eq 0) { + continue + } + # through a queue, we iterate all the parent models. + $Queue = @($InterfaceNode) + $visited = @("I$ModelName") + $AllInterfaceNodes = @() + while ($Queue.count -ne 0) + { + $AllInterfaceNodes += $Queue[0] + # Baselist contains the direct parent models. + foreach ($parent in $Queue[0].BaseList.Types) + { + if (($parent.Type.Right.Identifier.Value -ne 'IJsonSerializable') -and (-not $visited.Contains($parent.Type.Right.Identifier.Value))) + { + $Queue = [Array]$Queue + ($Nodes | Where-Object { ($_.Keyword.value -eq 'interface') -and ($_.Identifier.value -eq $parent.Type.Right.Identifier.Value) }) + $visited = [Array]$visited + $parent.Type.Right.Identifier.Value + } + } + $first, $Queue = $Queue + } + + $Namespace = $InterfaceNode.Parent.Name + $ObjectType = $ModelName + $ObjectTypeWithNamespace = "${Namespace}.${ObjectType}" + # remove duplicated module name + if ($ObjectType.StartsWith('Security')) { + $ModulePrefix = '' + } else { + $ModulePrefix = 'Security' + } + $OutputPath = Join-Path -ChildPath "New-Az${ModulePrefix}${ObjectType}Object.ps1" -Path $OutputDir + + $ParameterDefineScriptList = New-Object System.Collections.Generic.List[string] + $ParameterAssignScriptList = New-Object System.Collections.Generic.List[string] + foreach ($Node in $AllInterfaceNodes) + { + foreach ($Member in $Node.Members) + { + if ($classConstantMember.Contains($Member.Identifier.Value)) { + # skip constant member + continue + } + $Arguments = $Member.AttributeLists.Attributes.ArgumentList.Arguments + $Required = $false + $Description = "" + $Readonly = $False + $mutability = @{Read = $true; Create = $true; Update = $true} + foreach ($Argument in $Arguments) + { + if ($Argument.NameEquals.Name.Identifier.Value -eq "Required") + { + $Required = $Argument.Expression.Token.Value + } + if ($Argument.NameEquals.Name.Identifier.Value -eq "Description") + { + $Description = $Argument.Expression.Token.Value.Trim('.').replace('"', '`"') + } + if ($Argument.NameEquals.Name.Identifier.Value -eq "Readonly") + { + $Readonly = $Argument.Expression.Token.Value + } + if ($Argument.NameEquals.Name.Identifier.Value -eq "Read") + { + $mutability.Read = $Argument.Expression.Token.Value + } + if ($Argument.NameEquals.Name.Identifier.Value -eq "Create") + { + $mutability.Create = $Argument.Expression.Token.Value + } + if ($Argument.NameEquals.Name.Identifier.Value -eq "Update") + { + $mutability.Update = $Argument.Expression.Token.Value + } + } + if ($Readonly) + { + continue + } + $Identifier = $Member.Identifier.Value + $Type = $Member.Type.ToString().replace('?', '').Split("::")[-1] + $Type = $Member.Type.ToString().replace('?', '').Split("::")[-1] + if ($Type.StartsWith("System.Collections.Generic.List")) + { + # if the type is a list, we need to convert it to array + $matched = $Type -match '\<(?.+)\>$' + if ($matched) + { + $Type = $matches.Name + '[]'; + } + } + $ParameterDefinePropertyList = New-Object System.Collections.Generic.List[string] + if ($Required -and $mutability.Create -and $mutability.Update) + { + $ParameterDefinePropertyList.Add("Mandatory") + } + if ($Description -ne "") + { + $ParameterDefinePropertyList.Add("HelpMessage=`"${Description}.`"") + } + $ParameterDefineProperty = [System.String]::Join(", ", $ParameterDefinePropertyList) + # check whether completer is needed + $completer = ''; + if(IsEnumType($Member)){ + $completer += GetCompleter($Member) + } + $ParameterDefineScript = " + [Parameter($ParameterDefineProperty)]${completer} + [${Type}] + `$${Identifier}" + $ParameterDefineScriptList.Add($ParameterDefineScript) + $ParameterAssignScriptList.Add(" + if (`$PSBoundParameters.ContainsKey('${Identifier}')) { + `$Object.${Identifier} = `$${Identifier} + }") + } + } + $ParameterDefineScript = $ParameterDefineScriptList | Join-String -Separator "," + $ParameterAssignScript = $ParameterAssignScriptList | Join-String -Separator "" + + $cmdletName = "New-Az${ModulePrefix}${ObjectType}Object" + if ('' -ne $Model.cmdletName) { + $cmdletName = $Model.cmdletName + } + $OutputPath = Join-Path -ChildPath "${cmdletName}.ps1" -Path $OutputDir + $cmdletNameInLowerCase = $cmdletName.ToLower() + $Script = " +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the ""License""); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an ""AS IS"" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create an in-memory object for ${ObjectType}. +.Description +Create an in-memory object for ${ObjectType}. + +.Outputs +${ObjectTypeWithNamespace} +.Link +https://learn.microsoft.com/powershell/module/${ModuleName}/${cmdletNameInLowerCase} +#> +function ${cmdletName} { + [OutputType('${ObjectTypeWithNamespace}')] + [CmdletBinding(PositionalBinding=`$false)] + Param( +${ParameterDefineScript} + ) + + process { + `$Object = [${ObjectTypeWithNamespace}]::New() +${ParameterAssignScript} + return `$Object + } +} +" + Set-Content -Path $OutputPath -Value $Script + } +} + +function IsEnumType { + param ( + [Microsoft.CodeAnalysis.CSharp.Syntax.PropertyDeclarationSyntax]$property + ) + $isEnum = $false + foreach ($attr in $property.AttributeLists) { + $attributeName = $attr.Attributes.Name.ToString() + if ($attributeName.Contains('ArgumentCompleter')) { + $isEnum = $true + break + } + } + return $isEnum; +} + +function GetCompleter { + param ( + [Microsoft.CodeAnalysis.CSharp.Syntax.PropertyDeclarationSyntax]$property + ) + foreach ($attr in $property.AttributeLists) { + $attributeName = $attr.Attributes.Name.ToString() + if ($attributeName.Contains('ArgumentCompleter')) { + $attributeName = $attributeName.Split("::")[-1] + $possibleValues = [System.String]::Join(", ", $attr.Attributes.ArgumentList.Arguments) + $completer += "`n [${attributeName}(${possibleValues})]" + return $completer + } + } +} diff --git a/src/Security/Security.Autorest/custom/Az.Security.custom.psm1 b/src/Security/Security.Autorest/custom/Az.Security.custom.psm1 new file mode 100644 index 000000000000..e06d9e09deba --- /dev/null +++ b/src/Security/Security.Autorest/custom/Az.Security.custom.psm1 @@ -0,0 +1,17 @@ +# region Generated + # Load the private module dll + $null = Import-Module -PassThru -Name (Join-Path $PSScriptRoot '..\bin\Az.Security.private.dll') + + # Load the internal module + $internalModulePath = Join-Path $PSScriptRoot '..\internal\Az.Security.internal.psm1' + if(Test-Path $internalModulePath) { + $null = Import-Module -Name $internalModulePath + } + + # Export nothing to clear implicit exports + Export-ModuleMember + + # Export script cmdlets + Get-ChildItem -Path $PSScriptRoot -Recurse -Include '*.ps1' -File | ForEach-Object { . $_.FullName } + Export-ModuleMember -Function (Get-ScriptCmdlet -ScriptFolder $PSScriptRoot) -Alias (Get-ScriptCmdlet -ScriptFolder $PSScriptRoot -AsAlias) +# endregion diff --git a/src/Security/Security.Autorest/custom/README.md b/src/Security/Security.Autorest/custom/README.md new file mode 100644 index 000000000000..9462ffd6b074 --- /dev/null +++ b/src/Security/Security.Autorest/custom/README.md @@ -0,0 +1,41 @@ +# Custom +This directory contains custom implementation for non-generated cmdlets for the `Az.Security` module. Both scripts (`.ps1`) and C# files (`.cs`) can be implemented here. They will be used during the build process in `build-module.ps1`, and create cmdlets into the `..\exports` folder. The only generated file into this folder is the `Az.Security.custom.psm1`. This file should not be modified. + +## Info +- Modifiable: yes +- Generated: partial +- Committed: yes +- Packaged: yes + +## Details +For `Az.Security` to use custom cmdlets, it does this two different ways. We **highly recommend** creating script cmdlets, as they are easier to write and allow access to the other exported cmdlets. C# cmdlets *cannot access exported cmdlets*. + +For C# cmdlets, they are compiled with the rest of the generated low-level cmdlets into the `./bin/Az.Security.private.dll`. The names of the cmdlets (methods) and files must follow the `[cmdletName]_[variantName]` syntax used for generated cmdlets. The `variantName` is used as the `ParameterSetName`, so use something appropriate that doesn't clash with already created variant or parameter set names. You cannot use the `ParameterSetName` property in the `Parameter` attribute on C# cmdlets. Each cmdlet must be separated into variants using the same pattern as seen in the `generated/cmdlets` folder. + +For script cmdlets, these are loaded via the `Az.Security.custom.psm1`. Then, during the build process, this module is loaded and processed in the same manner as the C# cmdlets. The fundamental difference is the script cmdlets use the `ParameterSetName` attribute and C# cmdlets do not. To create a script cmdlet variant of a generated cmdlet, simply decorate all parameters in the script with the new `ParameterSetName` in the `Parameter` attribute. This will appropriately treat each parameter set as a separate variant when processed to be exported during the build. + +## Purpose +This allows the modules to have cmdlets that were not defined in the REST specification. It also allows combining logic using generated cmdlets. This is a level of customization beyond what can be done using the [readme configuration options](https://github.com/Azure/autorest/blob/master/docs/powershell/options.md) that are currently available. These custom cmdlets are then referenced by the cmdlets created at build-time in the `..\exports` folder. + +## Usage +The easiest way currently to start developing custom cmdlets is to copy an existing cmdlet. For C# cmdlets, copy one from the `generated/cmdlets` folder. For script cmdlets, build the project using `build-module.ps1` and copy one of the scripts from the `..\exports` folder. After that, if you want to add new parameter sets, follow the guidelines in the `Details` section above. For implementing a new cmdlets, at minimum, please keep these parameters: +- Break +- DefaultProfile +- HttpPipelineAppend +- HttpPipelinePrepend +- Proxy +- ProxyCredential +- ProxyUseDefaultCredentials + +These provide functionality to our HTTP pipeline and other useful features. In script, you can forward these parameters using `$PSBoundParameters` to the other cmdlets you're calling within `Az.Security`. For C#, follow the usage seen in the `ProcessRecordAsync` method. + +### Attributes +For processing the cmdlets, we've created some additional attributes: +- `Microsoft.Azure.PowerShell.Cmdlets.Security.DescriptionAttribute` + - Used in C# cmdlets to provide a high-level description of the cmdlet. This is propagated to reference documentation via [help comments](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_comment_based_help) in the exported scripts. +- `Microsoft.Azure.PowerShell.Cmdlets.Security.DoNotExportAttribute` + - Used in C# and script cmdlets to suppress creating an exported cmdlet at build-time. These cmdlets will *not be exposed* by `Az.Security`. +- `Microsoft.Azure.PowerShell.Cmdlets.Security.InternalExportAttribute` + - Used in C# cmdlets to route exported cmdlets to the `..\internal`, which are *not exposed* by `Az.Security`. For more information, see [README.md](..\internal/README.md) in the `..\internal` folder. +- `Microsoft.Azure.PowerShell.Cmdlets.Security.ProfileAttribute` + - Used in C# and script cmdlets to define which Azure profiles the cmdlet supports. This is only supported for Azure (`--azure`) modules. \ No newline at end of file diff --git a/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityAwsEnvironmentObject.ps1 b/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityAwsEnvironmentObject.ps1 new file mode 100644 index 000000000000..ed2ab1f6d1a2 --- /dev/null +++ b/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityAwsEnvironmentObject.ps1 @@ -0,0 +1,59 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create an in-memory object for AwsEnvironment. +.Description +Create an in-memory object for AwsEnvironment. + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AwsEnvironment +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecurityawsenvironmentobject +#> +function New-AzSecurityAwsEnvironmentObject { + [OutputType('Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AwsEnvironment')] + [CmdletBinding(PositionalBinding=$false)] + Param( + + [Parameter(HelpMessage="The AWS account's organizational data.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalData] + $OrganizationalData, + [Parameter(HelpMessage="list of regions to scan.")] + [string[]] + $Region, + [Parameter(HelpMessage="Scan interval in hours (value should be between 1-hour to 24-hours).")] + [long] + $ScanInterval + ) + + process { + $Object = [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AwsEnvironment]::New() + + if ($PSBoundParameters.ContainsKey('OrganizationalData')) { + $Object.OrganizationalData = $OrganizationalData + } + if ($PSBoundParameters.ContainsKey('Region')) { + $Object.Region = $Region + } + if ($PSBoundParameters.ContainsKey('ScanInterval')) { + $Object.ScanInterval = $ScanInterval + } + return $Object + } +} + diff --git a/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityAwsOrganizationalDataMasterObject.ps1 b/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityAwsOrganizationalDataMasterObject.ps1 new file mode 100644 index 000000000000..bc18f632d4c9 --- /dev/null +++ b/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityAwsOrganizationalDataMasterObject.ps1 @@ -0,0 +1,53 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create an in-memory object for AwsOrganizationalDataMaster. +.Description +Create an in-memory object for AwsOrganizationalDataMaster. + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AwsOrganizationalDataMaster +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecurityawsorganizationaldatamasterobject +#> +function New-AzSecurityAwsOrganizationalDataMasterObject { + [OutputType('Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AwsOrganizationalDataMaster')] + [CmdletBinding(PositionalBinding=$false)] + Param( + + [Parameter(HelpMessage="If the multi cloud account is of membership type organization, list of accounts excluded from offering.")] + [string[]] + $ExcludedAccountId, + [Parameter(HelpMessage="If the multi cloud account is of membership type organization, this will be the name of the onboarding stackset.")] + [string] + $StacksetName + ) + + process { + $Object = [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AwsOrganizationalDataMaster]::New() + + if ($PSBoundParameters.ContainsKey('ExcludedAccountId')) { + $Object.ExcludedAccountId = $ExcludedAccountId + } + if ($PSBoundParameters.ContainsKey('StacksetName')) { + $Object.StacksetName = $StacksetName + } + return $Object + } +} + diff --git a/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityAwsOrganizationalDataMemberObject.ps1 b/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityAwsOrganizationalDataMemberObject.ps1 new file mode 100644 index 000000000000..bc6458ecd4af --- /dev/null +++ b/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityAwsOrganizationalDataMemberObject.ps1 @@ -0,0 +1,47 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create an in-memory object for AwsOrganizationalDataMember. +.Description +Create an in-memory object for AwsOrganizationalDataMember. + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AwsOrganizationalDataMember +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecurityawsorganizationaldatamemberobject +#> +function New-AzSecurityAwsOrganizationalDataMemberObject { + [OutputType('Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AwsOrganizationalDataMember')] + [CmdletBinding(PositionalBinding=$false)] + Param( + + [Parameter(HelpMessage="If the multi cloud account is not of membership type organization, this will be the ID of the account's parent.")] + [string] + $ParentHierarchyId + ) + + process { + $Object = [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AwsOrganizationalDataMember]::New() + + if ($PSBoundParameters.ContainsKey('ParentHierarchyId')) { + $Object.ParentHierarchyId = $ParentHierarchyId + } + return $Object + } +} + diff --git a/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityAzureDevOpsScopeEnvironmentObject.ps1 b/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityAzureDevOpsScopeEnvironmentObject.ps1 new file mode 100644 index 000000000000..913c90709519 --- /dev/null +++ b/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityAzureDevOpsScopeEnvironmentObject.ps1 @@ -0,0 +1,41 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create an in-memory object for AzureDevOpsScopeEnvironment. +.Description +Create an in-memory object for AzureDevOpsScopeEnvironment. + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsScopeEnvironment +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecurityazuredevopsscopeenvironmentobject +#> +function New-AzSecurityAzureDevOpsScopeEnvironmentObject { + [OutputType('Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsScopeEnvironment')] + [CmdletBinding(PositionalBinding=$false)] + Param( + + ) + + process { + $Object = [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsScopeEnvironment]::New() + + return $Object + } +} + diff --git a/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityConnectorActionableRemediationObject.ps1 b/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityConnectorActionableRemediationObject.ps1 new file mode 100644 index 000000000000..9567f77c2ce8 --- /dev/null +++ b/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityConnectorActionableRemediationObject.ps1 @@ -0,0 +1,73 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create an in-memory object for ActionableRemediation. +.Description +Create an in-memory object for ActionableRemediation. + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ActionableRemediation +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecurityconnectoractionableremediationobject +#> +function New-AzSecurityConnectorActionableRemediationObject { + [OutputType('Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ActionableRemediation')] + [CmdletBinding(PositionalBinding=$false)] + Param( + + [Parameter(HelpMessage="Repository branch configuration for PR Annotations.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITargetBranchConfiguration] + $BranchConfiguration, + [Parameter(HelpMessage="Gets or sets list of categories and severity levels.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICategoryConfiguration[]] + $CategoryConfiguration, + [Parameter(HelpMessage="Update Settings. + + Enabled - Resource should inherit configurations from parent. + Disabled - Resource should not inherit configurations from parent.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Disabled", "Enabled")] + [string] + $InheritFromParentState, + [Parameter(HelpMessage="ActionableRemediation Setting. + None - the setting was never set. + Enabled - ActionableRemediation is enabled. + Disabled - ActionableRemediation is disabled.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("None", "Disabled", "Enabled")] + [string] + $State + ) + + process { + $Object = [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ActionableRemediation]::New() + + if ($PSBoundParameters.ContainsKey('BranchConfiguration')) { + $Object.BranchConfiguration = $BranchConfiguration + } + if ($PSBoundParameters.ContainsKey('CategoryConfiguration')) { + $Object.CategoryConfiguration = $CategoryConfiguration + } + if ($PSBoundParameters.ContainsKey('InheritFromParentState')) { + $Object.InheritFromParentState = $InheritFromParentState + } + if ($PSBoundParameters.ContainsKey('State')) { + $Object.State = $State + } + return $Object + } +} + diff --git a/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityCspmMonitorAwsOfferingObject.ps1 b/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityCspmMonitorAwsOfferingObject.ps1 new file mode 100644 index 000000000000..13c9f890a9a7 --- /dev/null +++ b/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityCspmMonitorAwsOfferingObject.ps1 @@ -0,0 +1,47 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create an in-memory object for CspmMonitorAwsOffering. +.Description +Create an in-memory object for CspmMonitorAwsOffering. + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CspmMonitorAwsOffering +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritycspmmonitorawsofferingobject +#> +function New-AzSecurityCspmMonitorAwsOfferingObject { + [OutputType('Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CspmMonitorAwsOffering')] + [CmdletBinding(PositionalBinding=$false)] + Param( + + [Parameter(HelpMessage="The cloud role ARN in AWS for this feature.")] + [string] + $NativeCloudConnectionCloudRoleArn + ) + + process { + $Object = [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CspmMonitorAwsOffering]::New() + + if ($PSBoundParameters.ContainsKey('NativeCloudConnectionCloudRoleArn')) { + $Object.NativeCloudConnectionCloudRoleArn = $NativeCloudConnectionCloudRoleArn + } + return $Object + } +} + diff --git a/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityCspmMonitorAzureDevOpsOfferingObject.ps1 b/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityCspmMonitorAzureDevOpsOfferingObject.ps1 new file mode 100644 index 000000000000..12d00a7d1b64 --- /dev/null +++ b/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityCspmMonitorAzureDevOpsOfferingObject.ps1 @@ -0,0 +1,41 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create an in-memory object for CspmMonitorAzureDevOpsOffering. +.Description +Create an in-memory object for CspmMonitorAzureDevOpsOffering. + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CspmMonitorAzureDevOpsOffering +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritycspmmonitorazuredevopsofferingobject +#> +function New-AzSecurityCspmMonitorAzureDevOpsOfferingObject { + [OutputType('Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CspmMonitorAzureDevOpsOffering')] + [CmdletBinding(PositionalBinding=$false)] + Param( + + ) + + process { + $Object = [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CspmMonitorAzureDevOpsOffering]::New() + + return $Object + } +} + diff --git a/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityCspmMonitorGcpOfferingObject.ps1 b/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityCspmMonitorGcpOfferingObject.ps1 new file mode 100644 index 000000000000..5f403590faf7 --- /dev/null +++ b/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityCspmMonitorGcpOfferingObject.ps1 @@ -0,0 +1,53 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create an in-memory object for CspmMonitorGcpOffering. +.Description +Create an in-memory object for CspmMonitorGcpOffering. + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CspmMonitorGcpOffering +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritycspmmonitorgcpofferingobject +#> +function New-AzSecurityCspmMonitorGcpOfferingObject { + [OutputType('Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CspmMonitorGcpOffering')] + [CmdletBinding(PositionalBinding=$false)] + Param( + + [Parameter(HelpMessage="The service account email address in GCP for this offering.")] + [string] + $NativeCloudConnectionServiceAccountEmailAddress, + [Parameter(HelpMessage="The GCP workload identity provider id for the offering.")] + [string] + $NativeCloudConnectionWorkloadIdentityProviderId + ) + + process { + $Object = [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CspmMonitorGcpOffering]::New() + + if ($PSBoundParameters.ContainsKey('NativeCloudConnectionServiceAccountEmailAddress')) { + $Object.NativeCloudConnectionServiceAccountEmailAddress = $NativeCloudConnectionServiceAccountEmailAddress + } + if ($PSBoundParameters.ContainsKey('NativeCloudConnectionWorkloadIdentityProviderId')) { + $Object.NativeCloudConnectionWorkloadIdentityProviderId = $NativeCloudConnectionWorkloadIdentityProviderId + } + return $Object + } +} + diff --git a/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityCspmMonitorGitLabOfferingObject.ps1 b/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityCspmMonitorGitLabOfferingObject.ps1 new file mode 100644 index 000000000000..6c965ecd30bb --- /dev/null +++ b/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityCspmMonitorGitLabOfferingObject.ps1 @@ -0,0 +1,41 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create an in-memory object for CspmMonitorGitLabOffering. +.Description +Create an in-memory object for CspmMonitorGitLabOffering. + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CspmMonitorGitLabOffering +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritycspmmonitorgitlabofferingobject +#> +function New-AzSecurityCspmMonitorGitLabOfferingObject { + [OutputType('Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CspmMonitorGitLabOffering')] + [CmdletBinding(PositionalBinding=$false)] + Param( + + ) + + process { + $Object = [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CspmMonitorGitLabOffering]::New() + + return $Object + } +} + diff --git a/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityCspmMonitorGithubOfferingObject.ps1 b/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityCspmMonitorGithubOfferingObject.ps1 new file mode 100644 index 000000000000..1044430598ff --- /dev/null +++ b/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityCspmMonitorGithubOfferingObject.ps1 @@ -0,0 +1,41 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create an in-memory object for CspmMonitorGithubOffering. +.Description +Create an in-memory object for CspmMonitorGithubOffering. + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CspmMonitorGithubOffering +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritycspmmonitorgithubofferingobject +#> +function New-AzSecurityCspmMonitorGithubOfferingObject { + [OutputType('Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CspmMonitorGithubOffering')] + [CmdletBinding(PositionalBinding=$false)] + Param( + + ) + + process { + $Object = [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CspmMonitorGithubOffering]::New() + + return $Object + } +} + diff --git a/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityDefenderCspmAwsOfferingObject.ps1 b/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityDefenderCspmAwsOfferingObject.ps1 new file mode 100644 index 000000000000..3210b252ea55 --- /dev/null +++ b/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityDefenderCspmAwsOfferingObject.ps1 @@ -0,0 +1,132 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create an in-memory object for DefenderCspmAwsOffering. +.Description +Create an in-memory object for DefenderCspmAwsOffering. + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOffering +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritydefendercspmawsofferingobject +#> +function New-AzSecurityDefenderCspmAwsOfferingObject { + [OutputType('Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOffering')] + [CmdletBinding(PositionalBinding=$false)] + Param( + + [Parameter(HelpMessage="The cloud role ARN in AWS for CIEM discovery.")] + [string] + $CiemDiscoveryCloudRoleArn, + [Parameter(HelpMessage="the azure active directory app name used of authenticating against AWS.")] + [string] + $CiemOidcAzureActiveDirectoryAppName, + [Parameter(HelpMessage="The cloud role ARN in AWS for CIEM oidc connection.")] + [string] + $CiemOidcCloudRoleArn, + [Parameter(HelpMessage="The cloud role ARN in AWS for this feature.")] + [string] + $ConfigurationCloudRoleArn, + [Parameter(HelpMessage="VM tags that indicates that VM should not be scanned.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfigurationExclusionTags] + $ConfigurationExclusionTag, + [Parameter(HelpMessage="The scanning mode for the VM scan.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Default")] + [string] + $ConfigurationScanningMode, + [Parameter(HelpMessage="The cloud role ARN in AWS for this feature.")] + [string] + $DataSensitivityDiscoveryCloudRoleArn, + [Parameter(HelpMessage="Is Microsoft Defender Data Sensitivity discovery enabled.")] + [bool] + $DataSensitivityDiscoveryEnabled, + [Parameter(HelpMessage="The cloud role ARN in AWS for this feature.")] + [string] + $DatabaseDspmCloudRoleArn, + [Parameter(HelpMessage="Is databases DSPM protection enabled.")] + [bool] + $DatabaseDspmEnabled, + [Parameter(HelpMessage="The cloud role ARN in AWS for this feature.")] + [string] + $MdcContainerAgentlessDiscoveryK8SCloudRoleArn, + [Parameter(HelpMessage="Is Microsoft Defender container agentless discovery K8s enabled.")] + [bool] + $MdcContainerAgentlessDiscoveryK8SEnabled, + [Parameter(HelpMessage="The cloud role ARN in AWS for this feature.")] + [string] + $MdcContainerImageAssessmentCloudRoleArn, + [Parameter(HelpMessage="Is Microsoft Defender container image assessment enabled.")] + [bool] + $MdcContainerImageAssessmentEnabled, + [Parameter(HelpMessage="Is Microsoft Defender for Server VM scanning enabled.")] + [bool] + $VMScannerEnabled + ) + + process { + $Object = [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOffering]::New() + + if ($PSBoundParameters.ContainsKey('CiemDiscoveryCloudRoleArn')) { + $Object.CiemDiscoveryCloudRoleArn = $CiemDiscoveryCloudRoleArn + } + if ($PSBoundParameters.ContainsKey('CiemOidcAzureActiveDirectoryAppName')) { + $Object.CiemOidcAzureActiveDirectoryAppName = $CiemOidcAzureActiveDirectoryAppName + } + if ($PSBoundParameters.ContainsKey('CiemOidcCloudRoleArn')) { + $Object.CiemOidcCloudRoleArn = $CiemOidcCloudRoleArn + } + if ($PSBoundParameters.ContainsKey('ConfigurationCloudRoleArn')) { + $Object.ConfigurationCloudRoleArn = $ConfigurationCloudRoleArn + } + if ($PSBoundParameters.ContainsKey('ConfigurationExclusionTag')) { + $Object.ConfigurationExclusionTag = $ConfigurationExclusionTag + } + if ($PSBoundParameters.ContainsKey('ConfigurationScanningMode')) { + $Object.ConfigurationScanningMode = $ConfigurationScanningMode + } + if ($PSBoundParameters.ContainsKey('DataSensitivityDiscoveryCloudRoleArn')) { + $Object.DataSensitivityDiscoveryCloudRoleArn = $DataSensitivityDiscoveryCloudRoleArn + } + if ($PSBoundParameters.ContainsKey('DataSensitivityDiscoveryEnabled')) { + $Object.DataSensitivityDiscoveryEnabled = $DataSensitivityDiscoveryEnabled + } + if ($PSBoundParameters.ContainsKey('DatabaseDspmCloudRoleArn')) { + $Object.DatabaseDspmCloudRoleArn = $DatabaseDspmCloudRoleArn + } + if ($PSBoundParameters.ContainsKey('DatabaseDspmEnabled')) { + $Object.DatabaseDspmEnabled = $DatabaseDspmEnabled + } + if ($PSBoundParameters.ContainsKey('MdcContainerAgentlessDiscoveryK8SCloudRoleArn')) { + $Object.MdcContainerAgentlessDiscoveryK8SCloudRoleArn = $MdcContainerAgentlessDiscoveryK8SCloudRoleArn + } + if ($PSBoundParameters.ContainsKey('MdcContainerAgentlessDiscoveryK8SEnabled')) { + $Object.MdcContainerAgentlessDiscoveryK8SEnabled = $MdcContainerAgentlessDiscoveryK8SEnabled + } + if ($PSBoundParameters.ContainsKey('MdcContainerImageAssessmentCloudRoleArn')) { + $Object.MdcContainerImageAssessmentCloudRoleArn = $MdcContainerImageAssessmentCloudRoleArn + } + if ($PSBoundParameters.ContainsKey('MdcContainerImageAssessmentEnabled')) { + $Object.MdcContainerImageAssessmentEnabled = $MdcContainerImageAssessmentEnabled + } + if ($PSBoundParameters.ContainsKey('VMScannerEnabled')) { + $Object.VMScannerEnabled = $VMScannerEnabled + } + return $Object + } +} + diff --git a/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityDefenderCspmGcpOfferingObject.ps1 b/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityDefenderCspmGcpOfferingObject.ps1 new file mode 100644 index 000000000000..61a0b4d8d6d2 --- /dev/null +++ b/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityDefenderCspmGcpOfferingObject.ps1 @@ -0,0 +1,132 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create an in-memory object for DefenderCspmGcpOffering. +.Description +Create an in-memory object for DefenderCspmGcpOffering. + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmGcpOffering +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritydefendercspmgcpofferingobject +#> +function New-AzSecurityDefenderCspmGcpOfferingObject { + [OutputType('Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmGcpOffering')] + [CmdletBinding(PositionalBinding=$false)] + Param( + + [Parameter(HelpMessage="the azure active directory app name used of authenticating against GCP workload identity federation.")] + [string] + $CiemDiscoveryAzureActiveDirectoryAppName, + [Parameter(HelpMessage="The service account email address in GCP for CIEM discovery offering.")] + [string] + $CiemDiscoveryServiceAccountEmailAddress, + [Parameter(HelpMessage="The GCP workload identity provider id for CIEM discovery offering.")] + [string] + $CiemDiscoveryWorkloadIdentityProviderId, + [Parameter(HelpMessage="VM tags that indicates that VM should not be scanned.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersConfigurationExclusionTags] + $ConfigurationExclusionTag, + [Parameter(HelpMessage="The scanning mode for the VM scan.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Default")] + [string] + $ConfigurationScanningMode, + [Parameter(HelpMessage="Is Microsoft Defender Data Sensitivity discovery enabled.")] + [bool] + $DataSensitivityDiscoveryEnabled, + [Parameter(HelpMessage="The service account email address in GCP for this feature.")] + [string] + $DataSensitivityDiscoveryServiceAccountEmailAddress, + [Parameter(HelpMessage="The workload identity provider id in GCP for this feature.")] + [string] + $DataSensitivityDiscoveryWorkloadIdentityProviderId, + [Parameter(HelpMessage="Is Microsoft Defender container agentless discovery enabled.")] + [bool] + $MdcContainerAgentlessDiscoveryK8SEnabled, + [Parameter(HelpMessage="The service account email address in GCP for this feature.")] + [string] + $MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress, + [Parameter(HelpMessage="The workload identity provider id in GCP for this feature.")] + [string] + $MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId, + [Parameter(HelpMessage="Is Microsoft Defender container image assessment enabled.")] + [bool] + $MdcContainerImageAssessmentEnabled, + [Parameter(HelpMessage="The service account email address in GCP for this feature.")] + [string] + $MdcContainerImageAssessmentServiceAccountEmailAddress, + [Parameter(HelpMessage="The workload identity provider id in GCP for this feature.")] + [string] + $MdcContainerImageAssessmentWorkloadIdentityProviderId, + [Parameter(HelpMessage="Is Microsoft Defender for Server VM scanning enabled.")] + [bool] + $VMScannerEnabled + ) + + process { + $Object = [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmGcpOffering]::New() + + if ($PSBoundParameters.ContainsKey('CiemDiscoveryAzureActiveDirectoryAppName')) { + $Object.CiemDiscoveryAzureActiveDirectoryAppName = $CiemDiscoveryAzureActiveDirectoryAppName + } + if ($PSBoundParameters.ContainsKey('CiemDiscoveryServiceAccountEmailAddress')) { + $Object.CiemDiscoveryServiceAccountEmailAddress = $CiemDiscoveryServiceAccountEmailAddress + } + if ($PSBoundParameters.ContainsKey('CiemDiscoveryWorkloadIdentityProviderId')) { + $Object.CiemDiscoveryWorkloadIdentityProviderId = $CiemDiscoveryWorkloadIdentityProviderId + } + if ($PSBoundParameters.ContainsKey('ConfigurationExclusionTag')) { + $Object.ConfigurationExclusionTag = $ConfigurationExclusionTag + } + if ($PSBoundParameters.ContainsKey('ConfigurationScanningMode')) { + $Object.ConfigurationScanningMode = $ConfigurationScanningMode + } + if ($PSBoundParameters.ContainsKey('DataSensitivityDiscoveryEnabled')) { + $Object.DataSensitivityDiscoveryEnabled = $DataSensitivityDiscoveryEnabled + } + if ($PSBoundParameters.ContainsKey('DataSensitivityDiscoveryServiceAccountEmailAddress')) { + $Object.DataSensitivityDiscoveryServiceAccountEmailAddress = $DataSensitivityDiscoveryServiceAccountEmailAddress + } + if ($PSBoundParameters.ContainsKey('DataSensitivityDiscoveryWorkloadIdentityProviderId')) { + $Object.DataSensitivityDiscoveryWorkloadIdentityProviderId = $DataSensitivityDiscoveryWorkloadIdentityProviderId + } + if ($PSBoundParameters.ContainsKey('MdcContainerAgentlessDiscoveryK8SEnabled')) { + $Object.MdcContainerAgentlessDiscoveryK8SEnabled = $MdcContainerAgentlessDiscoveryK8SEnabled + } + if ($PSBoundParameters.ContainsKey('MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress')) { + $Object.MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress = $MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress + } + if ($PSBoundParameters.ContainsKey('MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId')) { + $Object.MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId = $MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId + } + if ($PSBoundParameters.ContainsKey('MdcContainerImageAssessmentEnabled')) { + $Object.MdcContainerImageAssessmentEnabled = $MdcContainerImageAssessmentEnabled + } + if ($PSBoundParameters.ContainsKey('MdcContainerImageAssessmentServiceAccountEmailAddress')) { + $Object.MdcContainerImageAssessmentServiceAccountEmailAddress = $MdcContainerImageAssessmentServiceAccountEmailAddress + } + if ($PSBoundParameters.ContainsKey('MdcContainerImageAssessmentWorkloadIdentityProviderId')) { + $Object.MdcContainerImageAssessmentWorkloadIdentityProviderId = $MdcContainerImageAssessmentWorkloadIdentityProviderId + } + if ($PSBoundParameters.ContainsKey('VMScannerEnabled')) { + $Object.VMScannerEnabled = $VMScannerEnabled + } + return $Object + } +} + diff --git a/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityDefenderForContainersAwsOfferingObject.ps1 b/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityDefenderForContainersAwsOfferingObject.ps1 new file mode 100644 index 000000000000..0fc814a3119e --- /dev/null +++ b/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityDefenderForContainersAwsOfferingObject.ps1 @@ -0,0 +1,125 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create an in-memory object for DefenderForContainersAwsOffering. +.Description +Create an in-memory object for DefenderForContainersAwsOffering. + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersAwsOffering +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritydefenderforcontainersawsofferingobject +#> +function New-AzSecurityDefenderForContainersAwsOfferingObject { + [OutputType('Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersAwsOffering')] + [CmdletBinding(PositionalBinding=$false)] + Param( + + [Parameter(HelpMessage="Is audit logs pipeline auto provisioning enabled.")] + [bool] + $AutoProvisioning, + [Parameter(HelpMessage="The cloud role ARN in AWS used by CloudWatch to transfer data into Kinesis.")] + [string] + $CloudWatchToKinesiCloudRoleArn, + [Parameter(HelpMessage="The cloud role ARN in AWS for this feature.")] + [string] + $ContainerVulnerabilityAssessmentCloudRoleArn, + [Parameter(HelpMessage="The cloud role ARN in AWS for this feature.")] + [string] + $ContainerVulnerabilityAssessmentTaskCloudRoleArn, + [Parameter(HelpMessage="Enable container vulnerability assessment feature.")] + [bool] + $EnableContainerVulnerabilityAssessment, + [Parameter(HelpMessage="The cloud role ARN in AWS used by Kinesis to transfer data into S3.")] + [string] + $KinesiToS3CloudRoleArn, + [Parameter(HelpMessage="The retention time in days of kube audit logs set on the CloudWatch log group.")] + [long] + $KubeAuditRetentionTime, + [Parameter(HelpMessage="The cloud role ARN in AWS for this feature used for reading data.")] + [string] + $KuberneteScubaReaderCloudRoleArn, + [Parameter(HelpMessage="The cloud role ARN in AWS for this feature used for provisioning resources.")] + [string] + $KuberneteServiceCloudRoleArn, + [Parameter(HelpMessage="The cloud role ARN in AWS for this feature.")] + [string] + $MdcContainerAgentlessDiscoveryK8SCloudRoleArn, + [Parameter(HelpMessage="Is Microsoft Defender container agentless discovery K8s enabled.")] + [bool] + $MdcContainerAgentlessDiscoveryK8SEnabled, + [Parameter(HelpMessage="The cloud role ARN in AWS for this feature.")] + [string] + $MdcContainerImageAssessmentCloudRoleArn, + [Parameter(HelpMessage="Is Microsoft Defender container image assessment enabled.")] + [bool] + $MdcContainerImageAssessmentEnabled, + [Parameter(HelpMessage="The externalId used by the data reader to prevent the confused deputy attack.")] + [string] + $ScubaExternalId + ) + + process { + $Object = [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersAwsOffering]::New() + + if ($PSBoundParameters.ContainsKey('AutoProvisioning')) { + $Object.AutoProvisioning = $AutoProvisioning + } + if ($PSBoundParameters.ContainsKey('CloudWatchToKinesiCloudRoleArn')) { + $Object.CloudWatchToKinesiCloudRoleArn = $CloudWatchToKinesiCloudRoleArn + } + if ($PSBoundParameters.ContainsKey('ContainerVulnerabilityAssessmentCloudRoleArn')) { + $Object.ContainerVulnerabilityAssessmentCloudRoleArn = $ContainerVulnerabilityAssessmentCloudRoleArn + } + if ($PSBoundParameters.ContainsKey('ContainerVulnerabilityAssessmentTaskCloudRoleArn')) { + $Object.ContainerVulnerabilityAssessmentTaskCloudRoleArn = $ContainerVulnerabilityAssessmentTaskCloudRoleArn + } + if ($PSBoundParameters.ContainsKey('EnableContainerVulnerabilityAssessment')) { + $Object.EnableContainerVulnerabilityAssessment = $EnableContainerVulnerabilityAssessment + } + if ($PSBoundParameters.ContainsKey('KinesiToS3CloudRoleArn')) { + $Object.KinesiToS3CloudRoleArn = $KinesiToS3CloudRoleArn + } + if ($PSBoundParameters.ContainsKey('KubeAuditRetentionTime')) { + $Object.KubeAuditRetentionTime = $KubeAuditRetentionTime + } + if ($PSBoundParameters.ContainsKey('KuberneteScubaReaderCloudRoleArn')) { + $Object.KuberneteScubaReaderCloudRoleArn = $KuberneteScubaReaderCloudRoleArn + } + if ($PSBoundParameters.ContainsKey('KuberneteServiceCloudRoleArn')) { + $Object.KuberneteServiceCloudRoleArn = $KuberneteServiceCloudRoleArn + } + if ($PSBoundParameters.ContainsKey('MdcContainerAgentlessDiscoveryK8SCloudRoleArn')) { + $Object.MdcContainerAgentlessDiscoveryK8SCloudRoleArn = $MdcContainerAgentlessDiscoveryK8SCloudRoleArn + } + if ($PSBoundParameters.ContainsKey('MdcContainerAgentlessDiscoveryK8SEnabled')) { + $Object.MdcContainerAgentlessDiscoveryK8SEnabled = $MdcContainerAgentlessDiscoveryK8SEnabled + } + if ($PSBoundParameters.ContainsKey('MdcContainerImageAssessmentCloudRoleArn')) { + $Object.MdcContainerImageAssessmentCloudRoleArn = $MdcContainerImageAssessmentCloudRoleArn + } + if ($PSBoundParameters.ContainsKey('MdcContainerImageAssessmentEnabled')) { + $Object.MdcContainerImageAssessmentEnabled = $MdcContainerImageAssessmentEnabled + } + if ($PSBoundParameters.ContainsKey('ScubaExternalId')) { + $Object.ScubaExternalId = $ScubaExternalId + } + return $Object + } +} + diff --git a/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityDefenderForContainersGcpOfferingObject.ps1 b/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityDefenderForContainersGcpOfferingObject.ps1 new file mode 100644 index 000000000000..a4494e05fa16 --- /dev/null +++ b/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityDefenderForContainersGcpOfferingObject.ps1 @@ -0,0 +1,119 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create an in-memory object for DefenderForContainersGcpOffering. +.Description +Create an in-memory object for DefenderForContainersGcpOffering. + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersGcpOffering +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritydefenderforcontainersgcpofferingobject +#> +function New-AzSecurityDefenderForContainersGcpOfferingObject { + [OutputType('Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersGcpOffering')] + [CmdletBinding(PositionalBinding=$false)] + Param( + + [Parameter(HelpMessage="Is audit logs data collection enabled.")] + [bool] + $AuditLogsAutoProvisioningFlag, + [Parameter(HelpMessage="The data collection service account email address in GCP for this offering.")] + [string] + $DataPipelineNativeCloudConnectionServiceAccountEmailAddress, + [Parameter(HelpMessage="The data collection GCP workload identity provider id for this offering.")] + [string] + $DataPipelineNativeCloudConnectionWorkloadIdentityProviderId, + [Parameter(HelpMessage="Is Microsoft Defender for Cloud Kubernetes agent auto provisioning enabled.")] + [bool] + $DefenderAgentAutoProvisioningFlag, + [Parameter(HelpMessage="Is Microsoft Defender container agentless discovery enabled.")] + [bool] + $MdcContainerAgentlessDiscoveryK8SEnabled, + [Parameter(HelpMessage="The service account email address in GCP for this feature.")] + [string] + $MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress, + [Parameter(HelpMessage="The workload identity provider id in GCP for this feature.")] + [string] + $MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId, + [Parameter(HelpMessage="Is Microsoft Defender container image assessment enabled.")] + [bool] + $MdcContainerImageAssessmentEnabled, + [Parameter(HelpMessage="The service account email address in GCP for this feature.")] + [string] + $MdcContainerImageAssessmentServiceAccountEmailAddress, + [Parameter(HelpMessage="The workload identity provider id in GCP for this feature.")] + [string] + $MdcContainerImageAssessmentWorkloadIdentityProviderId, + [Parameter(HelpMessage="The service account email address in GCP for this offering.")] + [string] + $NativeCloudConnectionServiceAccountEmailAddress, + [Parameter(HelpMessage="The GCP workload identity provider id for this offering.")] + [string] + $NativeCloudConnectionWorkloadIdentityProviderId, + [Parameter(HelpMessage="Is Policy Kubernetes agent auto provisioning enabled.")] + [bool] + $PolicyAgentAutoProvisioningFlag + ) + + process { + $Object = [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersGcpOffering]::New() + + if ($PSBoundParameters.ContainsKey('AuditLogsAutoProvisioningFlag')) { + $Object.AuditLogsAutoProvisioningFlag = $AuditLogsAutoProvisioningFlag + } + if ($PSBoundParameters.ContainsKey('DataPipelineNativeCloudConnectionServiceAccountEmailAddress')) { + $Object.DataPipelineNativeCloudConnectionServiceAccountEmailAddress = $DataPipelineNativeCloudConnectionServiceAccountEmailAddress + } + if ($PSBoundParameters.ContainsKey('DataPipelineNativeCloudConnectionWorkloadIdentityProviderId')) { + $Object.DataPipelineNativeCloudConnectionWorkloadIdentityProviderId = $DataPipelineNativeCloudConnectionWorkloadIdentityProviderId + } + if ($PSBoundParameters.ContainsKey('DefenderAgentAutoProvisioningFlag')) { + $Object.DefenderAgentAutoProvisioningFlag = $DefenderAgentAutoProvisioningFlag + } + if ($PSBoundParameters.ContainsKey('MdcContainerAgentlessDiscoveryK8SEnabled')) { + $Object.MdcContainerAgentlessDiscoveryK8SEnabled = $MdcContainerAgentlessDiscoveryK8SEnabled + } + if ($PSBoundParameters.ContainsKey('MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress')) { + $Object.MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress = $MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress + } + if ($PSBoundParameters.ContainsKey('MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId')) { + $Object.MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId = $MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId + } + if ($PSBoundParameters.ContainsKey('MdcContainerImageAssessmentEnabled')) { + $Object.MdcContainerImageAssessmentEnabled = $MdcContainerImageAssessmentEnabled + } + if ($PSBoundParameters.ContainsKey('MdcContainerImageAssessmentServiceAccountEmailAddress')) { + $Object.MdcContainerImageAssessmentServiceAccountEmailAddress = $MdcContainerImageAssessmentServiceAccountEmailAddress + } + if ($PSBoundParameters.ContainsKey('MdcContainerImageAssessmentWorkloadIdentityProviderId')) { + $Object.MdcContainerImageAssessmentWorkloadIdentityProviderId = $MdcContainerImageAssessmentWorkloadIdentityProviderId + } + if ($PSBoundParameters.ContainsKey('NativeCloudConnectionServiceAccountEmailAddress')) { + $Object.NativeCloudConnectionServiceAccountEmailAddress = $NativeCloudConnectionServiceAccountEmailAddress + } + if ($PSBoundParameters.ContainsKey('NativeCloudConnectionWorkloadIdentityProviderId')) { + $Object.NativeCloudConnectionWorkloadIdentityProviderId = $NativeCloudConnectionWorkloadIdentityProviderId + } + if ($PSBoundParameters.ContainsKey('PolicyAgentAutoProvisioningFlag')) { + $Object.PolicyAgentAutoProvisioningFlag = $PolicyAgentAutoProvisioningFlag + } + return $Object + } +} + diff --git a/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityDefenderForDatabasesAwsOfferingObject.ps1 b/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityDefenderForDatabasesAwsOfferingObject.ps1 new file mode 100644 index 000000000000..da51ecbb6ea9 --- /dev/null +++ b/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityDefenderForDatabasesAwsOfferingObject.ps1 @@ -0,0 +1,89 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create an in-memory object for DefenderForDatabasesAwsOffering. +.Description +Create an in-memory object for DefenderForDatabasesAwsOffering. + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForDatabasesAwsOffering +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritydefenderfordatabasesawsofferingobject +#> +function New-AzSecurityDefenderForDatabasesAwsOfferingObject { + [OutputType('Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForDatabasesAwsOffering')] + [CmdletBinding(PositionalBinding=$false)] + Param( + + [Parameter(HelpMessage="The cloud role ARN in AWS for this feature.")] + [string] + $ArcAutoProvisioningCloudRoleArn, + [Parameter(HelpMessage="Is arc auto provisioning enabled.")] + [bool] + $ArcAutoProvisioningEnabled, + [Parameter(HelpMessage="Optional Arc private link scope resource id to link the Arc agent.")] + [string] + $ConfigurationPrivateLinkScope, + [Parameter(HelpMessage="Optional http proxy endpoint to use for the Arc agent.")] + [string] + $ConfigurationProxy, + [Parameter(HelpMessage="The cloud role ARN in AWS for this feature.")] + [string] + $DatabaseDspmCloudRoleArn, + [Parameter(HelpMessage="Is databases data security posture management (DSPM) protection enabled.")] + [bool] + $DatabaseDspmEnabled, + [Parameter(HelpMessage="The cloud role ARN in AWS for this feature.")] + [string] + $RdCloudRoleArn, + [Parameter(HelpMessage="Is RDS protection enabled.")] + [bool] + $RdEnabled + ) + + process { + $Object = [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForDatabasesAwsOffering]::New() + + if ($PSBoundParameters.ContainsKey('ArcAutoProvisioningCloudRoleArn')) { + $Object.ArcAutoProvisioningCloudRoleArn = $ArcAutoProvisioningCloudRoleArn + } + if ($PSBoundParameters.ContainsKey('ArcAutoProvisioningEnabled')) { + $Object.ArcAutoProvisioningEnabled = $ArcAutoProvisioningEnabled + } + if ($PSBoundParameters.ContainsKey('ConfigurationPrivateLinkScope')) { + $Object.ConfigurationPrivateLinkScope = $ConfigurationPrivateLinkScope + } + if ($PSBoundParameters.ContainsKey('ConfigurationProxy')) { + $Object.ConfigurationProxy = $ConfigurationProxy + } + if ($PSBoundParameters.ContainsKey('DatabaseDspmCloudRoleArn')) { + $Object.DatabaseDspmCloudRoleArn = $DatabaseDspmCloudRoleArn + } + if ($PSBoundParameters.ContainsKey('DatabaseDspmEnabled')) { + $Object.DatabaseDspmEnabled = $DatabaseDspmEnabled + } + if ($PSBoundParameters.ContainsKey('RdCloudRoleArn')) { + $Object.RdCloudRoleArn = $RdCloudRoleArn + } + if ($PSBoundParameters.ContainsKey('RdEnabled')) { + $Object.RdEnabled = $RdEnabled + } + return $Object + } +} + diff --git a/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityDefenderForDatabasesGcpOfferingObject.ps1 b/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityDefenderForDatabasesGcpOfferingObject.ps1 new file mode 100644 index 000000000000..d61678f3208c --- /dev/null +++ b/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityDefenderForDatabasesGcpOfferingObject.ps1 @@ -0,0 +1,71 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create an in-memory object for DefenderForDatabasesGcpOffering. +.Description +Create an in-memory object for DefenderForDatabasesGcpOffering. + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForDatabasesGcpOffering +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritydefenderfordatabasesgcpofferingobject +#> +function New-AzSecurityDefenderForDatabasesGcpOfferingObject { + [OutputType('Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForDatabasesGcpOffering')] + [CmdletBinding(PositionalBinding=$false)] + Param( + + [Parameter(HelpMessage="Is arc auto provisioning enabled.")] + [bool] + $ArcAutoProvisioningEnabled, + [Parameter(HelpMessage="Optional Arc private link scope resource id to link the Arc agent.")] + [string] + $ConfigurationPrivateLinkScope, + [Parameter(HelpMessage="Optional http proxy endpoint to use for the Arc agent.")] + [string] + $ConfigurationProxy, + [Parameter(HelpMessage="The service account email address in GCP for this offering.")] + [string] + $DefenderForDatabaseArcAutoProvisioningServiceAccountEmailAddress, + [Parameter(HelpMessage="The GCP workload identity provider id for this offering.")] + [string] + $DefenderForDatabaseArcAutoProvisioningWorkloadIdentityProviderId + ) + + process { + $Object = [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForDatabasesGcpOffering]::New() + + if ($PSBoundParameters.ContainsKey('ArcAutoProvisioningEnabled')) { + $Object.ArcAutoProvisioningEnabled = $ArcAutoProvisioningEnabled + } + if ($PSBoundParameters.ContainsKey('ConfigurationPrivateLinkScope')) { + $Object.ConfigurationPrivateLinkScope = $ConfigurationPrivateLinkScope + } + if ($PSBoundParameters.ContainsKey('ConfigurationProxy')) { + $Object.ConfigurationProxy = $ConfigurationProxy + } + if ($PSBoundParameters.ContainsKey('DefenderForDatabaseArcAutoProvisioningServiceAccountEmailAddress')) { + $Object.DefenderForDatabaseArcAutoProvisioningServiceAccountEmailAddress = $DefenderForDatabaseArcAutoProvisioningServiceAccountEmailAddress + } + if ($PSBoundParameters.ContainsKey('DefenderForDatabaseArcAutoProvisioningWorkloadIdentityProviderId')) { + $Object.DefenderForDatabaseArcAutoProvisioningWorkloadIdentityProviderId = $DefenderForDatabaseArcAutoProvisioningWorkloadIdentityProviderId + } + return $Object + } +} + diff --git a/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityDefenderForServersAwsOfferingObject.ps1 b/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityDefenderForServersAwsOfferingObject.ps1 new file mode 100644 index 000000000000..c7cdfe606db9 --- /dev/null +++ b/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityDefenderForServersAwsOfferingObject.ps1 @@ -0,0 +1,128 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create an in-memory object for DefenderForServersAwsOffering. +.Description +Create an in-memory object for DefenderForServersAwsOffering. + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOffering +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritydefenderforserversawsofferingobject +#> +function New-AzSecurityDefenderForServersAwsOfferingObject { + [OutputType('Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOffering')] + [CmdletBinding(PositionalBinding=$false)] + Param( + + [Parameter(HelpMessage="The cloud role ARN in AWS for this feature.")] + [string] + $ArcAutoProvisioningCloudRoleArn, + [Parameter(HelpMessage="Is arc auto provisioning enabled.")] + [bool] + $ArcAutoProvisioningEnabled, + [Parameter(HelpMessage="The cloud role ARN in AWS for this feature.")] + [string] + $ConfigurationCloudRoleArn, + [Parameter(HelpMessage="VM tags that indicates that VM should not be scanned.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfigurationExclusionTags] + $ConfigurationExclusionTag, + [Parameter(HelpMessage="Optional Arc private link scope resource id to link the Arc agent.")] + [string] + $ConfigurationPrivateLinkScope, + [Parameter(HelpMessage="Optional HTTP proxy endpoint to use for the Arc agent.")] + [string] + $ConfigurationProxy, + [Parameter(HelpMessage="The scanning mode for the VM scan.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Default")] + [string] + $ConfigurationScanningMode, + [Parameter(HelpMessage="The Vulnerability Assessment solution to be provisioned. Can be either 'TVM' or 'Qualys'.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Qualys", "TVM")] + [string] + $ConfigurationType, + [Parameter(HelpMessage="The cloud role ARN in AWS for this feature.")] + [string] + $DefenderForServerCloudRoleArn, + [Parameter(HelpMessage="configuration for Microsoft Defender for Endpoint autoprovisioning.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAny] + $MdeAutoProvisioningConfiguration, + [Parameter(HelpMessage="Is Microsoft Defender for Endpoint auto provisioning enabled.")] + [bool] + $MdeAutoProvisioningEnabled, + [Parameter(HelpMessage="The available sub plans.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("P1", "P2")] + [string] + $SubPlanType, + [Parameter(HelpMessage="Is Microsoft Defender for Server VM scanning enabled.")] + [bool] + $VMScannerEnabled, + [Parameter(HelpMessage="Is Vulnerability Assessment auto provisioning enabled.")] + [bool] + $VaAutoProvisioningEnabled + ) + + process { + $Object = [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOffering]::New() + + if ($PSBoundParameters.ContainsKey('ArcAutoProvisioningCloudRoleArn')) { + $Object.ArcAutoProvisioningCloudRoleArn = $ArcAutoProvisioningCloudRoleArn + } + if ($PSBoundParameters.ContainsKey('ArcAutoProvisioningEnabled')) { + $Object.ArcAutoProvisioningEnabled = $ArcAutoProvisioningEnabled + } + if ($PSBoundParameters.ContainsKey('ConfigurationCloudRoleArn')) { + $Object.ConfigurationCloudRoleArn = $ConfigurationCloudRoleArn + } + if ($PSBoundParameters.ContainsKey('ConfigurationExclusionTag')) { + $Object.ConfigurationExclusionTag = $ConfigurationExclusionTag + } + if ($PSBoundParameters.ContainsKey('ConfigurationPrivateLinkScope')) { + $Object.ConfigurationPrivateLinkScope = $ConfigurationPrivateLinkScope + } + if ($PSBoundParameters.ContainsKey('ConfigurationProxy')) { + $Object.ConfigurationProxy = $ConfigurationProxy + } + if ($PSBoundParameters.ContainsKey('ConfigurationScanningMode')) { + $Object.ConfigurationScanningMode = $ConfigurationScanningMode + } + if ($PSBoundParameters.ContainsKey('ConfigurationType')) { + $Object.ConfigurationType = $ConfigurationType + } + if ($PSBoundParameters.ContainsKey('DefenderForServerCloudRoleArn')) { + $Object.DefenderForServerCloudRoleArn = $DefenderForServerCloudRoleArn + } + if ($PSBoundParameters.ContainsKey('MdeAutoProvisioningConfiguration')) { + $Object.MdeAutoProvisioningConfiguration = $MdeAutoProvisioningConfiguration + } + if ($PSBoundParameters.ContainsKey('MdeAutoProvisioningEnabled')) { + $Object.MdeAutoProvisioningEnabled = $MdeAutoProvisioningEnabled + } + if ($PSBoundParameters.ContainsKey('SubPlanType')) { + $Object.SubPlanType = $SubPlanType + } + if ($PSBoundParameters.ContainsKey('VMScannerEnabled')) { + $Object.VMScannerEnabled = $VMScannerEnabled + } + if ($PSBoundParameters.ContainsKey('VaAutoProvisioningEnabled')) { + $Object.VaAutoProvisioningEnabled = $VaAutoProvisioningEnabled + } + return $Object + } +} + diff --git a/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityDefenderForServersGcpOfferingObject.ps1 b/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityDefenderForServersGcpOfferingObject.ps1 new file mode 100644 index 000000000000..aeea241d47bd --- /dev/null +++ b/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityDefenderForServersGcpOfferingObject.ps1 @@ -0,0 +1,122 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create an in-memory object for DefenderForServersGcpOffering. +.Description +Create an in-memory object for DefenderForServersGcpOffering. + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOffering +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritydefenderforserversgcpofferingobject +#> +function New-AzSecurityDefenderForServersGcpOfferingObject { + [OutputType('Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOffering')] + [CmdletBinding(PositionalBinding=$false)] + Param( + + [Parameter(HelpMessage="Is arc auto provisioning enabled.")] + [bool] + $ArcAutoProvisioningEnabled, + [Parameter(HelpMessage="VM tags that indicate that VM should not be scanned.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersConfigurationExclusionTags] + $ConfigurationExclusionTag, + [Parameter(HelpMessage="Optional Arc private link scope resource id to link the Arc agent.")] + [string] + $ConfigurationPrivateLinkScope, + [Parameter(HelpMessage="Optional HTTP proxy endpoint to use for the Arc agent.")] + [string] + $ConfigurationProxy, + [Parameter(HelpMessage="The scanning mode for the VM scan.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Default")] + [string] + $ConfigurationScanningMode, + [Parameter(HelpMessage="The Vulnerability Assessment solution to be provisioned. Can be either 'TVM' or 'Qualys'.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Qualys", "TVM")] + [string] + $ConfigurationType, + [Parameter(HelpMessage="The service account email address in GCP for this feature.")] + [string] + $DefenderForServerServiceAccountEmailAddress, + [Parameter(HelpMessage="The workload identity provider id in GCP for this feature.")] + [string] + $DefenderForServerWorkloadIdentityProviderId, + [Parameter(HelpMessage="configuration for Microsoft Defender for Endpoint autoprovisioning.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAny] + $MdeAutoProvisioningConfiguration, + [Parameter(HelpMessage="Is Microsoft Defender for Endpoint auto provisioning enabled.")] + [bool] + $MdeAutoProvisioningEnabled, + [Parameter(HelpMessage="The available sub plans.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("P1", "P2")] + [string] + $SubPlanType, + [Parameter(HelpMessage="Is Microsoft Defender for Server VM scanning enabled.")] + [bool] + $VMScannerEnabled, + [Parameter(HelpMessage="Is Vulnerability Assessment auto provisioning enabled.")] + [bool] + $VaAutoProvisioningEnabled + ) + + process { + $Object = [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOffering]::New() + + if ($PSBoundParameters.ContainsKey('ArcAutoProvisioningEnabled')) { + $Object.ArcAutoProvisioningEnabled = $ArcAutoProvisioningEnabled + } + if ($PSBoundParameters.ContainsKey('ConfigurationExclusionTag')) { + $Object.ConfigurationExclusionTag = $ConfigurationExclusionTag + } + if ($PSBoundParameters.ContainsKey('ConfigurationPrivateLinkScope')) { + $Object.ConfigurationPrivateLinkScope = $ConfigurationPrivateLinkScope + } + if ($PSBoundParameters.ContainsKey('ConfigurationProxy')) { + $Object.ConfigurationProxy = $ConfigurationProxy + } + if ($PSBoundParameters.ContainsKey('ConfigurationScanningMode')) { + $Object.ConfigurationScanningMode = $ConfigurationScanningMode + } + if ($PSBoundParameters.ContainsKey('ConfigurationType')) { + $Object.ConfigurationType = $ConfigurationType + } + if ($PSBoundParameters.ContainsKey('DefenderForServerServiceAccountEmailAddress')) { + $Object.DefenderForServerServiceAccountEmailAddress = $DefenderForServerServiceAccountEmailAddress + } + if ($PSBoundParameters.ContainsKey('DefenderForServerWorkloadIdentityProviderId')) { + $Object.DefenderForServerWorkloadIdentityProviderId = $DefenderForServerWorkloadIdentityProviderId + } + if ($PSBoundParameters.ContainsKey('MdeAutoProvisioningConfiguration')) { + $Object.MdeAutoProvisioningConfiguration = $MdeAutoProvisioningConfiguration + } + if ($PSBoundParameters.ContainsKey('MdeAutoProvisioningEnabled')) { + $Object.MdeAutoProvisioningEnabled = $MdeAutoProvisioningEnabled + } + if ($PSBoundParameters.ContainsKey('SubPlanType')) { + $Object.SubPlanType = $SubPlanType + } + if ($PSBoundParameters.ContainsKey('VMScannerEnabled')) { + $Object.VMScannerEnabled = $VMScannerEnabled + } + if ($PSBoundParameters.ContainsKey('VaAutoProvisioningEnabled')) { + $Object.VaAutoProvisioningEnabled = $VaAutoProvisioningEnabled + } + return $Object + } +} + diff --git a/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityGcpOrganizationalDataMemberObject.ps1 b/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityGcpOrganizationalDataMemberObject.ps1 new file mode 100644 index 000000000000..acd2067cbf76 --- /dev/null +++ b/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityGcpOrganizationalDataMemberObject.ps1 @@ -0,0 +1,53 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create an in-memory object for GcpOrganizationalDataMember. +.Description +Create an in-memory object for GcpOrganizationalDataMember. + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GcpOrganizationalDataMember +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritygcporganizationaldatamemberobject +#> +function New-AzSecurityGcpOrganizationalDataMemberObject { + [OutputType('Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GcpOrganizationalDataMember')] + [CmdletBinding(PositionalBinding=$false)] + Param( + + [Parameter(HelpMessage="The GCP management project number from organizational onboarding.")] + [string] + $ManagementProjectNumber, + [Parameter(HelpMessage="If the multi cloud account is not of membership type organization, this will be the ID of the project's parent.")] + [string] + $ParentHierarchyId + ) + + process { + $Object = [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GcpOrganizationalDataMember]::New() + + if ($PSBoundParameters.ContainsKey('ManagementProjectNumber')) { + $Object.ManagementProjectNumber = $ManagementProjectNumber + } + if ($PSBoundParameters.ContainsKey('ParentHierarchyId')) { + $Object.ParentHierarchyId = $ParentHierarchyId + } + return $Object + } +} + diff --git a/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityGcpOrganizationalDataOrganizationObject.ps1 b/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityGcpOrganizationalDataOrganizationObject.ps1 new file mode 100644 index 000000000000..f5f781fbd3aa --- /dev/null +++ b/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityGcpOrganizationalDataOrganizationObject.ps1 @@ -0,0 +1,59 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create an in-memory object for GcpOrganizationalDataOrganization. +.Description +Create an in-memory object for GcpOrganizationalDataOrganization. + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GcpOrganizationalDataOrganization +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritygcporganizationaldataorganizationobject +#> +function New-AzSecurityGcpOrganizationalDataOrganizationObject { + [OutputType('Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GcpOrganizationalDataOrganization')] + [CmdletBinding(PositionalBinding=$false)] + Param( + + [Parameter(HelpMessage="If the multi cloud account is of membership type organization, list of accounts excluded from offering.")] + [string[]] + $ExcludedProjectNumber, + [Parameter(HelpMessage="The service account email address which represents the organization level permissions container.")] + [string] + $ServiceAccountEmailAddress, + [Parameter(HelpMessage="The GCP workload identity provider id which represents the permissions required to auto provision security connectors.")] + [string] + $WorkloadIdentityProviderId + ) + + process { + $Object = [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GcpOrganizationalDataOrganization]::New() + + if ($PSBoundParameters.ContainsKey('ExcludedProjectNumber')) { + $Object.ExcludedProjectNumber = $ExcludedProjectNumber + } + if ($PSBoundParameters.ContainsKey('ServiceAccountEmailAddress')) { + $Object.ServiceAccountEmailAddress = $ServiceAccountEmailAddress + } + if ($PSBoundParameters.ContainsKey('WorkloadIdentityProviderId')) { + $Object.WorkloadIdentityProviderId = $WorkloadIdentityProviderId + } + return $Object + } +} + diff --git a/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityGcpProjectEnvironmentObject.ps1 b/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityGcpProjectEnvironmentObject.ps1 new file mode 100644 index 000000000000..9aa4f206b9bc --- /dev/null +++ b/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityGcpProjectEnvironmentObject.ps1 @@ -0,0 +1,65 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create an in-memory object for GcpProjectEnvironment. +.Description +Create an in-memory object for GcpProjectEnvironment. + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GcpProjectEnvironment +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritygcpprojectenvironmentobject +#> +function New-AzSecurityGcpProjectEnvironmentObject { + [OutputType('Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GcpProjectEnvironment')] + [CmdletBinding(PositionalBinding=$false)] + Param( + + [Parameter(HelpMessage="The Gcp project's organizational data.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalData] + $OrganizationalData, + [Parameter(HelpMessage="The GCP Project id.")] + [string] + $ProjectDetailProjectId, + [Parameter(HelpMessage="The unique GCP Project number.")] + [string] + $ProjectDetailProjectNumber, + [Parameter(HelpMessage="Scan interval in hours (value should be between 1-hour to 24-hours).")] + [long] + $ScanInterval + ) + + process { + $Object = [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GcpProjectEnvironment]::New() + + if ($PSBoundParameters.ContainsKey('OrganizationalData')) { + $Object.OrganizationalData = $OrganizationalData + } + if ($PSBoundParameters.ContainsKey('ProjectDetailProjectId')) { + $Object.ProjectDetailProjectId = $ProjectDetailProjectId + } + if ($PSBoundParameters.ContainsKey('ProjectDetailProjectNumber')) { + $Object.ProjectDetailProjectNumber = $ProjectDetailProjectNumber + } + if ($PSBoundParameters.ContainsKey('ScanInterval')) { + $Object.ScanInterval = $ScanInterval + } + return $Object + } +} + diff --git a/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityGitHubScopeEnvironmentObject.ps1 b/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityGitHubScopeEnvironmentObject.ps1 new file mode 100644 index 000000000000..093dedd329ff --- /dev/null +++ b/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityGitHubScopeEnvironmentObject.ps1 @@ -0,0 +1,41 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create an in-memory object for GitHubScopeEnvironment. +.Description +Create an in-memory object for GitHubScopeEnvironment. + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitHubScopeEnvironment +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritygithubscopeenvironmentobject +#> +function New-AzSecurityGitHubScopeEnvironmentObject { + [OutputType('Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitHubScopeEnvironment')] + [CmdletBinding(PositionalBinding=$false)] + Param( + + ) + + process { + $Object = [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitHubScopeEnvironment]::New() + + return $Object + } +} + diff --git a/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityGitLabScopeEnvironmentObject.ps1 b/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityGitLabScopeEnvironmentObject.ps1 new file mode 100644 index 000000000000..52c3ee8ad9e6 --- /dev/null +++ b/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityGitLabScopeEnvironmentObject.ps1 @@ -0,0 +1,41 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create an in-memory object for GitLabScopeEnvironment. +.Description +Create an in-memory object for GitLabScopeEnvironment. + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitLabScopeEnvironment +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritygitlabscopeenvironmentobject +#> +function New-AzSecurityGitLabScopeEnvironmentObject { + [OutputType('Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitLabScopeEnvironment')] + [CmdletBinding(PositionalBinding=$false)] + Param( + + ) + + process { + $Object = [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitLabScopeEnvironment]::New() + + return $Object + } +} + diff --git a/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityInformationProtectionAwsOfferingObject.ps1 b/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityInformationProtectionAwsOfferingObject.ps1 new file mode 100644 index 000000000000..66d698ab2101 --- /dev/null +++ b/src/Security/Security.Autorest/custom/autogen-model-cmdlets/New-AzSecurityInformationProtectionAwsOfferingObject.ps1 @@ -0,0 +1,47 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create an in-memory object for InformationProtectionAwsOffering. +.Description +Create an in-memory object for InformationProtectionAwsOffering. + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.InformationProtectionAwsOffering +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecurityinformationprotectionawsofferingobject +#> +function New-AzSecurityInformationProtectionAwsOfferingObject { + [OutputType('Microsoft.Azure.PowerShell.Cmdlets.Security.Models.InformationProtectionAwsOffering')] + [CmdletBinding(PositionalBinding=$false)] + Param( + + [Parameter(HelpMessage="The cloud role ARN in AWS for this feature.")] + [string] + $InformationProtectionCloudRoleArn + ) + + process { + $Object = [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.InformationProtectionAwsOffering]::New() + + if ($PSBoundParameters.ContainsKey('InformationProtectionCloudRoleArn')) { + $Object.InformationProtectionCloudRoleArn = $InformationProtectionCloudRoleArn + } + return $Object + } +} + diff --git a/src/Security/Security.Autorest/examples/Get-AzSecurityApiCollection.md b/src/Security/Security.Autorest/examples/Get-AzSecurityApiCollection.md new file mode 100644 index 000000000000..c8a0a674ed87 --- /dev/null +++ b/src/Security/Security.Autorest/examples/Get-AzSecurityApiCollection.md @@ -0,0 +1,48 @@ +### Example 1: Get a specific onboarded api collection resource +```powershell +Get-AzSecurityApiCollection -ResourceGroupName apicollectionstests -ServiceName "demoapimservice2" -ApiId "echo-api" +``` + +```output +BaseUrl : https://demoapimservice2.azure-api.net/echo +DiscoveredVia : /subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/apicollectionstests/providers/Microsoft.ApiManagement/service/demoapim + service2 +DisplayName : Echo API +Id : /subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/apicollectionstests/providers/Microsoft.ApiManagement/service/demoapim + service2/providers/Microsoft.Security/apiCollections/echo-api +Name : echo-api +NumberOfApiEndpoint : 6 +NumberOfApiEndpointsWithSensitiveDataExposed : 0 +NumberOfExternalApiEndpoint : 0 +NumberOfInactiveApiEndpoint : 6 +NumberOfUnauthenticatedApiEndpoint : 0 +ProvisioningState : Succeeded +ResourceGroupName : apicollectionstests +SensitivityLabel : +Type : microsoft.security/apicollections +``` + +### Example 2: List onboarded api collections by service name +```powershell +Get-AzSecurityApiCollection -ResourceGroupName "apicollectionstests" -ServiceName "demoapimservice2" +``` + +```output +Name ResourceGroupName +---- ----------------- +echo-api apicollectionstests +echo-api-2 apicollectionstests +``` + +### Example 3: List onboarded api collections by subscription +```powershell +Get-AzSecurityApiCollection +``` + +```output +Name ResourceGroupName +---- ----------------- +echo-api apicollectionstests +echo-api-2 apicollectionstests +``` + diff --git a/src/Security/Security.Autorest/examples/Get-AzSecurityConnector.md b/src/Security/Security.Autorest/examples/Get-AzSecurityConnector.md new file mode 100644 index 000000000000..8cb81e982eb3 --- /dev/null +++ b/src/Security/Security.Autorest/examples/Get-AzSecurityConnector.md @@ -0,0 +1,47 @@ +### Example 1: Get Security Connector resource by name +```powershell +Get-AzSecurityConnector -ResourceGroupName "dfdtest-sdk" -Name "dfdsdktests-azdo-01" +``` + +```output +EnvironmentData : { + "environmentType": "AzureDevOpsScope" + } +EnvironmentName : AzureDevOps +Etag : +HierarchyIdentifier : 4a8eb7f1-f533-48c5-b102-9b09e90906b7 +HierarchyIdentifierTrialEndDate : +Id : /subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourcegroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01 +Kind : +Location : centralus +Name : dfdsdktests-azdo-01 +Offering : {{ + "offeringType": "CspmMonitorAzureDevOps" + }} +ResourceGroupName : dfdtest-sdk +SystemDataCreatedAt : 12/7/2023 6:38:36 AM +SystemDataCreatedBy : c3d82ccb-fee1-430c-949e-6c0a217c00a8 +SystemDataCreatedByType : Application +SystemDataLastModifiedAt : 2/14/2024 2:11:46 AM +SystemDataLastModifiedBy : c3d82ccb-fee1-430c-949e-6c0a217c00a8 +SystemDataLastModifiedByType : Application +Tag : {} +Type : Microsoft.Security/securityconnectors +``` + + +### Example 2: List Security Connectors by subscription +```powershell +Get-AzSecurityConnector +``` + +```output +Name ResourceGroupName EnvironmentName Location HierarchyIdentifier +---- ----------------- --------------- -------- ------------------- +dfdsdktests-azdo-01 dfdtest-sdk AzureDevOps centralus 4a8eb7f1-f533-48c5-b102-9b09e90906b7 +dfdsdktests-gl-01 dfdtest-sdk GitLab centralus 7a1f4efe-f8c6-48e7-b7ef-1b45994ed602 +dfdsdktests-gh-01 dfdtest-sdk Github centralus bc12ba4d-b89c-486e-85e1-d803e7d80525 +aws-sdktest01 securityconnectors-tests AWS CentralUS 891376984375 +gcp-sdktest01 securityconnectors-tests GCP CentralUS 843025268399 +``` + diff --git a/src/Security/Security.Autorest/examples/Get-AzSecurityConnectorAzureDevOpsOrg.md b/src/Security/Security.Autorest/examples/Get-AzSecurityConnectorAzureDevOpsOrg.md new file mode 100644 index 000000000000..12065283b013 --- /dev/null +++ b/src/Security/Security.Autorest/examples/Get-AzSecurityConnectorAzureDevOpsOrg.md @@ -0,0 +1,48 @@ +### Example 1: Get discovered AzureDevOps organization by name +```powershell +Get-AzSecurityConnectorAzureDevOpsOrg -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-azdo-01 -OrgName dfdsdktests +``` + +```output +ActionableRemediation : { + "state": "Enabled", + "categoryConfigurations": [ + { + "minimumSeverityLevel": "High", + "category": "IaC" + } + ], + "branchConfiguration": { + "branchNames": [ ], + "annotateDefaultBranch": "Enabled" + }, + "inheritFromParentState": "Disabled" + } +Id : /subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests +Name : dfdsdktests +OnboardingState : Onboarded +ProvisioningState : Succeeded +ProvisioningStatusMessage : OK +ProvisioningStatusUpdateTimeUtc : 2/23/2024 6:49:40 PM +ResourceGroupName : dfdtest-sdk +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Type : Microsoft.Security/securityConnectors/devops/azureDevOpsOrgs +``` + +### Example 2: List discovered AzureDevOps organizations +```powershell +Get-AzSecurityConnectorAzureDevOpsOrg -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-azdo-01 +``` + +```output +Name ResourceGroupName +---- ----------------- +dfdsdktests dfdtest-sdk +dfdsdktests2 dfdtest-sdk +``` + diff --git a/src/Security/Security.Autorest/examples/Get-AzSecurityConnectorAzureDevOpsOrgAvailable.md b/src/Security/Security.Autorest/examples/Get-AzSecurityConnectorAzureDevOpsOrgAvailable.md new file mode 100644 index 000000000000..7e72c9660178 --- /dev/null +++ b/src/Security/Security.Autorest/examples/Get-AzSecurityConnectorAzureDevOpsOrgAvailable.md @@ -0,0 +1,36 @@ +### Example 1: List available AzureDevOps organizations for onboarding +```powershell +Get-AzSecurityConnectorAzureDevOpsOrgAvailable -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-azdo-01 +``` + +```output +ActionableRemediation : { + "state": "Enabled", + "categoryConfigurations": [ + { + "minimumSeverityLevel": "High", + "category": "IaC" + } + ], + "branchConfiguration": { + "branchNames": [ ], + "annotateDefaultBranch": "Enabled" + }, + "inheritFromParentState": "Disabled" + } +Id : /subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests +Name : dfdsdktests +OnboardingState : Onboarded +ProvisioningState : Succeeded +ProvisioningStatusMessage : OK +ProvisioningStatusUpdateTimeUtc : 2/23/2024 6:49:40 PM +ResourceGroupName : dfdtest-sdk +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Type : Microsoft.Security/securityConnectors/devops/azureDevOpsOrgs +``` + diff --git a/src/Security/Security.Autorest/examples/Get-AzSecurityConnectorAzureDevOpsProject.md b/src/Security/Security.Autorest/examples/Get-AzSecurityConnectorAzureDevOpsProject.md new file mode 100644 index 000000000000..bc68361cc90d --- /dev/null +++ b/src/Security/Security.Autorest/examples/Get-AzSecurityConnectorAzureDevOpsProject.md @@ -0,0 +1,52 @@ +### Example 1: Get discovered AzureDevOps project by organization and project name +```powershell +Get-AzSecurityConnectorAzureDevOpsProject -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-azdo-01 -OrgName dfdsdktests -ProjectName ContosoSDKDfd +``` + +```output +ActionableRemediation : { + "state": "Enabled", + "categoryConfigurations": [ + { + "minimumSeverityLevel": "High", + "category": "IaC" + } + ], + "branchConfiguration": { + "branchNames": [ ], + "annotateDefaultBranch": "Enabled" + }, + "inheritFromParentState": "Disabled" + } +Id : /subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests/projects/Co + ntosoSDKDfd +Name : ContosoSDKDfd +OnboardingState : Onboarded +ParentOrgName : dfdsdktests +ProjectId : 161fb6f6-f2fe-4616-a627-293b788ff583 +ProvisioningState : Succeeded +ProvisioningStatusMessage : OK +ProvisioningStatusUpdateTimeUtc : 2/23/2024 6:52:43 PM +ResourceGroupName : dfdtest-sdk +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Type : Microsoft.Security/securityConnectors/devops/azureDevOpsOrgs/projects +``` + +### Example 2: List discovered AzureDevOps projects +```powershell +Get-AzSecurityConnectorAzureDevOpsProject -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-azdo-01 -OrgName dfdsdktests +``` + +```output +Name ResourceGroupName +---- ----------------- +ContosoSDKDfd dfdtest-sdk +ContosoEnterprise dfdtest-sdk +``` + + diff --git a/src/Security/Security.Autorest/examples/Get-AzSecurityConnectorAzureDevOpsRepo.md b/src/Security/Security.Autorest/examples/Get-AzSecurityConnectorAzureDevOpsRepo.md new file mode 100644 index 000000000000..9e7ab407962f --- /dev/null +++ b/src/Security/Security.Autorest/examples/Get-AzSecurityConnectorAzureDevOpsRepo.md @@ -0,0 +1,55 @@ +### Example 1: Get discovered AzureDevOps repository by organization, project and repo name +```powershell +Get-AzSecurityConnectorAzureDevOpsRepo -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-azdo-01 -OrgName dfdsdktests -ProjectName ContosoSDKDfd -RepoName TestApp0 +``` + +```output +ActionableRemediation : { + "state": "Enabled", + "categoryConfigurations": [ + { + "minimumSeverityLevel": "High", + "category": "IaC" + } + ], + "branchConfiguration": { + "branchNames": [ ], + "annotateDefaultBranch": "Enabled" + }, + "inheritFromParentState": "Enabled" + } +Id : /subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests/projects/Co + ntosoSDKDfd/repos/TestApp0 +Name : TestApp0 +OnboardingState : Onboarded +ParentOrgName : dfdsdktests +ParentProjectName : ContosoSDKDfd +ProvisioningState : Succeeded +ProvisioningStatusMessage : OK +ProvisioningStatusUpdateTimeUtc : 2/23/2024 6:52:44 PM +RepoId : 35cd4811-63c7-4043-8587-f0a9cf37709e +RepoUrl : https://dev.azure.com/dfdsdktests/ContosoSDKDfd/_git/TestApp0 +ResourceGroupName : dfdtest-sdk +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Type : Microsoft.Security/securityConnectors/devops/azureDevOpsOrgs/projects/repos +Visibility : +``` + +### Example 2: List discovered AzureDevOps repositories +```powershell +Get-AzSecurityConnectorAzureDevOpsRepo -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-azdo-01 -OrgName dfdsdktests -ProjectName ContosoSDKDfd +``` + +```output +Name ResourceGroupName +---- ----------------- +ContosoSDKDfd dfdtest-sdk +TestApp0 dfdtest-sdk +TestApp2 dfdtest-sdk +``` + diff --git a/src/Security/Security.Autorest/examples/Get-AzSecurityConnectorDevOpsConfiguration.md b/src/Security/Security.Autorest/examples/Get-AzSecurityConnectorDevOpsConfiguration.md new file mode 100644 index 000000000000..0e04e677ea92 --- /dev/null +++ b/src/Security/Security.Autorest/examples/Get-AzSecurityConnectorDevOpsConfiguration.md @@ -0,0 +1,35 @@ +### Example 1: Get Security Connector DevOps Configuration +```powershell +Get-AzSecurityConnectorDevOpsConfiguration -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-azdo-01 +``` + +```output +AuthorizationCode : +AutoDiscovery : Disabled +Id : /subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default +Name : default +ProvisioningState : Succeeded +ProvisioningStatusMessage : Resource creation successful. +ProvisioningStatusUpdateTimeUtc : +ResourceGroupName : dfdtest-sdk +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +TopLevelInventoryList : +Type : Microsoft.Security/securityConnectors/devops +``` + +### Example 2: Try to get non existing Security Connector DevOps Configuration +```powershell +Get-AzSecurityConnectorDevOpsConfiguration -ResourceGroupName securityconnectors-tests -SecurityConnectorName aws-sdktest01 +``` + +```output +Get-AzSecurityConnectorDevOpsConfiguration_Get: DevOps configuration was not found +``` + + + diff --git a/src/Security/Security.Autorest/examples/Get-AzSecurityConnectorGitHubOwner.md b/src/Security/Security.Autorest/examples/Get-AzSecurityConnectorGitHubOwner.md new file mode 100644 index 000000000000..60b97698e19a --- /dev/null +++ b/src/Security/Security.Autorest/examples/Get-AzSecurityConnectorGitHubOwner.md @@ -0,0 +1,38 @@ +### Example 1: Get discovered GitHub owner by name +```powershell +Get-AzSecurityConnectorGitHubOwner -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-gh-01 -OwnerName dfdsdktests +``` + +```output +GitHubInternalId : 45003365 +Id : /subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gh-01/devops/default/gitHubOwners/dfdsdktests +Name : dfdsdktests +OnboardingState : Onboarded +OwnerUrl : https://github.com/dfdsdktests +ProvisioningState : Pending +ProvisioningStatusMessage : Beginning provisioning of GitHub connector. +ProvisioningStatusUpdateTimeUtc : 2/23/2024 8:46:22 PM +ResourceGroupName : dfdtest-sdk +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Type : Microsoft.Security/securityConnectors/devops/gitHubOwners +``` + +### Example 2: List discovered GitHub owners +```powershell +Get-AzSecurityConnectorGitHubOwner -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-gh-01 +``` + +```output +Name ResourceGroupName +---- ----------------- +dfdsdktests dfdtest-sdk +dfdsdktests2 dfdtest-sdk +``` + + + diff --git a/src/Security/Security.Autorest/examples/Get-AzSecurityConnectorGitHubOwnerAvailable.md b/src/Security/Security.Autorest/examples/Get-AzSecurityConnectorGitHubOwnerAvailable.md new file mode 100644 index 000000000000..723544b7b664 --- /dev/null +++ b/src/Security/Security.Autorest/examples/Get-AzSecurityConnectorGitHubOwnerAvailable.md @@ -0,0 +1,25 @@ +### Example 1: List available GitHub owners for onboarding +```powershell +Get-AzSecurityConnectorGitHubOwnerAvailable -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-gh-01 +``` + +```output +GitHubInternalId : 45003365 +Id : /subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gh-01/devops/default/gitHubOwners/dfdsdktests +Name : dfdsdktests +OnboardingState : Onboarded +OwnerUrl : https://github.com/dfdsdktests +ProvisioningState : Pending +ProvisioningStatusMessage : Beginning provisioning of GitHub connector. +ProvisioningStatusUpdateTimeUtc : 2/23/2024 8:46:22 PM +ResourceGroupName : dfdtest-sdk +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Type : Microsoft.Security/securityConnectors/devops/gitHubOwners +``` + + diff --git a/src/Security/Security.Autorest/examples/Get-AzSecurityConnectorGitHubRepo.md b/src/Security/Security.Autorest/examples/Get-AzSecurityConnectorGitHubRepo.md new file mode 100644 index 000000000000..06358065c811 --- /dev/null +++ b/src/Security/Security.Autorest/examples/Get-AzSecurityConnectorGitHubRepo.md @@ -0,0 +1,43 @@ +### Example 1: Get discovered GitHub repository by name +```powershell +Get-AzSecurityConnectorGitHubRepo -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-gh-01 -OwnerName dfdsdktests -RepoName TestApp0 +``` + +```output +Id : /subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gh-01/devops/default/gitHubOwners/dfdsdktests/repos/TestApp0 +Name : TestApp0 +OnboardingState : Onboarded +ParentOwnerName : dfdsdktests +ProvisioningState : +ProvisioningStatusMessage : +ProvisioningStatusUpdateTimeUtc : 2/23/2024 8:46:23 PM +RepoFullName : +RepoId : 728418798 +RepoName : TestApp0 +RepoUrl : https://github.com/dfdsdktests/TestApp0 +ResourceGroupName : dfdtest-sdk +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Type : Microsoft.Security/securityConnectors/devops/gitHubOwners/repos +``` + + +### Example 2: List discovered GitHub repositories +```powershell +Get-AzSecurityConnectorGitHubRepo -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-gh-01 -OwnerName dfdsdktests +``` + +```output + +Name ResourceGroupName +---- ----------------- +TestApp0 dfdtest-sdk +TestApp1 dfdtest-sdk +``` + + + diff --git a/src/Security/Security.Autorest/examples/Get-AzSecurityConnectorGitLabGroup.md b/src/Security/Security.Autorest/examples/Get-AzSecurityConnectorGitLabGroup.md new file mode 100644 index 000000000000..d610749a2e8e --- /dev/null +++ b/src/Security/Security.Autorest/examples/Get-AzSecurityConnectorGitLabGroup.md @@ -0,0 +1,39 @@ +### Example 1: Get discovered GitLab group by name +```powershell +Get-AzSecurityConnectorGitLabGroup -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-gl-01 -GroupFqName dfdsdktests +``` + +```output +FullyQualifiedFriendlyName : Defender for DevOps SDK Tests +FullyQualifiedName : dfdsdktests +Id : /subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gl-01/devops/default/gitLabGroups/dfdsdktests +Name : dfdsdktests +OnboardingState : Onboarded +ProvisioningState : Succeeded +ProvisioningStatusMessage : Resource modification successful. +ProvisioningStatusUpdateTimeUtc : 2/23/2024 10:42:28 PM +ResourceGroupName : dfdtest-sdk +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Type : Microsoft.Security/securityConnectors/devops/gitLabGroups +Url : https://gitlab.com/groups/dfdsdktests +``` + +### Example 2: List discovered GitLab groups +```powershell +Get-AzSecurityConnectorGitLabGroup -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-gl-01 +``` + +```output +Name ResourceGroupName +---- ----------------- +dfdsdktests dfdtest-sdk +dfdsdktests2 dfdtest-sdk +``` + + + diff --git a/src/Security/Security.Autorest/examples/Get-AzSecurityConnectorGitLabGroupAvailable.md b/src/Security/Security.Autorest/examples/Get-AzSecurityConnectorGitLabGroupAvailable.md new file mode 100644 index 000000000000..741b3485fad3 --- /dev/null +++ b/src/Security/Security.Autorest/examples/Get-AzSecurityConnectorGitLabGroupAvailable.md @@ -0,0 +1,25 @@ +### Example 1: List available GitLab groups for onboarding +```powershell +Get-AzSecurityConnectorGitLabGroupAvailable -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-gl-01 +``` + +```output +FullyQualifiedFriendlyName : Defender for DevOps SDK Tests +FullyQualifiedName : dfdsdktests +Id : /subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gl-01/devops/default/gitLabGroups/dfdsdktests +Name : dfdsdktests +OnboardingState : Onboarded +ProvisioningState : Succeeded +ProvisioningStatusMessage : Resource modification successful. +ProvisioningStatusUpdateTimeUtc : 2/23/2024 10:42:28 PM +ResourceGroupName : dfdtest-sdk +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Type : Microsoft.Security/securityConnectors/devops/gitLabGroups +Url : https://gitlab.com/groups/dfdsdktests +``` + diff --git a/src/Security/Security.Autorest/examples/Get-AzSecurityConnectorGitLabProject.md b/src/Security/Security.Autorest/examples/Get-AzSecurityConnectorGitLabProject.md new file mode 100644 index 000000000000..aba6413de1d4 --- /dev/null +++ b/src/Security/Security.Autorest/examples/Get-AzSecurityConnectorGitLabProject.md @@ -0,0 +1,40 @@ +### Example 1: Get discovered GitLab project by name +```powershell +Get-AzSecurityConnectorGitLabProject -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-gl-01 -GroupFqName dfdsdktests -ProjectName testapp0 +``` + +```output +FullyQualifiedFriendlyName : Defender for DevOps SDK Tests / TestApp0 +FullyQualifiedName : dfdsdktests$testapp0 +FullyQualifiedParentGroupName : dfdsdktests +Id : /subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gl-01/devops/default/gitLabGroups/dfdsdktests/projects/testapp0 +Name : testapp0 +OnboardingState : Onboarded +ProvisioningState : Succeeded +ProvisioningStatusMessage : Resource modification successful. +ProvisioningStatusUpdateTimeUtc : 1/1/1970 12:00:00 AM +ResourceGroupName : dfdtest-sdk +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Type : Microsoft.Security/securityConnectors/devops/gitLabGroups/projects +Url : https://gitlab.com/dfdsdktests/testapp0 +``` + +### Example 2: List discovered GitLab projects +```powershell +Get-AzSecurityConnectorGitLabProject -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-gl-01 -GroupFqName dfdsdktests +``` + +```output +Name ResourceGroupName +---- ----------------- +testapp10 dfdtest-sdk +testapp11 dfdtest-sdk +testapp0 dfdtest-sdk +``` + + diff --git a/src/Security/Security.Autorest/examples/Get-AzSecurityConnectorGitLabSubgroup.md b/src/Security/Security.Autorest/examples/Get-AzSecurityConnectorGitLabSubgroup.md new file mode 100644 index 000000000000..7f5d94c682d3 --- /dev/null +++ b/src/Security/Security.Autorest/examples/Get-AzSecurityConnectorGitLabSubgroup.md @@ -0,0 +1,13 @@ +### Example 1: List discovered GitLab subgroups +```powershell +Get-AzSecurityConnectorGitLabSubgroup -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-gl-01 -GroupFqName dfdsdktests +``` + +```output +Name ResourceGroupName +---- ----------------- +dfdsdktests$testsubgroup1$testsubgroupNested dfdtest-sdk +dfdsdktests$testsubgroup1 dfdtest-sdk +``` + + diff --git a/src/Security/Security.Autorest/examples/Invoke-AzSecurityApiCollectionApimOffboard.md b/src/Security/Security.Autorest/examples/Invoke-AzSecurityApiCollectionApimOffboard.md new file mode 100644 index 000000000000..7509da52b520 --- /dev/null +++ b/src/Security/Security.Autorest/examples/Invoke-AzSecurityApiCollectionApimOffboard.md @@ -0,0 +1,5 @@ +### Example 1: Offboard an Azure API Management API to Microsoft Defender for APIs. +```powershell +Invoke-AzSecurityApiCollectionApimOffboard -ResourceGroupName "apicollectionstests" -ServiceName "demoapimservice2" -ApiId "echo-api-2" +``` + diff --git a/src/Security/Security.Autorest/examples/Invoke-AzSecurityApiCollectionApimOnboard.md b/src/Security/Security.Autorest/examples/Invoke-AzSecurityApiCollectionApimOnboard.md new file mode 100644 index 000000000000..bb574005a514 --- /dev/null +++ b/src/Security/Security.Autorest/examples/Invoke-AzSecurityApiCollectionApimOnboard.md @@ -0,0 +1,23 @@ +### Example 1: Onboard an Azure API Management API to Microsoft Defender for APIs. +```powershell +Invoke-AzSecurityApiCollectionApimOnboard -ResourceGroupName "apicollectionstests" -ServiceName "demoapimservice2" -ApiId "echo-api-2" +``` + +```output +BaseUrl : https://demoapimservice2.azure-api.net +DiscoveredVia : /subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/apicollectionstests/providers/Microsoft.ApiManagement/service/demoapimservice2 +DisplayName : Echo API 2 +Id : /subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/apicollectionstests/providers/Microsoft.ApiManagement/service/demoapimservice2/providers/Microsoft.Security/apiCollections/ech + o-api-2 +Name : echo-api-2 +NumberOfApiEndpoint : 0 +NumberOfApiEndpointsWithSensitiveDataExposed : 0 +NumberOfExternalApiEndpoint : 0 +NumberOfInactiveApiEndpoint : 0 +NumberOfUnauthenticatedApiEndpoint : 0 +ProvisioningState : Succeeded +ResourceGroupName : apicollectionstests +SensitivityLabel : +Type : microsoft.security/apicollections +``` + diff --git a/src/Security/Security.Autorest/examples/New-AzSecurityAwsEnvironmentObject.md b/src/Security/Security.Autorest/examples/New-AzSecurityAwsEnvironmentObject.md new file mode 100644 index 000000000000..d3d5ee92cd07 --- /dev/null +++ b/src/Security/Security.Autorest/examples/New-AzSecurityAwsEnvironmentObject.md @@ -0,0 +1,36 @@ +### Example 1: Create new AwsEnvironment object as member +```powershell +$member = New-AzSecurityAwsOrganizationalDataMemberObject -ParentHierarchyId "123" +New-AzSecurityAwsEnvironmentObject -Region "Central US" -ScanInterval 24 -OrganizationalData $member +``` + +```output +AccountName : +EnvironmentType : AwsAccount +OrganizationalData : { + "organizationMembershipType": "Member", + "parentHierarchyId": "123" + } +Region : {Central US} +ScanInterval : 24 +``` + + +### Example 2: Create new AwsEnvironment object as organization +```powershell +$organization = New-AzSecurityAwsOrganizationalDataMasterObject -StacksetName "myAwsStackSet" -ExcludedAccountId "123456789012" +New-AzSecurityAwsEnvironmentObject -Region "Central US" -ScanInterval 24 -OrganizationalData $organization +``` + +```output +AccountName : +EnvironmentType : AwsAccount +OrganizationalData : { + "organizationMembershipType": "Organization", + "stacksetName": "myAwsStackSet", + "excludedAccountIds": [ "123456789012" ] + } +Region : {Central US} +ScanInterval : 24 +``` + diff --git a/src/Security/Security.Autorest/examples/New-AzSecurityAwsOrganizationalDataMasterObject.md b/src/Security/Security.Autorest/examples/New-AzSecurityAwsOrganizationalDataMasterObject.md new file mode 100644 index 000000000000..2bb76ed09379 --- /dev/null +++ b/src/Security/Security.Autorest/examples/New-AzSecurityAwsOrganizationalDataMasterObject.md @@ -0,0 +1,11 @@ +### Example 1: Create new AwsOrganizationalDataMaster object +```powershell +New-AzSecurityAwsOrganizationalDataMasterObject -StacksetName "myAwsStackSet" -ExcludedAccountId "123456789012" +``` + +```output +ExcludedAccountId OrganizationMembershipType StacksetName +----------------- -------------------------- ------------ +{123456789012} Organization myAwsStackSet +``` + diff --git a/src/Security/Security.Autorest/examples/New-AzSecurityAwsOrganizationalDataMemberObject.md b/src/Security/Security.Autorest/examples/New-AzSecurityAwsOrganizationalDataMemberObject.md new file mode 100644 index 000000000000..4a82f31c316a --- /dev/null +++ b/src/Security/Security.Autorest/examples/New-AzSecurityAwsOrganizationalDataMemberObject.md @@ -0,0 +1,13 @@ +### Example 1: Create new AwsOrganizationalDataMember object +```powershell +New-AzSecurityAwsOrganizationalDataMemberObject -ParentHierarchyId "123" +``` + +```output +OrganizationMembershipType ParentHierarchyId +-------------------------- ----------------- +Member 123 +``` + + + diff --git a/src/Security/Security.Autorest/examples/New-AzSecurityAzureDevOpsScopeEnvironmentObject.md b/src/Security/Security.Autorest/examples/New-AzSecurityAzureDevOpsScopeEnvironmentObject.md new file mode 100644 index 000000000000..e29de8522f78 --- /dev/null +++ b/src/Security/Security.Autorest/examples/New-AzSecurityAzureDevOpsScopeEnvironmentObject.md @@ -0,0 +1,13 @@ +### Example 1: Create new AzureDevOpsScopeEnvironment object +```powershell +New-AzSecurityAzureDevOpsScopeEnvironmentObject +``` + +```output +EnvironmentType +--------------- +AzureDevOpsScope +``` + + + diff --git a/src/Security/Security.Autorest/examples/New-AzSecurityConnector.md b/src/Security/Security.Autorest/examples/New-AzSecurityConnector.md new file mode 100644 index 000000000000..a138fd11ebd6 --- /dev/null +++ b/src/Security/Security.Autorest/examples/New-AzSecurityConnector.md @@ -0,0 +1,345 @@ +### Example 1: Create AWS security connector +```powershell +$account = "891376984375" +$arnPrefix = "arn:aws:iam::$($account):role" + +$cspmMonitorOffering = New-AzSecurityCspmMonitorAwsOfferingObject -NativeCloudConnectionCloudRoleArn "$arnPrefix/CspmMonitorAws" + +$dcspmOffering = New-AzSecurityDefenderCspmAwsOfferingObject ` + -VMScannerEnabled $true -ConfigurationScanningMode Default -ConfigurationCloudRoleArn "$arnPrefix/DefenderForCloud-AgentlessScanner" ` + -DataSensitivityDiscoveryEnabled $true -DataSensitivityDiscoveryCloudRoleArn "$arnPrefix/SensitiveDataDiscovery" ` + -DatabaseDspmEnabled $true -DatabaseDspmCloudRoleArn "$arnPrefix/DefenderForCloud-DataSecurityPostureDB" ` + -CiemDiscoveryCloudRoleArn "$arnPrefix/DefenderForCloud-Ciem" -CiemOidcAzureActiveDirectoryAppName "mciem-aws-oidc-connector" -CiemOidcCloudRoleArn "$arnPrefix/DefenderForCloud-OidcCiem" ` + -MdcContainerImageAssessmentEnabled $true -MdcContainerImageAssessmentCloudRoleArn "$arnPrefix/MDCContainersImageAssessmentRole" ` + -MdcContainerAgentlessDiscoveryK8SEnabled $true -MdcContainerAgentlessDiscoveryK8SCloudRoleArn "$arnPrefix/MDCContainersAgentlessDiscoveryK8sRole" + +$defenderForContainersOffering = New-AzSecurityDefenderForContainersAwsOfferingObject ` + -AutoProvisioning $true -KuberneteServiceCloudRoleArn "$arnPrefix/DefenderForCloud-Containers-K8s" -KuberneteScubaReaderCloudRoleArn "$arnPrefix/DefenderForCloud-DataCollection" ` + -KinesiToS3CloudRoleArn "$arnPrefix/DefenderForCloud-Containers-K8s-kinesis-to-s3" -CloudWatchToKinesiCloudRoleArn "$arnPrefix/DefenderForCloud-Containers-K8s-cloudwatch-to-kinesis" ` + -KubeAuditRetentionTime 30 -ScubaExternalId "a47ae0a2-7bf7-482a-897a-7a139d30736c" ` + -MdcContainerAgentlessDiscoveryK8SEnabled $true -MdcContainerAgentlessDiscoveryK8SCloudRoleArn "$arnPrefix/MDCContainersAgentlessDiscoveryK8sRole" ` + -MdcContainerImageAssessmentEnabled $true -MdcContainerImageAssessmentCloudRoleArn "$arnPrefix/MDCContainersImageAssessmentRole" ` + -EnableContainerVulnerabilityAssessment $false + +$environment = New-AzSecurityAwsEnvironmentObject -ScanInterval 24 + +New-AzSecurityConnector -Name "aws-sdktest01" -ResourceGroupName "securityConnectors-tests" ` + -EnvironmentData $environment -EnvironmentName AWS -HierarchyIdentifier "$account" ` + -Offering @($cspmMonitorOffering, $dcspmOffering, $defenderForContainersOffering) ` + -Location "CentralUS" +``` + +```output +EnvironmentData : { + "environmentType": "AwsAccount", + "regions": [ ], + "scanInterval": 24 + } +EnvironmentName : AWS +Etag : +HierarchyIdentifier : 891376984375 +HierarchyIdentifierTrialEndDate : 3/24/2024 12:00:00 AM +Id : /subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourcegroups/securityconnectors-tests/providers/Microsoft.Security/securityConnectors/aws-sdktes + t01 +Kind : +Location : CentralUS +Name : aws-sdktest01 +Offering : {{ + "offeringType": "CspmMonitorAws", + "nativeCloudConnection": { + "cloudRoleArn": "arn:aws:iam::891376984375:role/CspmMonitorAws" + } + }, { + "offeringType": "DefenderCspmAws", + "vmScanners": { + "configuration": { + "cloudRoleArn": "arn:aws:iam::891376984375:role/DefenderForCloud-AgentlessScanner", + "scanningMode": "Default" + }, + "enabled": true + }, + "dataSensitivityDiscovery": { + "enabled": true, + "cloudRoleArn": "arn:aws:iam::891376984375:role/SensitiveDataDiscovery" + }, + "databasesDspm": { + "enabled": true, + "cloudRoleArn": "arn:aws:iam::891376984375:role/DefenderForCloud-DataSecurityPostureDB" + }, + "ciem": { + "ciemDiscovery": { + "cloudRoleArn": "arn:aws:iam::891376984375:role/DefenderForCloud-Ciem" + }, + "ciemOidc": { + "cloudRoleArn": "arn:aws:iam::891376984375:role/DefenderForCloud-OidcCiem", + "azureActiveDirectoryAppName": "mciem-aws-oidc-connector" + } + }, + "mdcContainersImageAssessment": { + "enabled": true, + "cloudRoleArn": "arn:aws:iam::891376984375:role/MDCContainersImageAssessmentRole" + }, + "mdcContainersAgentlessDiscoveryK8s": { + "enabled": true, + "cloudRoleArn": "arn:aws:iam::891376984375:role/MDCContainersAgentlessDiscoveryK8sRole" + } + }, { + "offeringType": "DefenderForContainersAws", + "kubernetesService": { + "cloudRoleArn": "arn:aws:iam::891376984375:role/DefenderForCloud-Containers-K8s" + }, + "kubernetesScubaReader": { + "cloudRoleArn": "arn:aws:iam::891376984375:role/DefenderForCloud-DataCollection" + }, + "cloudWatchToKinesis": { + "cloudRoleArn": "arn:aws:iam::891376984375:role/DefenderForCloud-Containers-K8s-cloudwatch-to-kinesis" + }, + "kinesisToS3": { + "cloudRoleArn": "arn:aws:iam::891376984375:role/DefenderForCloud-Containers-K8s-kinesis-to-s3" + }, + "mdcContainersImageAssessment": { + "enabled": true, + "cloudRoleArn": "arn:aws:iam::891376984375:role/MDCContainersImageAssessmentRole" + }, + "mdcContainersAgentlessDiscoveryK8s": { + "enabled": true, + "cloudRoleArn": "arn:aws:iam::891376984375:role/MDCContainersAgentlessDiscoveryK8sRole" + }, + "enableContainerVulnerabilityAssessment": false, + "autoProvisioning": true, + "kubeAuditRetentionTime": 30, + "scubaExternalId": "a47ae0a2-7bf7-482a-897a-7a139d30736c" + }} +ResourceGroupName : securityconnectors-tests +SystemDataCreatedAt : 2/22/2024 11:45:53 PM +SystemDataCreatedBy : c3d82ccb-fee1-430c-949e-6c0a217c00a8 +SystemDataCreatedByType : Application +SystemDataLastModifiedAt : 2/22/2024 11:45:53 PM +SystemDataLastModifiedBy : c3d82ccb-fee1-430c-949e-6c0a217c00a8 +SystemDataLastModifiedByType : Application +Tag : { + } +Type : Microsoft.Security/securityconnectors +``` + +### Example 2: Create GCP security connector +```powershell +$account = "843025268399" +$emailSuffix = "myproject.iam.gserviceaccount.com" +$cspmMonitorOffering = New-AzSecurityCspmMonitorGcpOfferingObject -NativeCloudConnectionServiceAccountEmailAddress "microsoft-defender-cspm@$emailSuffix" -NativeCloudConnectionWorkloadIdentityProviderId "cspm" + +$dcspmOffering = New-AzSecurityDefenderCspmGcpOfferingObject ` + -VMScannerEnabled $true -ConfigurationScanningMode Default -ConfigurationExclusionTag @{key="value"} ` + -MdcContainerAgentlessDiscoveryK8SEnabled $true -MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress "mdc-containers-k8s-operator@$emailSuffix" -MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId "containers" ` + -MdcContainerImageAssessmentEnabled $true -MdcContainerImageAssessmentServiceAccountEmailAddress "mdc-containers-artifact-assess@$emailSuffix" -MdcContainerImageAssessmentWorkloadIdentityProviderId "containers" ` + -DataSensitivityDiscoveryEnabled $true -DataSensitivityDiscoveryServiceAccountEmailAddress "mdc-data-sec-posture-storage@$emailSuffix" -DataSensitivityDiscoveryWorkloadIdentityProviderId "data-security-posture-storage" ` + -CiemDiscoveryServiceAccountEmailAddress "microsoft-defender-ciem@$emailSuffix" -CiemDiscoveryAzureActiveDirectoryAppName "mciem-gcp-oidc-app" -CiemDiscoveryWorkloadIdentityProviderId "ciem-discovery" + +$defenderForContainersOffering = New-AzSecurityDefenderForContainersGcpOfferingObject ` + -NativeCloudConnectionServiceAccountEmailAddress "microsoft-defender-containers@$emailSuffix" -NativeCloudConnectionWorkloadIdentityProviderId "containers" ` + -DataPipelineNativeCloudConnectionServiceAccountEmailAddress "ms-defender-containers-stream@$emailSuffix" -DataPipelineNativeCloudConnectionWorkloadIdentityProviderId "containers-streams" ` + -AuditLogsAutoProvisioningFlag $true -DefenderAgentAutoProvisioningFlag $true -PolicyAgentAutoProvisioningFlag $true ` + -MdcContainerAgentlessDiscoveryK8SEnabled $true -MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId "containers" -MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress "mdc-containers-k8s-operator@$emailSuffix" ` + -MdcContainerImageAssessmentEnabled $true -MdcContainerImageAssessmentWorkloadIdentityProviderId "containers" -MdcContainerImageAssessmentServiceAccountEmailAddress "mdc-containers-artifact-assess@$emailSuffix" + +$environment = New-AzSecurityGcpProjectEnvironmentObject -ScanInterval 24 -ProjectDetailProjectId "asc-sdk-samples" -ProjectDetailProjectNumber "$account" + +New-AzSecurityConnector -Name "gcp-sdktest01" -ResourceGroupName "securityConnectors-tests" -EnvironmentData $environment -EnvironmentName GCP -HierarchyIdentifier "$account" ` + -Offering @($cspmMonitorOffering, $dcspmOffering, $defenderForContainersOffering) -Location "CentralUS" +``` + +```output +EnvironmentData : { + "environmentType": "GcpProject", + "projectDetails": { + "projectNumber": "843025268399", + "projectId": "asc-sdk-samples" + }, + "scanInterval": 24 + } +EnvironmentName : GCP +Etag : +HierarchyIdentifier : 843025268399 +HierarchyIdentifierTrialEndDate : 3/24/2024 12:00:00 AM +Id : /subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourcegroups/securityconnectors-tests/providers/Microsoft.Security/securityConnectors/gcp-sdktest01 +Kind : +Location : CentralUS +Name : gcp-sdktest01 +Offering : {{ + "offeringType": "CspmMonitorGcp", + "nativeCloudConnection": { + "workloadIdentityProviderId": "cspm", + "serviceAccountEmailAddress": "microsoft-defender-cspm@myproject.iam.gserviceaccount.com" + } + }, { + "offeringType": "DefenderCspmGcp", + "ciemDiscovery": { + "workloadIdentityProviderId": "ciem-discovery", + "serviceAccountEmailAddress": "microsoft-defender-ciem@myproject.iam.gserviceaccount.com", + "azureActiveDirectoryAppName": "mciem-gcp-oidc-app" + }, + "vmScanners": { + "configuration": { + "scanningMode": "Default", + "exclusionTags": { + "key": "value" + } + }, + "enabled": true + }, + "dataSensitivityDiscovery": { + "enabled": true, + "workloadIdentityProviderId": "data-security-posture-storage", + "serviceAccountEmailAddress": "mdc-data-sec-posture-storage@myproject.iam.gserviceaccount.com" + }, + "mdcContainersImageAssessment": { + "enabled": true, + "workloadIdentityProviderId": "containers", + "serviceAccountEmailAddress": "mdc-containers-artifact-assess@myproject.iam.gserviceaccount.com" + }, + "mdcContainersAgentlessDiscoveryK8s": { + "enabled": true, + "workloadIdentityProviderId": "containers", + "serviceAccountEmailAddress": "mdc-containers-k8s-operator@myproject.iam.gserviceaccount.com" + } + }, { + "offeringType": "DefenderForContainersGcp", + "nativeCloudConnection": { + "serviceAccountEmailAddress": "microsoft-defender-containers@myproject.iam.gserviceaccount.com", + "workloadIdentityProviderId": "containers" + }, + "dataPipelineNativeCloudConnection": { + "serviceAccountEmailAddress": "ms-defender-containers-stream@myproject.iam.gserviceaccount.com", + "workloadIdentityProviderId": "containers-streams" + }, + "mdcContainersImageAssessment": { + "enabled": true, + "workloadIdentityProviderId": "containers", + "serviceAccountEmailAddress": "mdc-containers-artifact-assess@myproject.iam.gserviceaccount.com" + }, + "mdcContainersAgentlessDiscoveryK8s": { + "enabled": true, + "workloadIdentityProviderId": "containers", + "serviceAccountEmailAddress": "mdc-containers-k8s-operator@myproject.iam.gserviceaccount.com" + }, + "auditLogsAutoProvisioningFlag": true, + "defenderAgentAutoProvisioningFlag": true, + "policyAgentAutoProvisioningFlag": true + }} +ResourceGroupName : securityconnectors-tests +SystemDataCreatedAt : 2/22/2024 11:45:53 PM +SystemDataCreatedBy : c3d82ccb-fee1-430c-949e-6c0a217c00a8 +SystemDataCreatedByType : Application +SystemDataLastModifiedAt : 2/22/2024 11:45:53 PM +SystemDataLastModifiedBy : c3d82ccb-fee1-430c-949e-6c0a217c00a8 +SystemDataLastModifiedByType : Application +Tag : {} +Type : Microsoft.Security/securityconnectors +``` + +### Example 3: Create AzureDevOps security connector +```powershell +New-AzSecurityConnector -ResourceGroupName "securityConnectors-pwsh-tmp" -Name "ado-sdk-pwsh-test03" ` + -EnvironmentName AzureDevOps -EnvironmentData (New-AzSecurityAzureDevOpsScopeEnvironmentObject) ` + -HierarchyIdentifier ([guid]::NewGuid().ToString()) -Location "CentralUS" ` + -Offering @(New-AzSecurityCspmMonitorAzureDevOpsOfferingObject) +``` + +```output +EnvironmentData : { + "environmentType": "AzureDevOpsScope" + } +EnvironmentName : AzureDevOps +Etag : +HierarchyIdentifier : 9dd01e19-8aaf-43a2-8dd4-1c5992f4df35 +HierarchyIdentifierTrialEndDate : +Id : /subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourcegroups/securityconnectors-pwsh-tmp/providers/Microsoft.Security/securityConnectors/ado-sdk-pwsh-test03 +Kind : +Location : CentralUS +Name : ado-sdk-pwsh-test03 +Offering : {{ + "offeringType": "CspmMonitorAzureDevOps" + }} +ResourceGroupName : securityconnectors-pwsh-tmp +SystemDataCreatedAt : 2/24/2024 12:13:11 AM +SystemDataCreatedBy : c3d82ccb-fee1-430c-949e-6c0a217c00a8 +SystemDataCreatedByType : Application +SystemDataLastModifiedAt : 2/24/2024 12:13:11 AM +SystemDataLastModifiedBy : c3d82ccb-fee1-430c-949e-6c0a217c00a8 +SystemDataLastModifiedByType : Application +Tag : { + } +Type : Microsoft.Security/securityconnectors +``` + +### Example 4: Create GitHub security connector +```powershell +New-AzSecurityConnector -ResourceGroupName "securityConnectors-pwsh-tmp" -Name "gh-sdk-pwsh-test03" ` + -EnvironmentName GitHub -EnvironmentData (New-AzSecurityGitHubScopeEnvironmentObject) ` + -HierarchyIdentifier ([guid]::NewGuid().ToString()) -Location "CentralUS" ` + -Offering @(New-AzSecurityCspmMonitorGithubOfferingObject) +``` + +```output +EnvironmentData : { + "environmentType": "GithubScope" + } +EnvironmentName : Github +Etag : +HierarchyIdentifier : e8661d05-8003-46ae-b687-fa83746f44f3 +HierarchyIdentifierTrialEndDate : +Id : /subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourcegroups/securityconnectors-pwsh-tmp/providers/Microsoft.Security/securityConnectors/gh-sdk-pwsh-test03 +Kind : +Location : CentralUS +Name : gh-sdk-pwsh-test03 +Offering : {{ + "offeringType": "CspmMonitorGithub" + }} +ResourceGroupName : securityconnectors-pwsh-tmp +SystemDataCreatedAt : 2/24/2024 12:55:33 AM +SystemDataCreatedBy : c3d82ccb-fee1-430c-949e-6c0a217c00a8 +SystemDataCreatedByType : Application +SystemDataLastModifiedAt : 2/24/2024 12:55:33 AM +SystemDataLastModifiedBy : c3d82ccb-fee1-430c-949e-6c0a217c00a8 +SystemDataLastModifiedByType : Application +Tag : { + } +Type : Microsoft.Security/securityconnectors +``` + +### Example 5: Create GitLab security connector +```powershell +New-AzSecurityConnector -ResourceGroupName "securityConnectors-pwsh-tmp" -Name "gl-sdk-pwsh-test03" ` + -EnvironmentName GitLab -EnvironmentData (New-AzSecurityGitLabScopeEnvironmentObject) ` + -HierarchyIdentifier ([guid]::NewGuid().ToString()) -Location "CentralUS" ` + -Offering @(New-AzSecurityCspmMonitorGitLabOfferingObject) +``` + +```output +EnvironmentData : { + "environmentType": "GitLabScope" + } +EnvironmentName : GitLab +Etag : +HierarchyIdentifier : e8661d05-8003-46ae-b687-fa83746f44f3 +HierarchyIdentifierTrialEndDate : +Id : /subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourcegroups/securityconnectors-pwsh-tmp/providers/Microsoft.Security/securityConnectors/gl-sdk-pwsh-test03 +Kind : +Location : CentralUS +Name : gl-sdk-pwsh-test03 +Offering : {{ + "offeringType": "CspmMonitorGitLab" + }} +ResourceGroupName : securityconnectors-pwsh-tmp +SystemDataCreatedAt : 2/24/2024 12:55:33 AM +SystemDataCreatedBy : c3d82ccb-fee1-430c-949e-6c0a217c00a8 +SystemDataCreatedByType : Application +SystemDataLastModifiedAt : 2/24/2024 12:55:33 AM +SystemDataLastModifiedBy : c3d82ccb-fee1-430c-949e-6c0a217c00a8 +SystemDataLastModifiedByType : Application +Tag : { + } +Type : Microsoft.Security/securityconnectors +``` + + diff --git a/src/Security/Security.Autorest/examples/New-AzSecurityConnectorActionableRemediationObject.md b/src/Security/Security.Autorest/examples/New-AzSecurityConnectorActionableRemediationObject.md new file mode 100644 index 000000000000..75ae99d380e2 --- /dev/null +++ b/src/Security/Security.Autorest/examples/New-AzSecurityConnectorActionableRemediationObject.md @@ -0,0 +1,23 @@ +### Example 1: Create new ActionableRemediation object +```powershell +New-AzSecurityConnectorActionableRemediationObject -State Enabled -InheritFromParentState Disabled ` + -BranchConfiguration @{AnnotateDefaultBranch="Enabled"; branchName=@("main", "hotfix")} -CategoryConfiguration @( @{category="First"; minimumSeverityLevel="High"}, @{category="Second"; minimumSeverityLevel="Low"}) +``` + +```output +BranchConfiguration : { + "branchNames": [ "main", "hotfix" ], + "annotateDefaultBranch": "Enabled" + } +CategoryConfiguration : {{ + "minimumSeverityLevel": "High", + "category": "First" + }, { + "minimumSeverityLevel": "Low", + "category": "Second" + }} +InheritFromParentState : Disabled +State : Enabled +``` + + diff --git a/src/Security/Security.Autorest/examples/New-AzSecurityConnectorDevOpsConfiguration.md b/src/Security/Security.Autorest/examples/New-AzSecurityConnectorDevOpsConfiguration.md new file mode 100644 index 000000000000..2230f7004fee --- /dev/null +++ b/src/Security/Security.Autorest/examples/New-AzSecurityConnectorDevOpsConfiguration.md @@ -0,0 +1,24 @@ +### Example 1: Create new DevOps Configuration for the security connector +```powershell +New-AzSecurityConnectorDevOpsConfiguration -ResourceGroupName "securityconnectors-pwsh-tmp" -SecurityConnectorName "ado-sdk-pwsh-test03" -AutoDiscovery Disabled -TopLevelInventoryList @("org1", "org2") -AuthorizationCode "myAuthorizationCode" +``` + +```output +AuthorizationCode : +AutoDiscovery : Disabled +Id : /subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/securityconnectors-pwsh-tmp/providers/Microsoft.Security/securityConnectors/ado-sdk-pwsh-test03/devops/default +Name : default +ProvisioningState : Succeeded +ProvisioningStatusMessage : Resource creation successful. +ProvisioningStatusUpdateTimeUtc : +ResourceGroupName : securityconnectors-pwsh-tmp +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +TopLevelInventoryList : +Type : Microsoft.Security/securityConnectors/devops +``` + diff --git a/src/Security/Security.Autorest/examples/New-AzSecurityCspmMonitorAwsOfferingObject.md b/src/Security/Security.Autorest/examples/New-AzSecurityCspmMonitorAwsOfferingObject.md new file mode 100644 index 000000000000..9756a8f7ffc3 --- /dev/null +++ b/src/Security/Security.Autorest/examples/New-AzSecurityCspmMonitorAwsOfferingObject.md @@ -0,0 +1,13 @@ +### Example 1: Create new CspmMonitorAwsOffering object +```powershell +New-AzSecurityCspmMonitorAwsOfferingObject -NativeCloudConnectionCloudRoleArn "arn:aws:iam::123456789012:role/CspmMonitorAws" +``` + +```output +Description NativeCloudConnectionCloudRoleArn OfferingType +----------- --------------------------------- ------------ + arn:aws:iam::123456789012:role/CspmMonitorAws CspmMonitorAws +``` + + + diff --git a/src/Security/Security.Autorest/examples/New-AzSecurityCspmMonitorAzureDevOpsOfferingObject.md b/src/Security/Security.Autorest/examples/New-AzSecurityCspmMonitorAzureDevOpsOfferingObject.md new file mode 100644 index 000000000000..db5e687db9ff --- /dev/null +++ b/src/Security/Security.Autorest/examples/New-AzSecurityCspmMonitorAzureDevOpsOfferingObject.md @@ -0,0 +1,12 @@ +### Example 1: Create new CspmMonitorAzureDevOpsOffering object +```powershell +New-AzSecurityCspmMonitorAzureDevOpsOfferingObject +``` + +```output +Description OfferingType +----------- ------------ + CspmMonitorAzureDevOps +``` + + diff --git a/src/Security/Security.Autorest/examples/New-AzSecurityCspmMonitorGcpOfferingObject.md b/src/Security/Security.Autorest/examples/New-AzSecurityCspmMonitorGcpOfferingObject.md new file mode 100644 index 000000000000..64e821b0d554 --- /dev/null +++ b/src/Security/Security.Autorest/examples/New-AzSecurityCspmMonitorGcpOfferingObject.md @@ -0,0 +1,13 @@ +### Example 1: Create new CspmMonitorGcpOffering object +```powershell +New-AzSecurityCspmMonitorGcpOfferingObject -NativeCloudConnectionServiceAccountEmailAddress "microsoft-defender-cspm@asc-sdk-samples.iam.gserviceaccount.com" -NativeCloudConnectionWorkloadIdentityProviderId "cspm" +``` + +```output +Description NativeCloudConnectionServiceAccountEmailAddress NativeCloudConnectionWorkloadIdentityProviderId OfferingType +----------- ----------------------------------------------- ----------------------------------------------- ------------ + microsoft-defender-cspm@asc-sdk-samples.iam.gserviceaccount.com cspm CspmMonitorGcp +``` + + + diff --git a/src/Security/Security.Autorest/examples/New-AzSecurityCspmMonitorGitLabOfferingObject.md b/src/Security/Security.Autorest/examples/New-AzSecurityCspmMonitorGitLabOfferingObject.md new file mode 100644 index 000000000000..e1a4157532e2 --- /dev/null +++ b/src/Security/Security.Autorest/examples/New-AzSecurityCspmMonitorGitLabOfferingObject.md @@ -0,0 +1,13 @@ +### Example 1: Create new CspmMonitorGitLabOffering object +```powershell +New-AzSecurityCspmMonitorGitLabOfferingObject +``` + +```output +Description OfferingType +----------- ------------ + CspmMonitorGitLab +``` + + + diff --git a/src/Security/Security.Autorest/examples/New-AzSecurityCspmMonitorGithubOfferingObject.md b/src/Security/Security.Autorest/examples/New-AzSecurityCspmMonitorGithubOfferingObject.md new file mode 100644 index 000000000000..a938887cf13b --- /dev/null +++ b/src/Security/Security.Autorest/examples/New-AzSecurityCspmMonitorGithubOfferingObject.md @@ -0,0 +1,12 @@ +### Example 1: Create new CspmMonitorGithubOffering object +```powershell +New-AzSecurityCspmMonitorGithubOfferingObject +``` + +```output +Description OfferingType +----------- ------------ + CspmMonitorGithub +``` + + diff --git a/src/Security/Security.Autorest/examples/New-AzSecurityDefenderCspmAwsOfferingObject.md b/src/Security/Security.Autorest/examples/New-AzSecurityDefenderCspmAwsOfferingObject.md new file mode 100644 index 000000000000..ef875cc2b584 --- /dev/null +++ b/src/Security/Security.Autorest/examples/New-AzSecurityDefenderCspmAwsOfferingObject.md @@ -0,0 +1,36 @@ +### Example 1: Create new DefenderCspmAwsOffering object +```powershell +$arnPrefix = "arn:aws:iam::123456789012:role" +New-AzSecurityDefenderCspmAwsOfferingObject ` + -VMScannerEnabled $true -ConfigurationScanningMode Default -ConfigurationCloudRoleArn "$arnPrefix/DefenderForCloud-AgentlessScanner" -ConfigurationExclusionTag @{key="value"} ` + -DataSensitivityDiscoveryEnabled $true -DataSensitivityDiscoveryCloudRoleArn "$arnPrefix/SensitiveDataDiscovery" ` + -DatabaseDspmEnabled $true -DatabaseDspmCloudRoleArn "$arnPrefix/DefenderForCloud-DataSecurityPostureDB" ` + -CiemDiscoveryCloudRoleArn "$arnPrefix/DefenderForCloud-Ciem" -CiemOidcAzureActiveDirectoryAppName "mciem-aws-oidc-connector" -CiemOidcCloudRoleArn "$arnPrefix/DefenderForCloud-OidcCiem" ` + -MdcContainerImageAssessmentEnabled $true -MdcContainerImageAssessmentCloudRoleArn "$arnPrefix/MDCContainersImageAssessmentRole" ` + -MdcContainerAgentlessDiscoveryK8SEnabled $true -MdcContainerAgentlessDiscoveryK8SCloudRoleArn "$arnPrefix/MDCContainersAgentlessDiscoveryK8sRole" +``` + +```output +CiemDiscoveryCloudRoleArn : arn:aws:iam::123456789012:role/DefenderForCloud-Ciem +CiemOidcAzureActiveDirectoryAppName : mciem-aws-oidc-connector +CiemOidcCloudRoleArn : arn:aws:iam::123456789012:role/DefenderForCloud-OidcCiem +ConfigurationCloudRoleArn : arn:aws:iam::123456789012:role/DefenderForCloud-AgentlessScanner +ConfigurationExclusionTag : { + "key": "value" + } +ConfigurationScanningMode : Default +DataSensitivityDiscoveryCloudRoleArn : arn:aws:iam::123456789012:role/SensitiveDataDiscovery +DataSensitivityDiscoveryEnabled : True +DatabaseDspmCloudRoleArn : arn:aws:iam::123456789012:role/DefenderForCloud-DataSecurityPostureDB +DatabaseDspmEnabled : True +Description : +MdcContainerAgentlessDiscoveryK8SCloudRoleArn : arn:aws:iam::123456789012:role/MDCContainersAgentlessDiscoveryK8sRole +MdcContainerAgentlessDiscoveryK8SEnabled : True +MdcContainerImageAssessmentCloudRoleArn : arn:aws:iam::123456789012:role/MDCContainersImageAssessmentRole +MdcContainerImageAssessmentEnabled : True +OfferingType : DefenderCspmAws +VMScannerEnabled : True +``` + + + diff --git a/src/Security/Security.Autorest/examples/New-AzSecurityDefenderCspmGcpOfferingObject.md b/src/Security/Security.Autorest/examples/New-AzSecurityDefenderCspmGcpOfferingObject.md new file mode 100644 index 000000000000..5342b639af98 --- /dev/null +++ b/src/Security/Security.Autorest/examples/New-AzSecurityDefenderCspmGcpOfferingObject.md @@ -0,0 +1,33 @@ +### Example 1: Create new DefenderCspmGcpOffering object +```powershell +$emailSuffix = "myproject.iam.gserviceaccount.com" +New-AzSecurityDefenderCspmGcpOfferingObject ` + -VMScannerEnabled $true -ConfigurationScanningMode Default -ConfigurationExclusionTag @{key="value"} ` + -MdcContainerAgentlessDiscoveryK8SEnabled $true -MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress "mdc-containers-k8s-operator@$emailSuffix" -MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId "containers" ` + -MdcContainerImageAssessmentEnabled $true -MdcContainerImageAssessmentServiceAccountEmailAddress "mdc-containers-artifact-assess@$emailSuffix" -MdcContainerImageAssessmentWorkloadIdentityProviderId "containers" ` + -DataSensitivityDiscoveryEnabled $true -DataSensitivityDiscoveryServiceAccountEmailAddress "mdc-data-sec-posture-storage@$emailSuffix" -DataSensitivityDiscoveryWorkloadIdentityProviderId "data-security-posture-storage" ` + -CiemDiscoveryServiceAccountEmailAddress "microsoft-defender-ciem@$emailSuffix" -CiemDiscoveryAzureActiveDirectoryAppName "mciem-gcp-oidc-app" -CiemDiscoveryWorkloadIdentityProviderId "ciem-discovery" +``` + +```output +CiemDiscoveryAzureActiveDirectoryAppName : mciem-gcp-oidc-app +CiemDiscoveryServiceAccountEmailAddress : microsoft-defender-ciem@myproject.iam.gserviceaccount.com +CiemDiscoveryWorkloadIdentityProviderId : ciem-discovery +ConfigurationExclusionTag : { + "key": "value" + } +ConfigurationScanningMode : Default +DataSensitivityDiscoveryEnabled : True +DataSensitivityDiscoveryServiceAccountEmailAddress : mdc-data-sec-posture-storage@myproject.iam.gserviceaccount.com +DataSensitivityDiscoveryWorkloadIdentityProviderId : data-security-posture-storage +Description : +MdcContainerAgentlessDiscoveryK8SEnabled : True +MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress : mdc-containers-k8s-operator@myproject.iam.gserviceaccount.com +MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId : containers +MdcContainerImageAssessmentEnabled : True +MdcContainerImageAssessmentServiceAccountEmailAddress : mdc-containers-artifact-assess@myproject.iam.gserviceaccount.com +MdcContainerImageAssessmentWorkloadIdentityProviderId : containers +OfferingType : DefenderCspmGcp +VMScannerEnabled : True +``` + diff --git a/src/Security/Security.Autorest/examples/New-AzSecurityDefenderForContainersAwsOfferingObject.md b/src/Security/Security.Autorest/examples/New-AzSecurityDefenderForContainersAwsOfferingObject.md new file mode 100644 index 000000000000..942f10da412b --- /dev/null +++ b/src/Security/Security.Autorest/examples/New-AzSecurityDefenderForContainersAwsOfferingObject.md @@ -0,0 +1,33 @@ +### Example 1: Create new DefenderForContainersAwsOffering object +```powershell +$arnPrefix = "arn:aws:iam::123456789012:role" +New-AzSecurityDefenderForContainersAwsOfferingObject ` + -AutoProvisioning $true -KuberneteServiceCloudRoleArn "$arnPrefix/DefenderForCloud-Containers-K8s" -KuberneteScubaReaderCloudRoleArn "$arnPrefix/DefenderForCloud-DataCollection" ` + -KinesiToS3CloudRoleArn "$arnPrefix/DefenderForCloud-Containers-K8s-kinesis-to-s3" -CloudWatchToKinesiCloudRoleArn "$arnPrefix/DefenderForCloud-Containers-K8s-cloudwatch-to-kinesis" ` + -KubeAuditRetentionTime 30 -ScubaExternalId "a47ae0a2-7bf7-482a-897a-7a139d30736c" ` + -MdcContainerAgentlessDiscoveryK8SEnabled $true -MdcContainerAgentlessDiscoveryK8SCloudRoleArn "$arnPrefix/MDCContainersAgentlessDiscoveryK8sRole" ` + -MdcContainerImageAssessmentEnabled $true -MdcContainerImageAssessmentCloudRoleArn "$arnPrefix/MDCContainersImageAssessmentRole" ` + -EnableContainerVulnerabilityAssessment $false +``` + +```output +AutoProvisioning : True +CloudWatchToKinesiCloudRoleArn : arn:aws:iam::123456789012:role/DefenderForCloud-Containers-K8s-cloudwatch-to-kinesis +ContainerVulnerabilityAssessmentCloudRoleArn : +ContainerVulnerabilityAssessmentTaskCloudRoleArn : +Description : +EnableContainerVulnerabilityAssessment : False +KinesiToS3CloudRoleArn : arn:aws:iam::123456789012:role/DefenderForCloud-Containers-K8s-kinesis-to-s3 +KubeAuditRetentionTime : 30 +KuberneteScubaReaderCloudRoleArn : arn:aws:iam::123456789012:role/DefenderForCloud-DataCollection +KuberneteServiceCloudRoleArn : arn:aws:iam::123456789012:role/DefenderForCloud-Containers-K8s +MdcContainerAgentlessDiscoveryK8SCloudRoleArn : arn:aws:iam::123456789012:role/MDCContainersAgentlessDiscoveryK8sRole +MdcContainerAgentlessDiscoveryK8SEnabled : True +MdcContainerImageAssessmentCloudRoleArn : arn:aws:iam::123456789012:role/MDCContainersImageAssessmentRole +MdcContainerImageAssessmentEnabled : True +OfferingType : DefenderForContainersAws +ScubaExternalId : a47ae0a2-7bf7-482a-897a-7a139d30736c +``` + + + diff --git a/src/Security/Security.Autorest/examples/New-AzSecurityDefenderForContainersGcpOfferingObject.md b/src/Security/Security.Autorest/examples/New-AzSecurityDefenderForContainersGcpOfferingObject.md new file mode 100644 index 000000000000..165ec4ccc892 --- /dev/null +++ b/src/Security/Security.Autorest/examples/New-AzSecurityDefenderForContainersGcpOfferingObject.md @@ -0,0 +1,29 @@ +### Example 1: Create new DefenderForContainersGcpOffering object +```powershell +$emailSuffix = "myproject.iam.gserviceaccount.com" +New-AzSecurityDefenderForContainersGcpOfferingObject ` + -NativeCloudConnectionServiceAccountEmailAddress "microsoft-defender-containers@$emailSuffix" -NativeCloudConnectionWorkloadIdentityProviderId "containers" ` + -DataPipelineNativeCloudConnectionServiceAccountEmailAddress "ms-defender-containers-stream@$emailSuffix" -DataPipelineNativeCloudConnectionWorkloadIdentityProviderId "containers-streams" ` + -AuditLogsAutoProvisioningFlag $true -DefenderAgentAutoProvisioningFlag $true -PolicyAgentAutoProvisioningFlag $true ` + -MdcContainerAgentlessDiscoveryK8SEnabled $true -MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId "containers" -MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress "mdc-containers-k8s-operator@$emailSuffix" ` + -MdcContainerImageAssessmentEnabled $true -MdcContainerImageAssessmentWorkloadIdentityProviderId "containers" -MdcContainerImageAssessmentServiceAccountEmailAddress "mdc-containers-artifact-assess@$emailSuffix" +``` + +```output +AuditLogsAutoProvisioningFlag : True +DataPipelineNativeCloudConnectionServiceAccountEmailAddress : ms-defender-containers-stream@myproject.iam.gserviceaccount.com +DataPipelineNativeCloudConnectionWorkloadIdentityProviderId : containers-streams +DefenderAgentAutoProvisioningFlag : True +Description : +MdcContainerAgentlessDiscoveryK8SEnabled : True +MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress : mdc-containers-k8s-operator@myproject.iam.gserviceaccount.com +MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId : containers +MdcContainerImageAssessmentEnabled : True +MdcContainerImageAssessmentServiceAccountEmailAddress : mdc-containers-artifact-assess@myproject.iam.gserviceaccount.com +MdcContainerImageAssessmentWorkloadIdentityProviderId : containers +NativeCloudConnectionServiceAccountEmailAddress : microsoft-defender-containers@myproject.iam.gserviceaccount.com +NativeCloudConnectionWorkloadIdentityProviderId : containers +OfferingType : DefenderForContainersGcp +PolicyAgentAutoProvisioningFlag : True +``` + diff --git a/src/Security/Security.Autorest/examples/New-AzSecurityDefenderForDatabasesAwsOfferingObject.md b/src/Security/Security.Autorest/examples/New-AzSecurityDefenderForDatabasesAwsOfferingObject.md new file mode 100644 index 000000000000..554da8762f42 --- /dev/null +++ b/src/Security/Security.Autorest/examples/New-AzSecurityDefenderForDatabasesAwsOfferingObject.md @@ -0,0 +1,24 @@ +### Example 1: Create new DefenderForDatabasesAwsOffering object +```powershell +$arnPrefix = "arn:aws:iam::123456789012:role" +New-AzSecurityDefenderForDatabasesAwsOfferingObject ` + -ArcAutoProvisioningEnabled $true -ArcAutoProvisioningCloudRoleArn "$arnPrefix/DefenderForCloud-ArcAutoProvisioning" ` + -DatabaseDspmEnabled $true -DatabaseDspmCloudRoleArn "$arnPrefix/DefenderForCloud-DataSecurityPostureDB" + +``` + +```output +ArcAutoProvisioningCloudRoleArn : arn:aws:iam::123456789012:role/DefenderForCloud-ArcAutoProvisioning +ArcAutoProvisioningEnabled : True +ConfigurationPrivateLinkScope : +ConfigurationProxy : +DatabaseDspmCloudRoleArn : arn:aws:iam::123456789012:role/DefenderForCloud-DataSecurityPostureDB +DatabaseDspmEnabled : True +Description : +OfferingType : DefenderForDatabasesAws +RdCloudRoleArn : +RdEnabled : +``` + + + diff --git a/src/Security/Security.Autorest/examples/New-AzSecurityDefenderForDatabasesGcpOfferingObject.md b/src/Security/Security.Autorest/examples/New-AzSecurityDefenderForDatabasesGcpOfferingObject.md new file mode 100644 index 000000000000..a856a2af305d --- /dev/null +++ b/src/Security/Security.Autorest/examples/New-AzSecurityDefenderForDatabasesGcpOfferingObject.md @@ -0,0 +1,20 @@ +### Example 1: Create new DefenderForDatabasesGcpOffering object +```powershell +$emailSuffix = "myproject.iam.gserviceaccount.com" +New-AzSecurityDefenderForDatabasesGcpOfferingObject ` + -ArcAutoProvisioningEnabled $true ` + -DefenderForDatabaseArcAutoProvisioningServiceAccountEmailAddress "microsoft-databases-arc-ap@" -DefenderForDatabaseArcAutoProvisioningWorkloadIdentityProviderId "defender-for-databases-arc-ap" + +``` + +```output +ArcAutoProvisioningEnabled : True +ConfigurationPrivateLinkScope : +ConfigurationProxy : +DefenderForDatabaseArcAutoProvisioningServiceAccountEmailAddress : microsoft-databases-arc-ap@ +DefenderForDatabaseArcAutoProvisioningWorkloadIdentityProviderId : defender-for-databases-arc-ap +Description : +OfferingType : DefenderForDatabasesGcp +``` + + diff --git a/src/Security/Security.Autorest/examples/New-AzSecurityDefenderForServersAwsOfferingObject.md b/src/Security/Security.Autorest/examples/New-AzSecurityDefenderForServersAwsOfferingObject.md new file mode 100644 index 000000000000..1f74745d7067 --- /dev/null +++ b/src/Security/Security.Autorest/examples/New-AzSecurityDefenderForServersAwsOfferingObject.md @@ -0,0 +1,34 @@ +### Example 1: Create new DefenderForServersAwsOffering object +```powershell +$arnPrefix = "arn:aws:iam::123456789012:role" +New-AzSecurityDefenderForServersAwsOfferingObject ` + -DefenderForServerCloudRoleArn "$arnPrefix/DefenderForCloud-DefenderForServers" ` + -ArcAutoProvisioningEnabled $true -ArcAutoProvisioningCloudRoleArn "$arnPrefix/DefenderForCloud-ArcAutoProvisioning" ` + -MdeAutoProvisioningEnabled $true ` + -VaAutoProvisioningEnabled $true -ConfigurationType TVM ` + -VMScannerEnabled $true -ConfigurationCloudRoleArn "$arnPrefix/DefenderForCloud-AgentlessScanner" -ConfigurationScanningMode Default ` + -SubPlanType P2 +``` + +```output +ArcAutoProvisioningCloudRoleArn : arn:aws:iam::123456789012:role/DefenderForCloud-ArcAutoProvisioning +ArcAutoProvisioningEnabled : True +ConfigurationCloudRoleArn : arn:aws:iam::123456789012:role/DefenderForCloud-AgentlessScanner +ConfigurationExclusionTag : { + } +ConfigurationPrivateLinkScope : +ConfigurationProxy : +ConfigurationScanningMode : Default +ConfigurationType : TVM +DefenderForServerCloudRoleArn : arn:aws:iam::123456789012:role/DefenderForCloud-DefenderForServers +Description : +MdeAutoProvisioningConfiguration : { + } +MdeAutoProvisioningEnabled : True +OfferingType : DefenderForServersAws +SubPlanType : P2 +VMScannerEnabled : True +VaAutoProvisioningEnabled : True +``` + + diff --git a/src/Security/Security.Autorest/examples/New-AzSecurityDefenderForServersGcpOfferingObject.md b/src/Security/Security.Autorest/examples/New-AzSecurityDefenderForServersGcpOfferingObject.md new file mode 100644 index 000000000000..07810bdabb00 --- /dev/null +++ b/src/Security/Security.Autorest/examples/New-AzSecurityDefenderForServersGcpOfferingObject.md @@ -0,0 +1,30 @@ +### Example 1: Create new DefenderForServersGcpOffering object +```powershell +$emailSuffix = "myproject.iam.gserviceaccount.com" +New-AzSecurityDefenderForServersGcpOfferingObject ` + -DefenderForServerServiceAccountEmailAddress "microsoft-defender-for-servers@$emailSuffix" -DefenderForServerWorkloadIdentityProviderId "defender-for-servers" ` + -ArcAutoProvisioningEnabled $true -MdeAutoProvisioningEnabled $true -VaAutoProvisioningEnabled $true -ConfigurationType TVM ` + -VMScannerEnabled $true -ConfigurationScanningMode Default ` + -SubPlanType P2 +``` + +```output +ArcAutoProvisioningEnabled : True +ConfigurationExclusionTag : { + } +ConfigurationPrivateLinkScope : +ConfigurationProxy : +ConfigurationScanningMode : Default +ConfigurationType : TVM +DefenderForServerServiceAccountEmailAddress : microsoft-defender-for-servers@myproject.iam.gserviceaccount.com +DefenderForServerWorkloadIdentityProviderId : defender-for-servers +Description : +MdeAutoProvisioningConfiguration : { + } +MdeAutoProvisioningEnabled : True +OfferingType : DefenderForServersGcp +SubPlanType : P2 +VMScannerEnabled : True +VaAutoProvisioningEnabled : True +``` + diff --git a/src/Security/Security.Autorest/examples/New-AzSecurityGcpOrganizationalDataMemberObject.md b/src/Security/Security.Autorest/examples/New-AzSecurityGcpOrganizationalDataMemberObject.md new file mode 100644 index 000000000000..5e8ba6075e39 --- /dev/null +++ b/src/Security/Security.Autorest/examples/New-AzSecurityGcpOrganizationalDataMemberObject.md @@ -0,0 +1,12 @@ +### Example 1: Create new GcpOrganizationalDataMember object +```powershell +New-AzSecurityGcpOrganizationalDataMemberObject -ManagementProjectNumber "12345" -ParentHierarchyId "00000" +``` + +```output +ManagementProjectNumber OrganizationMembershipType ParentHierarchyId +----------------------- -------------------------- ----------------- +12345 Member 00000 +``` + + diff --git a/src/Security/Security.Autorest/examples/New-AzSecurityGcpOrganizationalDataOrganizationObject.md b/src/Security/Security.Autorest/examples/New-AzSecurityGcpOrganizationalDataOrganizationObject.md new file mode 100644 index 000000000000..2bfd6340ed94 --- /dev/null +++ b/src/Security/Security.Autorest/examples/New-AzSecurityGcpOrganizationalDataOrganizationObject.md @@ -0,0 +1,16 @@ +### Example 1: Create new GcpOrganizationalDataOrganization object +```powershell +New-AzSecurityGcpOrganizationalDataOrganizationObject -WorkloadIdentityProviderId "provider" -ServiceAccountEmailAddress "my@email.com" -ExcludedProjectNumber @(1,2) +``` + +```output +ExcludedProjectNumber : {1, 2} +OrganizationMembershipType : Organization +OrganizationName : +ServiceAccountEmailAddress : my@email.com +WorkloadIdentityProviderId : provider +``` + + + + diff --git a/src/Security/Security.Autorest/examples/New-AzSecurityGcpProjectEnvironmentObject.md b/src/Security/Security.Autorest/examples/New-AzSecurityGcpProjectEnvironmentObject.md new file mode 100644 index 000000000000..243a44be826d --- /dev/null +++ b/src/Security/Security.Autorest/examples/New-AzSecurityGcpProjectEnvironmentObject.md @@ -0,0 +1,22 @@ +### Example 1: Create new GcpOrganizationalDataOrganization object +```powershell +$orgData = New-AzSecurityGcpOrganizationalDataOrganizationObject -WorkloadIdentityProviderId "provider" -ServiceAccountEmailAddress "my@email.com" -ExcludedProjectNumber @(1,2) +New-AzSecurityGcpProjectEnvironmentObject -ProjectDetailProjectId "asc-sdk-samples" -ScanInterval 24 -OrganizationalData $orgData -ProjectDetailProjectNumber "1234" +``` + +```output +EnvironmentType : GcpProject +OrganizationalData : { + "organizationMembershipType": "Organization", + "excludedProjectNumbers": [ "1", "2" ], + "serviceAccountEmailAddress": "my@email.com", + "workloadIdentityProviderId": "provider" + } +ProjectDetailProjectId : asc-sdk-samples +ProjectDetailProjectName : +ProjectDetailProjectNumber : 1234 +ProjectDetailWorkloadIdentityPoolId : +ScanInterval : 24 +``` + + diff --git a/src/Security/Security.Autorest/examples/New-AzSecurityGitHubScopeEnvironmentObject.md b/src/Security/Security.Autorest/examples/New-AzSecurityGitHubScopeEnvironmentObject.md new file mode 100644 index 000000000000..4908c2465ad4 --- /dev/null +++ b/src/Security/Security.Autorest/examples/New-AzSecurityGitHubScopeEnvironmentObject.md @@ -0,0 +1,13 @@ +### Example 1: Create new GitHubScopeEnvironment object +```powershell +New-AzSecurityGitHubScopeEnvironmentObject +``` + +```output +EnvironmentType +--------------- +GithubScope +``` + + + diff --git a/src/Security/Security.Autorest/examples/New-AzSecurityGitLabScopeEnvironmentObject.md b/src/Security/Security.Autorest/examples/New-AzSecurityGitLabScopeEnvironmentObject.md new file mode 100644 index 000000000000..cffd06b19c8c --- /dev/null +++ b/src/Security/Security.Autorest/examples/New-AzSecurityGitLabScopeEnvironmentObject.md @@ -0,0 +1,11 @@ +### Example 1: Create new GitLabScopeEnvironment object +```powershell +New-AzSecurityGitLabScopeEnvironmentObject +``` + +```output +EnvironmentType +--------------- +GitlabScope +``` + diff --git a/src/Security/Security.Autorest/examples/New-AzSecurityInformationProtectionAwsOfferingObject.md b/src/Security/Security.Autorest/examples/New-AzSecurityInformationProtectionAwsOfferingObject.md new file mode 100644 index 000000000000..a5388db97142 --- /dev/null +++ b/src/Security/Security.Autorest/examples/New-AzSecurityInformationProtectionAwsOfferingObject.md @@ -0,0 +1,11 @@ +### Example 1: Create new InformationProtectionAwsOffering object +```powershell +New-AzSecurityInformationProtectionAwsOfferingObject -InformationProtectionCloudRoleArn "arn:aws:iam::123456789012:role/myRole" +``` + +```output +Description InformationProtectionCloudRoleArn OfferingType +----------- --------------------------------- ------------ + arn:aws:iam::123456789012:role/myRole InformationProtectionAws +``` + diff --git a/src/Security/Security.Autorest/examples/Remove-AzSecurityConnector.md b/src/Security/Security.Autorest/examples/Remove-AzSecurityConnector.md new file mode 100644 index 000000000000..115ae8a102e8 --- /dev/null +++ b/src/Security/Security.Autorest/examples/Remove-AzSecurityConnector.md @@ -0,0 +1,6 @@ +### Example 1: Remove security connector +```powershell +Remove-AzSecurityConnector -ResourceGroupName "securityconnectors-pwsh-tmp" -Name "ado-sdk-pwsh-test03" +``` + + diff --git a/src/Security/Security.Autorest/examples/Remove-AzSecurityConnectorDevOpsConfiguration.md b/src/Security/Security.Autorest/examples/Remove-AzSecurityConnectorDevOpsConfiguration.md new file mode 100644 index 000000000000..92432a984362 --- /dev/null +++ b/src/Security/Security.Autorest/examples/Remove-AzSecurityConnectorDevOpsConfiguration.md @@ -0,0 +1,5 @@ +### Example 1: Remove DevOps Configuration for the security connector +```powershell +Remove-AzSecurityConnectorDevOpsConfiguration -ResourceGroupName "securityconnectors-pwsh-tmp" -SecurityConnectorName "ado-sdk-pwsh-test03" +``` + diff --git a/src/Security/Security.Autorest/examples/Update-AzSecurityConnector.md b/src/Security/Security.Autorest/examples/Update-AzSecurityConnector.md new file mode 100644 index 000000000000..0f7f0acb872d --- /dev/null +++ b/src/Security/Security.Autorest/examples/Update-AzSecurityConnector.md @@ -0,0 +1,33 @@ +### Example 1: Update security connector +```powershell +Update-AzSecurityConnector -ResourceGroupName "securityConnectors-pwsh-tmp" -Name "ado-sdk-pwsh-test03" -Tag @{myTag="v1"} +``` + +```output +EnvironmentData : { + "environmentType": "AzureDevOpsScope" + } +EnvironmentName : AzureDevOps +Etag : +HierarchyIdentifier : 9dd01e19-8aaf-43a2-8dd4-1c5992f4df35 +HierarchyIdentifierTrialEndDate : +Id : /subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourcegroups/securityconnectors-pwsh-tmp/providers/Microsoft.Security/securityConnectors/ado-sdk-pwsh-test03 +Kind : +Location : CentralUS +Name : ado-sdk-pwsh-test03 +Offering : {{ + "offeringType": "CspmMonitorAzureDevOps" + }} +ResourceGroupName : securityconnectors-pwsh-tmp +SystemDataCreatedAt : 2/24/2024 12:13:11 AM +SystemDataCreatedBy : c3d82ccb-fee1-430c-949e-6c0a217c00a8 +SystemDataCreatedByType : Application +SystemDataLastModifiedAt : 2/24/2024 12:24:02 AM +SystemDataLastModifiedBy : c3d82ccb-fee1-430c-949e-6c0a217c00a8 +SystemDataLastModifiedByType : Application +Tag : { + "myTag": "v1" + } +Type : Microsoft.Security/securityconnectors +``` + diff --git a/src/Security/Security.Autorest/examples/Update-AzSecurityConnectorAzureDevOpsOrg.md b/src/Security/Security.Autorest/examples/Update-AzSecurityConnectorAzureDevOpsOrg.md new file mode 100644 index 000000000000..42db0a7eebc5 --- /dev/null +++ b/src/Security/Security.Autorest/examples/Update-AzSecurityConnectorAzureDevOpsOrg.md @@ -0,0 +1,39 @@ +### Example 1: Update discovered AzureDevOps organization configuration +```powershell +$config = New-AzSecurityConnectorActionableRemediationObject -State Enabled -InheritFromParentState Disabled -CategoryConfiguration @( @{category="IaC"; minimumSeverityLevel="High"}) +Update-AzSecurityConnectorAzureDevOpsOrg -ResourceGroupName "securityConnectors-pwsh-tmp" -SecurityConnectorName "ado-sdk-pwsh-test03" -OrgName "org1" -ActionableRemediation $config +``` + +```output +ActionableRemediation : { + "state": "Enabled", + "categoryConfigurations": [ + { + "minimumSeverityLevel": "High", + "category": "IaC" + } + ], + "branchConfiguration": { + "branchNames": [ ], + "annotateDefaultBranch": "Enabled" + }, + "inheritFromParentState": "Disabled" + } +Id : /subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/securityConnectors-pwsh-tmp/providers/Microsoft.Security/securityConnectors/ado-sdk-pwsh-test03/devops/default/azureDevOpsOrgs/org1 +Name : org1 +OnboardingState : Onboarded +ProvisioningState : Succeeded +ProvisioningStatusMessage : OK +ProvisioningStatusUpdateTimeUtc : 2/24/2024 12:28:16 AM +ResourceGroupName : securityConnectors-pwsh-tmp +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Type : Microsoft.Security/securityConnectors/devops/azureDevOpsOrgs +``` + + + diff --git a/src/Security/Security.Autorest/examples/Update-AzSecurityConnectorAzureDevOpsProject.md b/src/Security/Security.Autorest/examples/Update-AzSecurityConnectorAzureDevOpsProject.md new file mode 100644 index 000000000000..87c9cb57c427 --- /dev/null +++ b/src/Security/Security.Autorest/examples/Update-AzSecurityConnectorAzureDevOpsProject.md @@ -0,0 +1,42 @@ +### Example 1: Update discovered AzureDevOps project configuration +```powershell +$config = New-AzSecurityConnectorActionableRemediationObject -State Disabled -InheritFromParentState Disabled -CategoryConfiguration @( @{category="IaC"; minimumSeverityLevel="Low"}) +Update-AzSecurityConnectorAzureDevOpsProject -ResourceGroupName "securityConnectors-pwsh-tmp" -SecurityConnectorName "ado-sdk-pwsh-test03" -OrgName "org1" -ProjectName "Build" -ActionableRemediation $config +``` + +```output +ActionableRemediation : { + "state": "Disabled", + "categoryConfigurations": [ + { + "minimumSeverityLevel": "Low", + "category": "IaC" + } + ], + "branchConfiguration": { + "branchNames": [ ], + "annotateDefaultBranch": "Enabled" + }, + "inheritFromParentState": "Disabled" + } +Id : /subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/securityConnectors-pwsh-tmp/providers/Microsoft.Security/securityConnectors/ado-sdk-pwsh-test03/devops/default/azureDevOpsOrgs/org1/p + rojects/Build +Name : Build +OnboardingState : Onboarded +ParentOrgName : org1 +ProjectId : 68b6a6ae-a3e4-41fa-b16e-bc4bbacd139a +ProvisioningState : Succeeded +ProvisioningStatusMessage : OK +ProvisioningStatusUpdateTimeUtc : 2/24/2024 12:31:18 AM +ResourceGroupName : securityConnectors-pwsh-tmp +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Type : Microsoft.Security/securityConnectors/devops/azureDevOpsOrgs/projects +``` + + + diff --git a/src/Security/Security.Autorest/examples/Update-AzSecurityConnectorAzureDevOpsRepo.md b/src/Security/Security.Autorest/examples/Update-AzSecurityConnectorAzureDevOpsRepo.md new file mode 100644 index 000000000000..7defe2e75941 --- /dev/null +++ b/src/Security/Security.Autorest/examples/Update-AzSecurityConnectorAzureDevOpsRepo.md @@ -0,0 +1,44 @@ +### Example 1: Update discovered AzureDevOps repository configuration +```powershell +$config = New-AzSecurityConnectorActionableRemediationObject -State Enabled -InheritFromParentState Disabled -CategoryConfiguration @( @{category="IaC"; minimumSeverityLevel="Low"} ) +Update-AzSecurityConnectorAzureDevOpsRepo -ResourceGroupName "securityConnectors-pwsh-tmp" -SecurityConnectorName "ado-sdk-pwsh-test03" -OrgName "org1" -ProjectName "Build" -RepoName "Build" -ActionableRemediation $config +``` + +```output +ActionableRemediation : { + "state": "Enabled", + "categoryConfigurations": [ + { + "minimumSeverityLevel": "Low", + "category": "IaC" + } + ], + "branchConfiguration": { + "branchNames": [ ], + "annotateDefaultBranch": "Enabled" + }, + "inheritFromParentState": "Disabled" + } +Id : /subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/securityConnectors-pwsh-tmp/providers/Microsoft.Security/securityConnectors/ado-sdk-pwsh-test03/devops/default/azureDevOpsOrgs/org1/p + rojects/Build/repos/Build +Name : Build +OnboardingState : Onboarded +ParentOrgName : org1 +ParentProjectName : Build +ProvisioningState : Succeeded +ProvisioningStatusMessage : OK +ProvisioningStatusUpdateTimeUtc : 2/24/2024 12:31:19 AM +RepoId : 64d6ea8c-6030-44db-86a4-044f13a7f43e +RepoUrl : https://dev.azure.com/org1/Build/_git/Build +ResourceGroupName : securityConnectors-pwsh-tmp +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Type : Microsoft.Security/securityConnectors/devops/azureDevOpsOrgs/projects/repos +Visibility : +``` + + diff --git a/src/Security/Security.Autorest/examples/Update-AzSecurityConnectorDevOpsConfiguration.md b/src/Security/Security.Autorest/examples/Update-AzSecurityConnectorDevOpsConfiguration.md new file mode 100644 index 000000000000..1c38eebc05ff --- /dev/null +++ b/src/Security/Security.Autorest/examples/Update-AzSecurityConnectorDevOpsConfiguration.md @@ -0,0 +1,25 @@ +### Example 1: Update DevOps configuration +```powershell +Update-AzSecurityConnectorDevOpsConfiguration -ResourceGroupName "securityConnectors-pwsh-tmp" -SecurityConnectorName "ado-sdk-pwsh-test03" -AutoDiscovery Enabled +``` + +```output +AuthorizationCode : +AutoDiscovery : Enabled +Id : /subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/securityConnectors-pwsh-tmp/providers/Microsoft.Security/securityConnectors/ado-sdk-pwsh-test03/devops/default +Name : default +ProvisioningState : Succeeded +ProvisioningStatusMessage : Resource creation successful. +ProvisioningStatusUpdateTimeUtc : +ResourceGroupName : securityConnectors-pwsh-tmp +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +TopLevelInventoryList : +Type : Microsoft.Security/securityConnectors/devops +``` + + diff --git a/src/Security/Security.Autorest/export-surface.ps1 b/src/Security/Security.Autorest/export-surface.ps1 new file mode 100644 index 000000000000..13d3a0865ef1 --- /dev/null +++ b/src/Security/Security.Autorest/export-surface.ps1 @@ -0,0 +1,41 @@ +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- +param([switch]$NotIsolated, [switch]$IncludeGeneralParameters, [switch]$UseExpandedFormat) +$ErrorActionPreference = 'Stop' + +$pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path +if(-not $NotIsolated) { + Write-Host -ForegroundColor Green 'Creating isolated process...' + & "$pwsh" -NonInteractive -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -NotIsolated + return +} + +$dll = Join-Path $PSScriptRoot 'bin\Az.Security.private.dll' +if(-not (Test-Path $dll)) { + Write-Error "Unable to find output assembly in '$binFolder'." +} +$null = Import-Module -Name $dll + +$moduleName = 'Az.Security' +$exportsFolder = Join-Path $PSScriptRoot 'exports' +$resourcesFolder = Join-Path $PSScriptRoot 'resources' + +Export-CmdletSurface -ModuleName $moduleName -CmdletFolder $exportsFolder -OutputFolder $resourcesFolder -IncludeGeneralParameters $IncludeGeneralParameters.IsPresent -UseExpandedFormat $UseExpandedFormat.IsPresent +Write-Host -ForegroundColor Green "CmdletSurface file(s) created in '$resourcesFolder'" + +Export-ModelSurface -OutputFolder $resourcesFolder -UseExpandedFormat $UseExpandedFormat.IsPresent +Write-Host -ForegroundColor Green "ModelSurface file created in '$resourcesFolder'" + +Write-Host -ForegroundColor Green '-------------Done-------------' \ No newline at end of file diff --git a/src/Security/Security.Autorest/exports/Get-AzSecurityApiCollection.ps1 b/src/Security/Security.Autorest/exports/Get-AzSecurityApiCollection.ps1 new file mode 100644 index 000000000000..e05cadf22203 --- /dev/null +++ b/src/Security/Security.Autorest/exports/Get-AzSecurityApiCollection.ps1 @@ -0,0 +1,233 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Gets an Azure API Management API if it has been onboarded to Microsoft Defender for APIs. +If an Azure API Management API is onboarded to Microsoft Defender for APIs, the system will monitor the operations within the Azure API Management API for intrusive behaviors and provide alerts for attacks that have been detected. +.Description +Gets an Azure API Management API if it has been onboarded to Microsoft Defender for APIs. +If an Azure API Management API is onboarded to Microsoft Defender for APIs, the system will monitor the operations within the Azure API Management API for intrusive behaviors and provide alerts for attacks that have been detected. +.Example +Get-AzSecurityApiCollection -ResourceGroupName apicollectionstests -ServiceName "demoapimservice2" -ApiId "echo-api" +.Example +Get-AzSecurityApiCollection -ResourceGroupName "apicollectionstests" -ServiceName "demoapimservice2" +.Example +Get-AzSecurityApiCollection + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollection +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ApiId ]: API revision identifier. Must be unique in the API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + [GroupFqName ]: The GitLab group fully-qualified name. + [Id ]: Resource identity path + [OperationResultId ]: The operation result Id. + [OrgName ]: The Azure DevOps organization name. + [OwnerName ]: The GitHub owner name. + [ProjectName ]: The project name. + [RepoName ]: The repository name. + [ResourceGroupName ]: The name of the resource group within the user's subscription. The name is case insensitive. + [SecurityConnectorName ]: The security connector name. + [ServiceName ]: The name of the API Management service. + [SubscriptionId ]: Azure subscription ID +.Link +https://learn.microsoft.com/powershell/module/az.security/get-azsecurityapicollection +#> +function Get-AzSecurityApiCollection { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollection])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # API revision identifier. + # Must be unique in the API Management service instance. + # Non-current revision has ;rev=n as a suffix where n is the revision number. + ${ApiId}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List1', Mandatory)] + [Parameter(ParameterSetName='List2', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List2', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The name of the API Management service. + ${ServiceName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Parameter(ParameterSetName='List1')] + [Parameter(ParameterSetName='List2')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Azure subscription ID + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity] + # Identity Parameter + # . + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait forNET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.Security.private\Get-AzSecurityApiCollection_Get'; + GetViaIdentity = 'Az.Security.private\Get-AzSecurityApiCollection_GetViaIdentity'; + List = 'Az.Security.private\Get-AzSecurityApiCollection_List'; + List1 = 'Az.Security.private\Get-AzSecurityApiCollection_List1'; + List2 = 'Az.Security.private\Get-AzSecurityApiCollection_List2'; + } + if (('Get', 'List', 'List1', 'List2') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Security/Security.Autorest/exports/Get-AzSecurityConnector.ps1 b/src/Security/Security.Autorest/exports/Get-AzSecurityConnector.ps1 new file mode 100644 index 000000000000..523fb665ebac --- /dev/null +++ b/src/Security/Security.Autorest/exports/Get-AzSecurityConnector.ps1 @@ -0,0 +1,218 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Retrieves details of a specific security connector +.Description +Retrieves details of a specific security connector +.Example +Get-AzSecurityConnector -ResourceGroupName "dfdtest-sdk" -Name "dfdsdktests-azdo-01" +.Example +Get-AzSecurityConnector + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnector +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ApiId ]: API revision identifier. Must be unique in the API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + [GroupFqName ]: The GitLab group fully-qualified name. + [Id ]: Resource identity path + [OperationResultId ]: The operation result Id. + [OrgName ]: The Azure DevOps organization name. + [OwnerName ]: The GitHub owner name. + [ProjectName ]: The project name. + [RepoName ]: The repository name. + [ResourceGroupName ]: The name of the resource group within the user's subscription. The name is case insensitive. + [SecurityConnectorName ]: The security connector name. + [ServiceName ]: The name of the API Management service. + [SubscriptionId ]: Azure subscription ID +.Link +https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnector +#> +function Get-AzSecurityConnector { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnector])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Alias('SecurityConnectorName')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The security connector name. + ${Name}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List1', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The name of the resource group within the user's subscription. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Parameter(ParameterSetName='List1')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Azure subscription ID + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity] + # Identity Parameter + # . + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait forNET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.Security.private\Get-AzSecurityConnector_Get'; + GetViaIdentity = 'Az.Security.private\Get-AzSecurityConnector_GetViaIdentity'; + List = 'Az.Security.private\Get-AzSecurityConnector_List'; + List1 = 'Az.Security.private\Get-AzSecurityConnector_List1'; + } + if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Security/Security.Autorest/exports/Get-AzSecurityConnectorAzureDevOpsOrg.ps1 b/src/Security/Security.Autorest/exports/Get-AzSecurityConnectorAzureDevOpsOrg.ps1 new file mode 100644 index 000000000000..75e9cd6589dc --- /dev/null +++ b/src/Security/Security.Autorest/exports/Get-AzSecurityConnectorAzureDevOpsOrg.ps1 @@ -0,0 +1,222 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Returns a monitored Azure DevOps organization resource. +.Description +Returns a monitored Azure DevOps organization resource. +.Example +Get-AzSecurityConnectorAzureDevOpsOrg -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-azdo-01 -OrgName dfdsdktests +.Example +Get-AzSecurityConnectorAzureDevOpsOrg -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-azdo-01 + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrg +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ApiId ]: API revision identifier. Must be unique in the API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + [GroupFqName ]: The GitLab group fully-qualified name. + [Id ]: Resource identity path + [OperationResultId ]: The operation result Id. + [OrgName ]: The Azure DevOps organization name. + [OwnerName ]: The GitHub owner name. + [ProjectName ]: The project name. + [RepoName ]: The repository name. + [ResourceGroupName ]: The name of the resource group within the user's subscription. The name is case insensitive. + [SecurityConnectorName ]: The security connector name. + [ServiceName ]: The name of the API Management service. + [SubscriptionId ]: Azure subscription ID +.Link +https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorazuredevopsorg +#> +function Get-AzSecurityConnectorAzureDevOpsOrg { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrg])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The Azure DevOps organization name. + ${OrgName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The security connector name. + ${SecurityConnectorName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Azure subscription ID + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity] + # Identity Parameter + # . + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait forNET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.Security.private\Get-AzSecurityConnectorAzureDevOpsOrg_Get'; + GetViaIdentity = 'Az.Security.private\Get-AzSecurityConnectorAzureDevOpsOrg_GetViaIdentity'; + List = 'Az.Security.private\Get-AzSecurityConnectorAzureDevOpsOrg_List'; + } + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Security/Security.Autorest/exports/Get-AzSecurityConnectorAzureDevOpsOrgAvailable.ps1 b/src/Security/Security.Autorest/exports/Get-AzSecurityConnectorAzureDevOpsOrgAvailable.ps1 new file mode 100644 index 000000000000..67cca7c4621c --- /dev/null +++ b/src/Security/Security.Autorest/exports/Get-AzSecurityConnectorAzureDevOpsOrgAvailable.ps1 @@ -0,0 +1,182 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Returns a list of all Azure DevOps organizations accessible by the user token consumed by the connector. +.Description +Returns a list of all Azure DevOps organizations accessible by the user token consumed by the connector. +.Example +Get-AzSecurityConnectorAzureDevOpsOrgAvailable -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-azdo-01 + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgListResponse +.Link +https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorazuredevopsorgavailable +#> +function Get-AzSecurityConnectorAzureDevOpsOrgAvailable { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgListResponse])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The security connector name. + ${SecurityConnectorName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Azure subscription ID + ${SubscriptionId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait forNET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + List = 'Az.Security.private\Get-AzSecurityConnectorAzureDevOpsOrgAvailable_List'; + } + if (('List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Security/Security.Autorest/exports/Get-AzSecurityConnectorAzureDevOpsProject.ps1 b/src/Security/Security.Autorest/exports/Get-AzSecurityConnectorAzureDevOpsProject.ps1 new file mode 100644 index 000000000000..61415e64f4d3 --- /dev/null +++ b/src/Security/Security.Autorest/exports/Get-AzSecurityConnectorAzureDevOpsProject.ps1 @@ -0,0 +1,229 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Returns a monitored Azure DevOps project resource. +.Description +Returns a monitored Azure DevOps project resource. +.Example +Get-AzSecurityConnectorAzureDevOpsProject -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-azdo-01 -OrgName dfdsdktests -ProjectName ContosoSDKDfd +.Example +Get-AzSecurityConnectorAzureDevOpsProject -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-azdo-01 -OrgName dfdsdktests + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProject +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ApiId ]: API revision identifier. Must be unique in the API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + [GroupFqName ]: The GitLab group fully-qualified name. + [Id ]: Resource identity path + [OperationResultId ]: The operation result Id. + [OrgName ]: The Azure DevOps organization name. + [OwnerName ]: The GitHub owner name. + [ProjectName ]: The project name. + [RepoName ]: The repository name. + [ResourceGroupName ]: The name of the resource group within the user's subscription. The name is case insensitive. + [SecurityConnectorName ]: The security connector name. + [ServiceName ]: The name of the API Management service. + [SubscriptionId ]: Azure subscription ID +.Link +https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorazuredevopsproject +#> +function Get-AzSecurityConnectorAzureDevOpsProject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProject])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The Azure DevOps organization name. + ${OrgName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The project name. + ${ProjectName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The security connector name. + ${SecurityConnectorName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Azure subscription ID + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity] + # Identity Parameter + # . + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait forNET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.Security.private\Get-AzSecurityConnectorAzureDevOpsProject_Get'; + GetViaIdentity = 'Az.Security.private\Get-AzSecurityConnectorAzureDevOpsProject_GetViaIdentity'; + List = 'Az.Security.private\Get-AzSecurityConnectorAzureDevOpsProject_List'; + } + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Security/Security.Autorest/exports/Get-AzSecurityConnectorAzureDevOpsRepo.ps1 b/src/Security/Security.Autorest/exports/Get-AzSecurityConnectorAzureDevOpsRepo.ps1 new file mode 100644 index 000000000000..93991b572dc7 --- /dev/null +++ b/src/Security/Security.Autorest/exports/Get-AzSecurityConnectorAzureDevOpsRepo.ps1 @@ -0,0 +1,236 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Returns a monitored Azure DevOps repository resource. +.Description +Returns a monitored Azure DevOps repository resource. +.Example +Get-AzSecurityConnectorAzureDevOpsRepo -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-azdo-01 -OrgName dfdsdktests -ProjectName ContosoSDKDfd -RepoName TestApp0 +.Example +Get-AzSecurityConnectorAzureDevOpsRepo -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-azdo-01 -OrgName dfdsdktests -ProjectName ContosoSDKDfd + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepository +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ApiId ]: API revision identifier. Must be unique in the API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + [GroupFqName ]: The GitLab group fully-qualified name. + [Id ]: Resource identity path + [OperationResultId ]: The operation result Id. + [OrgName ]: The Azure DevOps organization name. + [OwnerName ]: The GitHub owner name. + [ProjectName ]: The project name. + [RepoName ]: The repository name. + [ResourceGroupName ]: The name of the resource group within the user's subscription. The name is case insensitive. + [SecurityConnectorName ]: The security connector name. + [ServiceName ]: The name of the API Management service. + [SubscriptionId ]: Azure subscription ID +.Link +https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorazuredevopsrepo +#> +function Get-AzSecurityConnectorAzureDevOpsRepo { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepository])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The Azure DevOps organization name. + ${OrgName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The project name. + ${ProjectName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The repository name. + ${RepoName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The security connector name. + ${SecurityConnectorName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Azure subscription ID + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity] + # Identity Parameter + # . + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait forNET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.Security.private\Get-AzSecurityConnectorAzureDevOpsRepo_Get'; + GetViaIdentity = 'Az.Security.private\Get-AzSecurityConnectorAzureDevOpsRepo_GetViaIdentity'; + List = 'Az.Security.private\Get-AzSecurityConnectorAzureDevOpsRepo_List'; + } + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Security/Security.Autorest/exports/Get-AzSecurityConnectorDevOpsConfiguration.ps1 b/src/Security/Security.Autorest/exports/Get-AzSecurityConnectorDevOpsConfiguration.ps1 new file mode 100644 index 000000000000..fe82a1bb128b --- /dev/null +++ b/src/Security/Security.Autorest/exports/Get-AzSecurityConnectorDevOpsConfiguration.ps1 @@ -0,0 +1,216 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Gets a DevOps Configuration. +.Description +Gets a DevOps Configuration. +.Example +Get-AzSecurityConnectorDevOpsConfiguration -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-azdo-01 +.Example +Get-AzSecurityConnectorDevOpsConfiguration -ResourceGroupName securityconnectors-tests -SecurityConnectorName aws-sdktest01 + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfiguration +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ApiId ]: API revision identifier. Must be unique in the API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + [GroupFqName ]: The GitLab group fully-qualified name. + [Id ]: Resource identity path + [OperationResultId ]: The operation result Id. + [OrgName ]: The Azure DevOps organization name. + [OwnerName ]: The GitHub owner name. + [ProjectName ]: The project name. + [RepoName ]: The repository name. + [ResourceGroupName ]: The name of the resource group within the user's subscription. The name is case insensitive. + [SecurityConnectorName ]: The security connector name. + [ServiceName ]: The name of the API Management service. + [SubscriptionId ]: Azure subscription ID +.Link +https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectordevopsconfiguration +#> +function Get-AzSecurityConnectorDevOpsConfiguration { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfiguration])] +[CmdletBinding(DefaultParameterSetName='Get', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The security connector name. + ${SecurityConnectorName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Azure subscription ID + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity] + # Identity Parameter + # . + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait forNET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.Security.private\Get-AzSecurityConnectorDevOpsConfiguration_Get'; + GetViaIdentity = 'Az.Security.private\Get-AzSecurityConnectorDevOpsConfiguration_GetViaIdentity'; + List = 'Az.Security.private\Get-AzSecurityConnectorDevOpsConfiguration_List'; + } + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Security/Security.Autorest/exports/Get-AzSecurityConnectorGitHubOwner.ps1 b/src/Security/Security.Autorest/exports/Get-AzSecurityConnectorGitHubOwner.ps1 new file mode 100644 index 000000000000..36ffea285b5f --- /dev/null +++ b/src/Security/Security.Autorest/exports/Get-AzSecurityConnectorGitHubOwner.ps1 @@ -0,0 +1,222 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Returns a monitored GitHub owner. +.Description +Returns a monitored GitHub owner. +.Example +Get-AzSecurityConnectorGitHubOwner -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-gh-01 -OwnerName dfdsdktests +.Example +Get-AzSecurityConnectorGitHubOwner -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-gh-01 + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwner +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ApiId ]: API revision identifier. Must be unique in the API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + [GroupFqName ]: The GitLab group fully-qualified name. + [Id ]: Resource identity path + [OperationResultId ]: The operation result Id. + [OrgName ]: The Azure DevOps organization name. + [OwnerName ]: The GitHub owner name. + [ProjectName ]: The project name. + [RepoName ]: The repository name. + [ResourceGroupName ]: The name of the resource group within the user's subscription. The name is case insensitive. + [SecurityConnectorName ]: The security connector name. + [ServiceName ]: The name of the API Management service. + [SubscriptionId ]: Azure subscription ID +.Link +https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorgithubowner +#> +function Get-AzSecurityConnectorGitHubOwner { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwner])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The GitHub owner name. + ${OwnerName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The security connector name. + ${SecurityConnectorName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Azure subscription ID + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity] + # Identity Parameter + # . + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait forNET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.Security.private\Get-AzSecurityConnectorGitHubOwner_Get'; + GetViaIdentity = 'Az.Security.private\Get-AzSecurityConnectorGitHubOwner_GetViaIdentity'; + List = 'Az.Security.private\Get-AzSecurityConnectorGitHubOwner_List'; + } + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Security/Security.Autorest/exports/Get-AzSecurityConnectorGitHubOwnerAvailable.ps1 b/src/Security/Security.Autorest/exports/Get-AzSecurityConnectorGitHubOwnerAvailable.ps1 new file mode 100644 index 000000000000..8279f58f3faf --- /dev/null +++ b/src/Security/Security.Autorest/exports/Get-AzSecurityConnectorGitHubOwnerAvailable.ps1 @@ -0,0 +1,182 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Returns a list of all GitHub owners accessible by the user token consumed by the connector. +.Description +Returns a list of all GitHub owners accessible by the user token consumed by the connector. +.Example +Get-AzSecurityConnectorGitHubOwnerAvailable -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-gh-01 + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerListResponse +.Link +https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorgithubowneravailable +#> +function Get-AzSecurityConnectorGitHubOwnerAvailable { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerListResponse])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The security connector name. + ${SecurityConnectorName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Azure subscription ID + ${SubscriptionId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait forNET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + List = 'Az.Security.private\Get-AzSecurityConnectorGitHubOwnerAvailable_List'; + } + if (('List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Security/Security.Autorest/exports/Get-AzSecurityConnectorGitHubRepo.ps1 b/src/Security/Security.Autorest/exports/Get-AzSecurityConnectorGitHubRepo.ps1 new file mode 100644 index 000000000000..b8fcd750d954 --- /dev/null +++ b/src/Security/Security.Autorest/exports/Get-AzSecurityConnectorGitHubRepo.ps1 @@ -0,0 +1,229 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Returns a monitored GitHub repository. +.Description +Returns a monitored GitHub repository. +.Example +Get-AzSecurityConnectorGitHubRepo -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-gh-01 -OwnerName dfdsdktests -RepoName TestApp0 +.Example +Get-AzSecurityConnectorGitHubRepo -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-gh-01 -OwnerName dfdsdktests + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepository +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ApiId ]: API revision identifier. Must be unique in the API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + [GroupFqName ]: The GitLab group fully-qualified name. + [Id ]: Resource identity path + [OperationResultId ]: The operation result Id. + [OrgName ]: The Azure DevOps organization name. + [OwnerName ]: The GitHub owner name. + [ProjectName ]: The project name. + [RepoName ]: The repository name. + [ResourceGroupName ]: The name of the resource group within the user's subscription. The name is case insensitive. + [SecurityConnectorName ]: The security connector name. + [ServiceName ]: The name of the API Management service. + [SubscriptionId ]: Azure subscription ID +.Link +https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorgithubrepo +#> +function Get-AzSecurityConnectorGitHubRepo { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepository])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The GitHub owner name. + ${OwnerName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The repository name. + ${RepoName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The security connector name. + ${SecurityConnectorName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Azure subscription ID + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity] + # Identity Parameter + # . + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait forNET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.Security.private\Get-AzSecurityConnectorGitHubRepo_Get'; + GetViaIdentity = 'Az.Security.private\Get-AzSecurityConnectorGitHubRepo_GetViaIdentity'; + List = 'Az.Security.private\Get-AzSecurityConnectorGitHubRepo_List'; + } + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Security/Security.Autorest/exports/Get-AzSecurityConnectorGitLabGroup.ps1 b/src/Security/Security.Autorest/exports/Get-AzSecurityConnectorGitLabGroup.ps1 new file mode 100644 index 000000000000..abd2deeddaaf --- /dev/null +++ b/src/Security/Security.Autorest/exports/Get-AzSecurityConnectorGitLabGroup.ps1 @@ -0,0 +1,222 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Returns a monitored GitLab Group resource for a given fully-qualified name. +.Description +Returns a monitored GitLab Group resource for a given fully-qualified name. +.Example +Get-AzSecurityConnectorGitLabGroup -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-gl-01 -GroupFqName dfdsdktests +.Example +Get-AzSecurityConnectorGitLabGroup -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-gl-01 + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroup +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ApiId ]: API revision identifier. Must be unique in the API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + [GroupFqName ]: The GitLab group fully-qualified name. + [Id ]: Resource identity path + [OperationResultId ]: The operation result Id. + [OrgName ]: The Azure DevOps organization name. + [OwnerName ]: The GitHub owner name. + [ProjectName ]: The project name. + [RepoName ]: The repository name. + [ResourceGroupName ]: The name of the resource group within the user's subscription. The name is case insensitive. + [SecurityConnectorName ]: The security connector name. + [ServiceName ]: The name of the API Management service. + [SubscriptionId ]: Azure subscription ID +.Link +https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorgitlabgroup +#> +function Get-AzSecurityConnectorGitLabGroup { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroup])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The GitLab group fully-qualified name. + ${GroupFqName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The security connector name. + ${SecurityConnectorName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Azure subscription ID + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity] + # Identity Parameter + # . + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait forNET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.Security.private\Get-AzSecurityConnectorGitLabGroup_Get'; + GetViaIdentity = 'Az.Security.private\Get-AzSecurityConnectorGitLabGroup_GetViaIdentity'; + List = 'Az.Security.private\Get-AzSecurityConnectorGitLabGroup_List'; + } + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Security/Security.Autorest/exports/Get-AzSecurityConnectorGitLabGroupAvailable.ps1 b/src/Security/Security.Autorest/exports/Get-AzSecurityConnectorGitLabGroupAvailable.ps1 new file mode 100644 index 000000000000..4201fee40ed2 --- /dev/null +++ b/src/Security/Security.Autorest/exports/Get-AzSecurityConnectorGitLabGroupAvailable.ps1 @@ -0,0 +1,182 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Returns a list of all GitLab groups accessible by the user token consumed by the connector. +.Description +Returns a list of all GitLab groups accessible by the user token consumed by the connector. +.Example +Get-AzSecurityConnectorGitLabGroupAvailable -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-gl-01 + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupListResponse +.Link +https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorgitlabgroupavailable +#> +function Get-AzSecurityConnectorGitLabGroupAvailable { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupListResponse])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The security connector name. + ${SecurityConnectorName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Azure subscription ID + ${SubscriptionId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait forNET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + List = 'Az.Security.private\Get-AzSecurityConnectorGitLabGroupAvailable_List'; + } + if (('List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Security/Security.Autorest/exports/Get-AzSecurityConnectorGitLabProject.ps1 b/src/Security/Security.Autorest/exports/Get-AzSecurityConnectorGitLabProject.ps1 new file mode 100644 index 000000000000..1e88fa302c9c --- /dev/null +++ b/src/Security/Security.Autorest/exports/Get-AzSecurityConnectorGitLabProject.ps1 @@ -0,0 +1,229 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Returns a monitored GitLab Project resource for a given fully-qualified group name and project name. +.Description +Returns a monitored GitLab Project resource for a given fully-qualified group name and project name. +.Example +Get-AzSecurityConnectorGitLabProject -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-gl-01 -GroupFqName dfdsdktests -ProjectName testapp0 +.Example +Get-AzSecurityConnectorGitLabProject -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-gl-01 -GroupFqName dfdsdktests + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProject +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ApiId ]: API revision identifier. Must be unique in the API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + [GroupFqName ]: The GitLab group fully-qualified name. + [Id ]: Resource identity path + [OperationResultId ]: The operation result Id. + [OrgName ]: The Azure DevOps organization name. + [OwnerName ]: The GitHub owner name. + [ProjectName ]: The project name. + [RepoName ]: The repository name. + [ResourceGroupName ]: The name of the resource group within the user's subscription. The name is case insensitive. + [SecurityConnectorName ]: The security connector name. + [ServiceName ]: The name of the API Management service. + [SubscriptionId ]: Azure subscription ID +.Link +https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorgitlabproject +#> +function Get-AzSecurityConnectorGitLabProject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProject])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The GitLab group fully-qualified name. + ${GroupFqName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The project name. + ${ProjectName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The security connector name. + ${SecurityConnectorName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Azure subscription ID + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity] + # Identity Parameter + # . + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait forNET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.Security.private\Get-AzSecurityConnectorGitLabProject_Get'; + GetViaIdentity = 'Az.Security.private\Get-AzSecurityConnectorGitLabProject_GetViaIdentity'; + List = 'Az.Security.private\Get-AzSecurityConnectorGitLabProject_List'; + } + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Security/Security.Autorest/exports/Get-AzSecurityConnectorGitLabSubgroup.ps1 b/src/Security/Security.Autorest/exports/Get-AzSecurityConnectorGitLabSubgroup.ps1 new file mode 100644 index 000000000000..6851570a7ac6 --- /dev/null +++ b/src/Security/Security.Autorest/exports/Get-AzSecurityConnectorGitLabSubgroup.ps1 @@ -0,0 +1,188 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Gets nested subgroups of given GitLab Group which are onboarded to the connector. +.Description +Gets nested subgroups of given GitLab Group which are onboarded to the connector. +.Example +Get-AzSecurityConnectorGitLabSubgroup -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-gl-01 -GroupFqName dfdsdktests + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupListResponse +.Link +https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorgitlabsubgroup +#> +function Get-AzSecurityConnectorGitLabSubgroup { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupListResponse])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The GitLab group fully-qualified name. + ${GroupFqName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The security connector name. + ${SecurityConnectorName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Azure subscription ID + ${SubscriptionId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait forNET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + List = 'Az.Security.private\Get-AzSecurityConnectorGitLabSubgroup_List'; + } + if (('List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Security/Security.Autorest/exports/Invoke-AzSecurityApiCollectionApimOffboard.ps1 b/src/Security/Security.Autorest/exports/Invoke-AzSecurityApiCollectionApimOffboard.ps1 new file mode 100644 index 000000000000..12394b2561ea --- /dev/null +++ b/src/Security/Security.Autorest/exports/Invoke-AzSecurityApiCollectionApimOffboard.ps1 @@ -0,0 +1,226 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Offboard an Azure API Management API from Microsoft Defender for APIs. +The system will stop monitoring the operations within the Azure API Management API for intrusive behaviors. +.Description +Offboard an Azure API Management API from Microsoft Defender for APIs. +The system will stop monitoring the operations within the Azure API Management API for intrusive behaviors. +.Example +Invoke-AzSecurityApiCollectionApimOffboard -ResourceGroupName "apicollectionstests" -ServiceName "demoapimservice2" -ApiId "echo-api-2" + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ApiId ]: API revision identifier. Must be unique in the API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + [GroupFqName ]: The GitLab group fully-qualified name. + [Id ]: Resource identity path + [OperationResultId ]: The operation result Id. + [OrgName ]: The Azure DevOps organization name. + [OwnerName ]: The GitHub owner name. + [ProjectName ]: The project name. + [RepoName ]: The repository name. + [ResourceGroupName ]: The name of the resource group within the user's subscription. The name is case insensitive. + [SecurityConnectorName ]: The security connector name. + [ServiceName ]: The name of the API Management service. + [SubscriptionId ]: Azure subscription ID +.Link +https://learn.microsoft.com/powershell/module/az.security/invoke-azsecurityapicollectionapimoffboard +#> +function Invoke-AzSecurityApiCollectionApimOffboard { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # API revision identifier. + # Must be unique in the API Management service instance. + # Non-current revision has ;rev=n as a suffix where n is the revision number. + ${ApiId}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The name of the API Management service. + ${ServiceName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Azure subscription ID + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity] + # Identity Parameter + # . + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait forNET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Delete = 'Az.Security.private\Invoke-AzSecurityApiCollectionApimOffboard_Delete'; + DeleteViaIdentity = 'Az.Security.private\Invoke-AzSecurityApiCollectionApimOffboard_DeleteViaIdentity'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Security/Security.Autorest/exports/Invoke-AzSecurityApiCollectionApimOnboard.ps1 b/src/Security/Security.Autorest/exports/Invoke-AzSecurityApiCollectionApimOnboard.ps1 new file mode 100644 index 000000000000..3b04afa2c9c0 --- /dev/null +++ b/src/Security/Security.Autorest/exports/Invoke-AzSecurityApiCollectionApimOnboard.ps1 @@ -0,0 +1,232 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Onboard an Azure API Management API to Microsoft Defender for APIs. +The system will start monitoring the operations within the Azure Management API for intrusive behaviors and provide alerts for attacks that have been detected. +.Description +Onboard an Azure API Management API to Microsoft Defender for APIs. +The system will start monitoring the operations within the Azure Management API for intrusive behaviors and provide alerts for attacks that have been detected. +.Example +Invoke-AzSecurityApiCollectionApimOnboard -ResourceGroupName "apicollectionstests" -ServiceName "demoapimservice2" -ApiId "echo-api-2" + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollection +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ApiId ]: API revision identifier. Must be unique in the API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + [GroupFqName ]: The GitLab group fully-qualified name. + [Id ]: Resource identity path + [OperationResultId ]: The operation result Id. + [OrgName ]: The Azure DevOps organization name. + [OwnerName ]: The GitHub owner name. + [ProjectName ]: The project name. + [RepoName ]: The repository name. + [ResourceGroupName ]: The name of the resource group within the user's subscription. The name is case insensitive. + [SecurityConnectorName ]: The security connector name. + [ServiceName ]: The name of the API Management service. + [SubscriptionId ]: Azure subscription ID +.Link +https://learn.microsoft.com/powershell/module/az.security/invoke-azsecurityapicollectionapimonboard +#> +function Invoke-AzSecurityApiCollectionApimOnboard { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollection])] +[CmdletBinding(DefaultParameterSetName='Azure', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Azure', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # API revision identifier. + # Must be unique in the API Management service instance. + # Non-current revision has ;rev=n as a suffix where n is the revision number. + ${ApiId}, + + [Parameter(ParameterSetName='Azure', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Azure', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The name of the API Management service. + ${ServiceName}, + + [Parameter(ParameterSetName='Azure')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Azure subscription ID + ${SubscriptionId}, + + [Parameter(ParameterSetName='AzureViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity] + # Identity Parameter + # . + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait forNET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Azure = 'Az.Security.private\Invoke-AzSecurityApiCollectionApimOnboard_Azure'; + AzureViaIdentity = 'Az.Security.private\Invoke-AzSecurityApiCollectionApimOnboard_AzureViaIdentity'; + } + if (('Azure') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Security/Security.Autorest/exports/New-AzSecurityAwsEnvironmentObject.ps1 b/src/Security/Security.Autorest/exports/New-AzSecurityAwsEnvironmentObject.ps1 new file mode 100644 index 000000000000..77a63d7d3994 --- /dev/null +++ b/src/Security/Security.Autorest/exports/New-AzSecurityAwsEnvironmentObject.ps1 @@ -0,0 +1,141 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create an in-memory object for AwsEnvironment. +.Description +Create an in-memory object for AwsEnvironment. +.Example +$member = New-AzSecurityAwsOrganizationalDataMemberObject -ParentHierarchyId "123" +New-AzSecurityAwsEnvironmentObject -Region "Central US" -ScanInterval 24 -OrganizationalData $member +.Example +$organization = New-AzSecurityAwsOrganizationalDataMasterObject -StacksetName "myAwsStackSet" -ExcludedAccountId "123456789012" +New-AzSecurityAwsEnvironmentObject -Region "Central US" -ScanInterval 24 -OrganizationalData $organization + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AwsEnvironment +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +ORGANIZATIONALDATA : The AWS account's organizational data. + OrganizationMembershipType : The multi cloud account's membership type in the organization +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecurityawsenvironmentobject +#> +function New-AzSecurityAwsEnvironmentObject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AwsEnvironment])] +[CmdletBinding(PositionalBinding=$false)] +param( + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalData] + # The AWS account's organizational data. + # . + ${OrganizationalData}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String[]] + # list of regions to scan. + ${Region}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.Int64] + # Scan interval in hours (value should be between 1-hour to 24-hours). + ${ScanInterval} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + __AllParameterSets = 'Az.Security.custom\New-AzSecurityAwsEnvironmentObject'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Security/Security.Autorest/exports/New-AzSecurityAwsOrganizationalDataMasterObject.ps1 b/src/Security/Security.Autorest/exports/New-AzSecurityAwsOrganizationalDataMasterObject.ps1 new file mode 100644 index 000000000000..da65c5f0360f --- /dev/null +++ b/src/Security/Security.Autorest/exports/New-AzSecurityAwsOrganizationalDataMasterObject.ps1 @@ -0,0 +1,123 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create an in-memory object for AwsOrganizationalDataMaster. +.Description +Create an in-memory object for AwsOrganizationalDataMaster. +.Example +New-AzSecurityAwsOrganizationalDataMasterObject -StacksetName "myAwsStackSet" -ExcludedAccountId "123456789012" + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AwsOrganizationalDataMaster +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecurityawsorganizationaldatamasterobject +#> +function New-AzSecurityAwsOrganizationalDataMasterObject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AwsOrganizationalDataMaster])] +[CmdletBinding(PositionalBinding=$false)] +param( + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String[]] + # If the multi cloud account is of membership type organization, list of accounts excluded from offering. + ${ExcludedAccountId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # If the multi cloud account is of membership type organization, this will be the name of the onboarding stackset. + ${StacksetName} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + __AllParameterSets = 'Az.Security.custom\New-AzSecurityAwsOrganizationalDataMasterObject'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Security/Security.Autorest/exports/New-AzSecurityAwsOrganizationalDataMemberObject.ps1 b/src/Security/Security.Autorest/exports/New-AzSecurityAwsOrganizationalDataMemberObject.ps1 new file mode 100644 index 000000000000..18cef3a47e4d --- /dev/null +++ b/src/Security/Security.Autorest/exports/New-AzSecurityAwsOrganizationalDataMemberObject.ps1 @@ -0,0 +1,117 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create an in-memory object for AwsOrganizationalDataMember. +.Description +Create an in-memory object for AwsOrganizationalDataMember. +.Example +New-AzSecurityAwsOrganizationalDataMemberObject -ParentHierarchyId "123" + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AwsOrganizationalDataMember +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecurityawsorganizationaldatamemberobject +#> +function New-AzSecurityAwsOrganizationalDataMemberObject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AwsOrganizationalDataMember])] +[CmdletBinding(PositionalBinding=$false)] +param( + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # If the multi cloud account is not of membership type organization, this will be the ID of the account's parent. + ${ParentHierarchyId} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + __AllParameterSets = 'Az.Security.custom\New-AzSecurityAwsOrganizationalDataMemberObject'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Security/Security.Autorest/exports/New-AzSecurityAzureDevOpsScopeEnvironmentObject.ps1 b/src/Security/Security.Autorest/exports/New-AzSecurityAzureDevOpsScopeEnvironmentObject.ps1 new file mode 100644 index 000000000000..7f50f9d6d075 --- /dev/null +++ b/src/Security/Security.Autorest/exports/New-AzSecurityAzureDevOpsScopeEnvironmentObject.ps1 @@ -0,0 +1,111 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create an in-memory object for AzureDevOpsScopeEnvironment. +.Description +Create an in-memory object for AzureDevOpsScopeEnvironment. +.Example +New-AzSecurityAzureDevOpsScopeEnvironmentObject + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsScopeEnvironment +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecurityazuredevopsscopeenvironmentobject +#> +function New-AzSecurityAzureDevOpsScopeEnvironmentObject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsScopeEnvironment])] +[CmdletBinding(PositionalBinding=$false)] +param() + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + __AllParameterSets = 'Az.Security.custom\New-AzSecurityAzureDevOpsScopeEnvironmentObject'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Security/Security.Autorest/exports/New-AzSecurityConnector.ps1 b/src/Security/Security.Autorest/exports/New-AzSecurityConnector.ps1 new file mode 100644 index 000000000000..39f6970e607f --- /dev/null +++ b/src/Security/Security.Autorest/exports/New-AzSecurityConnector.ps1 @@ -0,0 +1,312 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create a security connector. +If a security connector is already created and a subsequent request is issued for the same security connector id, then it will be updated. +.Description +Create a security connector. +If a security connector is already created and a subsequent request is issued for the same security connector id, then it will be updated. +.Example +$account = "891376984375" +$arnPrefix = "arn:aws:iam::$($account):role" + +$cspmMonitorOffering = New-AzSecurityCspmMonitorAwsOfferingObject -NativeCloudConnectionCloudRoleArn "$arnPrefix/CspmMonitorAws" + +$dcspmOffering = New-AzSecurityDefenderCspmAwsOfferingObject ` + -VMScannerEnabled $true -ConfigurationScanningMode Default -ConfigurationCloudRoleArn "$arnPrefix/DefenderForCloud-AgentlessScanner" ` + -DataSensitivityDiscoveryEnabled $true -DataSensitivityDiscoveryCloudRoleArn "$arnPrefix/SensitiveDataDiscovery" ` + -DatabaseDspmEnabled $true -DatabaseDspmCloudRoleArn "$arnPrefix/DefenderForCloud-DataSecurityPostureDB" ` + -CiemDiscoveryCloudRoleArn "$arnPrefix/DefenderForCloud-Ciem" -CiemOidcAzureActiveDirectoryAppName "mciem-aws-oidc-connector" -CiemOidcCloudRoleArn "$arnPrefix/DefenderForCloud-OidcCiem" ` + -MdcContainerImageAssessmentEnabled $true -MdcContainerImageAssessmentCloudRoleArn "$arnPrefix/MDCContainersImageAssessmentRole" ` + -MdcContainerAgentlessDiscoveryK8SEnabled $true -MdcContainerAgentlessDiscoveryK8SCloudRoleArn "$arnPrefix/MDCContainersAgentlessDiscoveryK8sRole" + +$defenderForContainersOffering = New-AzSecurityDefenderForContainersAwsOfferingObject ` + -AutoProvisioning $true -KuberneteServiceCloudRoleArn "$arnPrefix/DefenderForCloud-Containers-K8s" -KuberneteScubaReaderCloudRoleArn "$arnPrefix/DefenderForCloud-DataCollection" ` + -KinesiToS3CloudRoleArn "$arnPrefix/DefenderForCloud-Containers-K8s-kinesis-to-s3" -CloudWatchToKinesiCloudRoleArn "$arnPrefix/DefenderForCloud-Containers-K8s-cloudwatch-to-kinesis" ` + -KubeAuditRetentionTime 30 -ScubaExternalId "a47ae0a2-7bf7-482a-897a-7a139d30736c" ` + -MdcContainerAgentlessDiscoveryK8SEnabled $true -MdcContainerAgentlessDiscoveryK8SCloudRoleArn "$arnPrefix/MDCContainersAgentlessDiscoveryK8sRole" ` + -MdcContainerImageAssessmentEnabled $true -MdcContainerImageAssessmentCloudRoleArn "$arnPrefix/MDCContainersImageAssessmentRole" ` + -EnableContainerVulnerabilityAssessment $false + +$environment = New-AzSecurityAwsEnvironmentObject -ScanInterval 24 + +New-AzSecurityConnector -Name "aws-sdktest01" -ResourceGroupName "securityConnectors-tests" ` + -EnvironmentData $environment -EnvironmentName AWS -HierarchyIdentifier "$account" ` + -Offering @($cspmMonitorOffering, $dcspmOffering, $defenderForContainersOffering) ` + -Location "CentralUS" +.Example +$account = "843025268399" +$emailSuffix = "myproject.iam.gserviceaccount.com" +$cspmMonitorOffering = New-AzSecurityCspmMonitorGcpOfferingObject -NativeCloudConnectionServiceAccountEmailAddress "microsoft-defender-cspm@$emailSuffix" -NativeCloudConnectionWorkloadIdentityProviderId "cspm" + +$dcspmOffering = New-AzSecurityDefenderCspmGcpOfferingObject ` + -VMScannerEnabled $true -ConfigurationScanningMode Default -ConfigurationExclusionTag @{key="value"} ` + -MdcContainerAgentlessDiscoveryK8SEnabled $true -MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress "mdc-containers-k8s-operator@$emailSuffix" -MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId "containers" ` + -MdcContainerImageAssessmentEnabled $true -MdcContainerImageAssessmentServiceAccountEmailAddress "mdc-containers-artifact-assess@$emailSuffix" -MdcContainerImageAssessmentWorkloadIdentityProviderId "containers" ` + -DataSensitivityDiscoveryEnabled $true -DataSensitivityDiscoveryServiceAccountEmailAddress "mdc-data-sec-posture-storage@$emailSuffix" -DataSensitivityDiscoveryWorkloadIdentityProviderId "data-security-posture-storage" ` + -CiemDiscoveryServiceAccountEmailAddress "microsoft-defender-ciem@$emailSuffix" -CiemDiscoveryAzureActiveDirectoryAppName "mciem-gcp-oidc-app" -CiemDiscoveryWorkloadIdentityProviderId "ciem-discovery" + +$defenderForContainersOffering = New-AzSecurityDefenderForContainersGcpOfferingObject ` + -NativeCloudConnectionServiceAccountEmailAddress "microsoft-defender-containers@$emailSuffix" -NativeCloudConnectionWorkloadIdentityProviderId "containers" ` + -DataPipelineNativeCloudConnectionServiceAccountEmailAddress "ms-defender-containers-stream@$emailSuffix" -DataPipelineNativeCloudConnectionWorkloadIdentityProviderId "containers-streams" ` + -AuditLogsAutoProvisioningFlag $true -DefenderAgentAutoProvisioningFlag $true -PolicyAgentAutoProvisioningFlag $true ` + -MdcContainerAgentlessDiscoveryK8SEnabled $true -MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId "containers" -MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress "mdc-containers-k8s-operator@$emailSuffix" ` + -MdcContainerImageAssessmentEnabled $true -MdcContainerImageAssessmentWorkloadIdentityProviderId "containers" -MdcContainerImageAssessmentServiceAccountEmailAddress "mdc-containers-artifact-assess@$emailSuffix" + +$environment = New-AzSecurityGcpProjectEnvironmentObject -ScanInterval 24 -ProjectDetailProjectId "asc-sdk-samples" -ProjectDetailProjectNumber "$account" + +New-AzSecurityConnector -Name "gcp-sdktest01" -ResourceGroupName "securityConnectors-tests" -EnvironmentData $environment -EnvironmentName GCP -HierarchyIdentifier "$account" ` + -Offering @($cspmMonitorOffering, $dcspmOffering, $defenderForContainersOffering) -Location "CentralUS" +.Example +New-AzSecurityConnector -ResourceGroupName "securityConnectors-pwsh-tmp" -Name "ado-sdk-pwsh-test03" ` + -EnvironmentName AzureDevOps -EnvironmentData (New-AzSecurityAzureDevOpsScopeEnvironmentObject) ` + -HierarchyIdentifier ([guid]::NewGuid().ToString()) -Location "CentralUS" ` + -Offering @(New-AzSecurityCspmMonitorAzureDevOpsOfferingObject) +.Example +New-AzSecurityConnector -ResourceGroupName "securityConnectors-pwsh-tmp" -Name "gh-sdk-pwsh-test03" ` + -EnvironmentName GitHub -EnvironmentData (New-AzSecurityGitHubScopeEnvironmentObject) ` + -HierarchyIdentifier ([guid]::NewGuid().ToString()) -Location "CentralUS" ` + -Offering @(New-AzSecurityCspmMonitorGithubOfferingObject) +.Example +New-AzSecurityConnector -ResourceGroupName "securityConnectors-pwsh-tmp" -Name "gl-sdk-pwsh-test03" ` + -EnvironmentName GitLab -EnvironmentData (New-AzSecurityGitLabScopeEnvironmentObject) ` + -HierarchyIdentifier ([guid]::NewGuid().ToString()) -Location "CentralUS" ` + -Offering @(New-AzSecurityCspmMonitorGitLabOfferingObject) + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnector +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +ENVIRONMENTDATA : The security connector environment data. + EnvironmentType : The type of the environment data. + +OFFERING : A collection of offerings for the security connector. + OfferingType : The type of the security offering. +.Link +https://learn.microsoft.com/powershell/module/az.security/new-azsecurityconnector +#> +function New-AzSecurityConnector { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnector])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('SecurityConnectorName')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The security connector name. + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The name of the resource group within the user's subscription. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Azure subscription ID + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironment] + # The security connector environment data. + # . + ${EnvironmentData}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Azure", "AWS", "GCP", "Github", "AzureDevOps", "GitLab")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The multi cloud resource's cloud name. + ${EnvironmentName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # Entity tag is used for comparing two or more entities from the same requested resource. + ${Etag}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The multi cloud resource identifier (account id in case of AWS connector, project number in case of GCP connector). + ${HierarchyIdentifier}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # Kind of the resource + ${Kind}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # Location where the resource is stored + ${Location}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOffering[]] + # A collection of offerings for the security connector. + # . + ${Offering}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITags]))] + [System.Collections.Hashtable] + # A list of key value pairs that describe the resource. + ${Tag}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait forNET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + CreateExpanded = 'Az.Security.private\New-AzSecurityConnector_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Security/Security.Autorest/exports/New-AzSecurityConnectorActionableRemediationObject.ps1 b/src/Security/Security.Autorest/exports/New-AzSecurityConnectorActionableRemediationObject.ps1 new file mode 100644 index 000000000000..aef5e26de4b4 --- /dev/null +++ b/src/Security/Security.Autorest/exports/New-AzSecurityConnectorActionableRemediationObject.ps1 @@ -0,0 +1,158 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create an in-memory object for ActionableRemediation. +.Description +Create an in-memory object for ActionableRemediation. +.Example +New-AzSecurityConnectorActionableRemediationObject -State Enabled -InheritFromParentState Disabled ` + -BranchConfiguration @{AnnotateDefaultBranch="Enabled"; branchName=@("main", "hotfix")} -CategoryConfiguration @( @{category="First"; minimumSeverityLevel="High"}, @{category="Second"; minimumSeverityLevel="Low"}) + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ActionableRemediation +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +BRANCHCONFIGURATION : Repository branch configuration for PR Annotations. + [AnnotateDefaultBranch ]: Configuration of PR Annotations on default branch. Enabled - PR Annotations are enabled on the resource's default branch. Disabled - PR Annotations are disabled on the resource's default branch. + [BranchName >]: Gets or sets branches that should have annotations. + +CATEGORYCONFIGURATION : Gets or sets list of categories and severity levels. + [Category ]: Rule categories. Code - code scanning results. Artifact scanning results. Dependencies scanning results. IaC results. Secrets scanning results. Container scanning results. + [MinimumSeverityLevel ]: Gets or sets minimum severity level for a given category. +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecurityconnectoractionableremediationobject +#> +function New-AzSecurityConnectorActionableRemediationObject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ActionableRemediation])] +[CmdletBinding(PositionalBinding=$false)] +param( + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITargetBranchConfiguration] + # Repository branch configuration for PR Annotations. + # . + ${BranchConfiguration}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICategoryConfiguration[]] + # Gets or sets list of categories and severity levels. + # . + ${CategoryConfiguration}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Disabled", "Enabled")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # Update Settings. + # + # Enabled - Resource should inherit configurations from parent. + # Disabled - Resource should not inherit configurations from parent. + ${InheritFromParentState}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("None", "Disabled", "Enabled")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # ActionableRemediation Setting. + # None - the setting was never set. + # Enabled - ActionableRemediation is enabled. + # Disabled - ActionableRemediation is disabled. + ${State} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + __AllParameterSets = 'Az.Security.custom\New-AzSecurityConnectorActionableRemediationObject'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Security/Security.Autorest/exports/New-AzSecurityConnectorDevOpsConfiguration.ps1 b/src/Security/Security.Autorest/exports/New-AzSecurityConnectorDevOpsConfiguration.ps1 new file mode 100644 index 000000000000..c6226336c50b --- /dev/null +++ b/src/Security/Security.Autorest/exports/New-AzSecurityConnectorDevOpsConfiguration.ps1 @@ -0,0 +1,215 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create a DevOps Configuration. +.Description +Create a DevOps Configuration. +.Example +New-AzSecurityConnectorDevOpsConfiguration -ResourceGroupName "securityconnectors-pwsh-tmp" -SecurityConnectorName "ado-sdk-pwsh-test03" -AutoDiscovery Disabled -TopLevelInventoryList @("org1", "org2") -AuthorizationCode "myAuthorizationCode" + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfiguration +.Link +https://learn.microsoft.com/powershell/module/az.security/new-azsecurityconnectordevopsconfiguration +#> +function New-AzSecurityConnectorDevOpsConfiguration { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfiguration])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The security connector name. + ${SecurityConnectorName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Azure subscription ID + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # Gets or sets one-time OAuth code to exchange for refresh and access tokens.Only used during PUT/PATCH operations. + # The secret is cleared during GET. + ${AuthorizationCode}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Disabled", "Enabled", "NotApplicable")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # AutoDiscovery states. + ${AutoDiscovery}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String[]] + # List of top-level inventory to select when AutoDiscovery is disabled.This field is ignored when AutoDiscovery is enabled. + ${TopLevelInventoryList}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait forNET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + CreateExpanded = 'Az.Security.private\New-AzSecurityConnectorDevOpsConfiguration_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Security/Security.Autorest/exports/New-AzSecurityCspmMonitorAwsOfferingObject.ps1 b/src/Security/Security.Autorest/exports/New-AzSecurityCspmMonitorAwsOfferingObject.ps1 new file mode 100644 index 000000000000..bcd943f61e34 --- /dev/null +++ b/src/Security/Security.Autorest/exports/New-AzSecurityCspmMonitorAwsOfferingObject.ps1 @@ -0,0 +1,117 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create an in-memory object for CspmMonitorAwsOffering. +.Description +Create an in-memory object for CspmMonitorAwsOffering. +.Example +New-AzSecurityCspmMonitorAwsOfferingObject -NativeCloudConnectionCloudRoleArn "arn:aws:iam::123456789012:role/CspmMonitorAws" + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CspmMonitorAwsOffering +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritycspmmonitorawsofferingobject +#> +function New-AzSecurityCspmMonitorAwsOfferingObject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CspmMonitorAwsOffering])] +[CmdletBinding(PositionalBinding=$false)] +param( + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The cloud role ARN in AWS for this feature. + ${NativeCloudConnectionCloudRoleArn} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + __AllParameterSets = 'Az.Security.custom\New-AzSecurityCspmMonitorAwsOfferingObject'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Security/Security.Autorest/exports/New-AzSecurityCspmMonitorAzureDevOpsOfferingObject.ps1 b/src/Security/Security.Autorest/exports/New-AzSecurityCspmMonitorAzureDevOpsOfferingObject.ps1 new file mode 100644 index 000000000000..01bd2869e20a --- /dev/null +++ b/src/Security/Security.Autorest/exports/New-AzSecurityCspmMonitorAzureDevOpsOfferingObject.ps1 @@ -0,0 +1,111 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create an in-memory object for CspmMonitorAzureDevOpsOffering. +.Description +Create an in-memory object for CspmMonitorAzureDevOpsOffering. +.Example +New-AzSecurityCspmMonitorAzureDevOpsOfferingObject + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CspmMonitorAzureDevOpsOffering +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritycspmmonitorazuredevopsofferingobject +#> +function New-AzSecurityCspmMonitorAzureDevOpsOfferingObject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CspmMonitorAzureDevOpsOffering])] +[CmdletBinding(PositionalBinding=$false)] +param() + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + __AllParameterSets = 'Az.Security.custom\New-AzSecurityCspmMonitorAzureDevOpsOfferingObject'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Security/Security.Autorest/exports/New-AzSecurityCspmMonitorGcpOfferingObject.ps1 b/src/Security/Security.Autorest/exports/New-AzSecurityCspmMonitorGcpOfferingObject.ps1 new file mode 100644 index 000000000000..c6976b193297 --- /dev/null +++ b/src/Security/Security.Autorest/exports/New-AzSecurityCspmMonitorGcpOfferingObject.ps1 @@ -0,0 +1,123 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create an in-memory object for CspmMonitorGcpOffering. +.Description +Create an in-memory object for CspmMonitorGcpOffering. +.Example +New-AzSecurityCspmMonitorGcpOfferingObject -NativeCloudConnectionServiceAccountEmailAddress "microsoft-defender-cspm@asc-sdk-samples.iam.gserviceaccount.com" -NativeCloudConnectionWorkloadIdentityProviderId "cspm" + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CspmMonitorGcpOffering +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritycspmmonitorgcpofferingobject +#> +function New-AzSecurityCspmMonitorGcpOfferingObject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CspmMonitorGcpOffering])] +[CmdletBinding(PositionalBinding=$false)] +param( + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The service account email address in GCP for this offering. + ${NativeCloudConnectionServiceAccountEmailAddress}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The GCP workload identity provider id for the offering. + ${NativeCloudConnectionWorkloadIdentityProviderId} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + __AllParameterSets = 'Az.Security.custom\New-AzSecurityCspmMonitorGcpOfferingObject'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Security/Security.Autorest/exports/New-AzSecurityCspmMonitorGitLabOfferingObject.ps1 b/src/Security/Security.Autorest/exports/New-AzSecurityCspmMonitorGitLabOfferingObject.ps1 new file mode 100644 index 000000000000..e9e3b34050f6 --- /dev/null +++ b/src/Security/Security.Autorest/exports/New-AzSecurityCspmMonitorGitLabOfferingObject.ps1 @@ -0,0 +1,111 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create an in-memory object for CspmMonitorGitLabOffering. +.Description +Create an in-memory object for CspmMonitorGitLabOffering. +.Example +New-AzSecurityCspmMonitorGitLabOfferingObject + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CspmMonitorGitLabOffering +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritycspmmonitorgitlabofferingobject +#> +function New-AzSecurityCspmMonitorGitLabOfferingObject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CspmMonitorGitLabOffering])] +[CmdletBinding(PositionalBinding=$false)] +param() + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + __AllParameterSets = 'Az.Security.custom\New-AzSecurityCspmMonitorGitLabOfferingObject'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Security/Security.Autorest/exports/New-AzSecurityCspmMonitorGithubOfferingObject.ps1 b/src/Security/Security.Autorest/exports/New-AzSecurityCspmMonitorGithubOfferingObject.ps1 new file mode 100644 index 000000000000..c06f90533acd --- /dev/null +++ b/src/Security/Security.Autorest/exports/New-AzSecurityCspmMonitorGithubOfferingObject.ps1 @@ -0,0 +1,111 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create an in-memory object for CspmMonitorGithubOffering. +.Description +Create an in-memory object for CspmMonitorGithubOffering. +.Example +New-AzSecurityCspmMonitorGithubOfferingObject + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CspmMonitorGithubOffering +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritycspmmonitorgithubofferingobject +#> +function New-AzSecurityCspmMonitorGithubOfferingObject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CspmMonitorGithubOffering])] +[CmdletBinding(PositionalBinding=$false)] +param() + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + __AllParameterSets = 'Az.Security.custom\New-AzSecurityCspmMonitorGithubOfferingObject'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Security/Security.Autorest/exports/New-AzSecurityDefenderCspmAwsOfferingObject.ps1 b/src/Security/Security.Autorest/exports/New-AzSecurityDefenderCspmAwsOfferingObject.ps1 new file mode 100644 index 000000000000..0b4b30ea4c16 --- /dev/null +++ b/src/Security/Security.Autorest/exports/New-AzSecurityDefenderCspmAwsOfferingObject.ps1 @@ -0,0 +1,217 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create an in-memory object for DefenderCspmAwsOffering. +.Description +Create an in-memory object for DefenderCspmAwsOffering. +.Example +$arnPrefix = "arn:aws:iam::123456789012:role" +New-AzSecurityDefenderCspmAwsOfferingObject ` + -VMScannerEnabled $true -ConfigurationScanningMode Default -ConfigurationCloudRoleArn "$arnPrefix/DefenderForCloud-AgentlessScanner" -ConfigurationExclusionTag @{key="value"} ` + -DataSensitivityDiscoveryEnabled $true -DataSensitivityDiscoveryCloudRoleArn "$arnPrefix/SensitiveDataDiscovery" ` + -DatabaseDspmEnabled $true -DatabaseDspmCloudRoleArn "$arnPrefix/DefenderForCloud-DataSecurityPostureDB" ` + -CiemDiscoveryCloudRoleArn "$arnPrefix/DefenderForCloud-Ciem" -CiemOidcAzureActiveDirectoryAppName "mciem-aws-oidc-connector" -CiemOidcCloudRoleArn "$arnPrefix/DefenderForCloud-OidcCiem" ` + -MdcContainerImageAssessmentEnabled $true -MdcContainerImageAssessmentCloudRoleArn "$arnPrefix/MDCContainersImageAssessmentRole" ` + -MdcContainerAgentlessDiscoveryK8SEnabled $true -MdcContainerAgentlessDiscoveryK8SCloudRoleArn "$arnPrefix/MDCContainersAgentlessDiscoveryK8sRole" + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOffering +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +CONFIGURATIONEXCLUSIONTAG : VM tags that indicates that VM should not be scanned. + [(Any) ]: This indicates any property can be added to this object. +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritydefendercspmawsofferingobject +#> +function New-AzSecurityDefenderCspmAwsOfferingObject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOffering])] +[CmdletBinding(PositionalBinding=$false)] +param( + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The cloud role ARN in AWS for CIEM discovery. + ${CiemDiscoveryCloudRoleArn}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # the azure active directory app name used of authenticating against AWS. + ${CiemOidcAzureActiveDirectoryAppName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The cloud role ARN in AWS for CIEM oidc connection. + ${CiemOidcCloudRoleArn}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The cloud role ARN in AWS for this feature. + ${ConfigurationCloudRoleArn}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfigurationExclusionTags] + # VM tags that indicates that VM should not be scanned. + # . + ${ConfigurationExclusionTag}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Default")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The scanning mode for the VM scan. + ${ConfigurationScanningMode}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The cloud role ARN in AWS for this feature. + ${DataSensitivityDiscoveryCloudRoleArn}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.Boolean] + # Is Microsoft Defender Data Sensitivity discovery enabled. + ${DataSensitivityDiscoveryEnabled}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The cloud role ARN in AWS for this feature. + ${DatabaseDspmCloudRoleArn}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.Boolean] + # Is databases DSPM protection enabled. + ${DatabaseDspmEnabled}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The cloud role ARN in AWS for this feature. + ${MdcContainerAgentlessDiscoveryK8SCloudRoleArn}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.Boolean] + # Is Microsoft Defender container agentless discovery K8s enabled. + ${MdcContainerAgentlessDiscoveryK8SEnabled}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The cloud role ARN in AWS for this feature. + ${MdcContainerImageAssessmentCloudRoleArn}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.Boolean] + # Is Microsoft Defender container image assessment enabled. + ${MdcContainerImageAssessmentEnabled}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.Boolean] + # Is Microsoft Defender for Server VM scanning enabled. + ${VMScannerEnabled} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + __AllParameterSets = 'Az.Security.custom\New-AzSecurityDefenderCspmAwsOfferingObject'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Security/Security.Autorest/exports/New-AzSecurityDefenderCspmGcpOfferingObject.ps1 b/src/Security/Security.Autorest/exports/New-AzSecurityDefenderCspmGcpOfferingObject.ps1 new file mode 100644 index 000000000000..86a1c9040f9e --- /dev/null +++ b/src/Security/Security.Autorest/exports/New-AzSecurityDefenderCspmGcpOfferingObject.ps1 @@ -0,0 +1,216 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create an in-memory object for DefenderCspmGcpOffering. +.Description +Create an in-memory object for DefenderCspmGcpOffering. +.Example +$emailSuffix = "myproject.iam.gserviceaccount.com" +New-AzSecurityDefenderCspmGcpOfferingObject ` + -VMScannerEnabled $true -ConfigurationScanningMode Default -ConfigurationExclusionTag @{key="value"} ` + -MdcContainerAgentlessDiscoveryK8SEnabled $true -MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress "mdc-containers-k8s-operator@$emailSuffix" -MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId "containers" ` + -MdcContainerImageAssessmentEnabled $true -MdcContainerImageAssessmentServiceAccountEmailAddress "mdc-containers-artifact-assess@$emailSuffix" -MdcContainerImageAssessmentWorkloadIdentityProviderId "containers" ` + -DataSensitivityDiscoveryEnabled $true -DataSensitivityDiscoveryServiceAccountEmailAddress "mdc-data-sec-posture-storage@$emailSuffix" -DataSensitivityDiscoveryWorkloadIdentityProviderId "data-security-posture-storage" ` + -CiemDiscoveryServiceAccountEmailAddress "microsoft-defender-ciem@$emailSuffix" -CiemDiscoveryAzureActiveDirectoryAppName "mciem-gcp-oidc-app" -CiemDiscoveryWorkloadIdentityProviderId "ciem-discovery" + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmGcpOffering +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +CONFIGURATIONEXCLUSIONTAG : VM tags that indicates that VM should not be scanned. + [(Any) ]: This indicates any property can be added to this object. +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritydefendercspmgcpofferingobject +#> +function New-AzSecurityDefenderCspmGcpOfferingObject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmGcpOffering])] +[CmdletBinding(PositionalBinding=$false)] +param( + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # the azure active directory app name used of authenticating against GCP workload identity federation. + ${CiemDiscoveryAzureActiveDirectoryAppName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The service account email address in GCP for CIEM discovery offering. + ${CiemDiscoveryServiceAccountEmailAddress}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The GCP workload identity provider id for CIEM discovery offering. + ${CiemDiscoveryWorkloadIdentityProviderId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersConfigurationExclusionTags] + # VM tags that indicates that VM should not be scanned. + # . + ${ConfigurationExclusionTag}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Default")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The scanning mode for the VM scan. + ${ConfigurationScanningMode}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.Boolean] + # Is Microsoft Defender Data Sensitivity discovery enabled. + ${DataSensitivityDiscoveryEnabled}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The service account email address in GCP for this feature. + ${DataSensitivityDiscoveryServiceAccountEmailAddress}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The workload identity provider id in GCP for this feature. + ${DataSensitivityDiscoveryWorkloadIdentityProviderId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.Boolean] + # Is Microsoft Defender container agentless discovery enabled. + ${MdcContainerAgentlessDiscoveryK8SEnabled}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The service account email address in GCP for this feature. + ${MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The workload identity provider id in GCP for this feature. + ${MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.Boolean] + # Is Microsoft Defender container image assessment enabled. + ${MdcContainerImageAssessmentEnabled}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The service account email address in GCP for this feature. + ${MdcContainerImageAssessmentServiceAccountEmailAddress}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The workload identity provider id in GCP for this feature. + ${MdcContainerImageAssessmentWorkloadIdentityProviderId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.Boolean] + # Is Microsoft Defender for Server VM scanning enabled. + ${VMScannerEnabled} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + __AllParameterSets = 'Az.Security.custom\New-AzSecurityDefenderCspmGcpOfferingObject'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Security/Security.Autorest/exports/New-AzSecurityDefenderForContainersAwsOfferingObject.ps1 b/src/Security/Security.Autorest/exports/New-AzSecurityDefenderForContainersAwsOfferingObject.ps1 new file mode 100644 index 000000000000..2c6f13c38779 --- /dev/null +++ b/src/Security/Security.Autorest/exports/New-AzSecurityDefenderForContainersAwsOfferingObject.ps1 @@ -0,0 +1,202 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create an in-memory object for DefenderForContainersAwsOffering. +.Description +Create an in-memory object for DefenderForContainersAwsOffering. +.Example +$arnPrefix = "arn:aws:iam::123456789012:role" +New-AzSecurityDefenderForContainersAwsOfferingObject ` + -AutoProvisioning $true -KuberneteServiceCloudRoleArn "$arnPrefix/DefenderForCloud-Containers-K8s" -KuberneteScubaReaderCloudRoleArn "$arnPrefix/DefenderForCloud-DataCollection" ` + -KinesiToS3CloudRoleArn "$arnPrefix/DefenderForCloud-Containers-K8s-kinesis-to-s3" -CloudWatchToKinesiCloudRoleArn "$arnPrefix/DefenderForCloud-Containers-K8s-cloudwatch-to-kinesis" ` + -KubeAuditRetentionTime 30 -ScubaExternalId "a47ae0a2-7bf7-482a-897a-7a139d30736c" ` + -MdcContainerAgentlessDiscoveryK8SEnabled $true -MdcContainerAgentlessDiscoveryK8SCloudRoleArn "$arnPrefix/MDCContainersAgentlessDiscoveryK8sRole" ` + -MdcContainerImageAssessmentEnabled $true -MdcContainerImageAssessmentCloudRoleArn "$arnPrefix/MDCContainersImageAssessmentRole" ` + -EnableContainerVulnerabilityAssessment $false + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersAwsOffering +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritydefenderforcontainersawsofferingobject +#> +function New-AzSecurityDefenderForContainersAwsOfferingObject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersAwsOffering])] +[CmdletBinding(PositionalBinding=$false)] +param( + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.Boolean] + # Is audit logs pipeline auto provisioning enabled. + ${AutoProvisioning}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The cloud role ARN in AWS used by CloudWatch to transfer data into Kinesis. + ${CloudWatchToKinesiCloudRoleArn}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The cloud role ARN in AWS for this feature. + ${ContainerVulnerabilityAssessmentCloudRoleArn}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The cloud role ARN in AWS for this feature. + ${ContainerVulnerabilityAssessmentTaskCloudRoleArn}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.Boolean] + # Enable container vulnerability assessment feature. + ${EnableContainerVulnerabilityAssessment}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The cloud role ARN in AWS used by Kinesis to transfer data into S3. + ${KinesiToS3CloudRoleArn}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.Int64] + # The retention time in days of kube audit logs set on the CloudWatch log group. + ${KubeAuditRetentionTime}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The cloud role ARN in AWS for this feature used for reading data. + ${KuberneteScubaReaderCloudRoleArn}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The cloud role ARN in AWS for this feature used for provisioning resources. + ${KuberneteServiceCloudRoleArn}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The cloud role ARN in AWS for this feature. + ${MdcContainerAgentlessDiscoveryK8SCloudRoleArn}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.Boolean] + # Is Microsoft Defender container agentless discovery K8s enabled. + ${MdcContainerAgentlessDiscoveryK8SEnabled}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The cloud role ARN in AWS for this feature. + ${MdcContainerImageAssessmentCloudRoleArn}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.Boolean] + # Is Microsoft Defender container image assessment enabled. + ${MdcContainerImageAssessmentEnabled}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The externalId used by the data reader to prevent the confused deputy attack. + ${ScubaExternalId} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + __AllParameterSets = 'Az.Security.custom\New-AzSecurityDefenderForContainersAwsOfferingObject'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Security/Security.Autorest/exports/New-AzSecurityDefenderForContainersGcpOfferingObject.ps1 b/src/Security/Security.Autorest/exports/New-AzSecurityDefenderForContainersGcpOfferingObject.ps1 new file mode 100644 index 000000000000..125ac12e8dd8 --- /dev/null +++ b/src/Security/Security.Autorest/exports/New-AzSecurityDefenderForContainersGcpOfferingObject.ps1 @@ -0,0 +1,195 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create an in-memory object for DefenderForContainersGcpOffering. +.Description +Create an in-memory object for DefenderForContainersGcpOffering. +.Example +$emailSuffix = "myproject.iam.gserviceaccount.com" +New-AzSecurityDefenderForContainersGcpOfferingObject ` + -NativeCloudConnectionServiceAccountEmailAddress "microsoft-defender-containers@$emailSuffix" -NativeCloudConnectionWorkloadIdentityProviderId "containers" ` + -DataPipelineNativeCloudConnectionServiceAccountEmailAddress "ms-defender-containers-stream@$emailSuffix" -DataPipelineNativeCloudConnectionWorkloadIdentityProviderId "containers-streams" ` + -AuditLogsAutoProvisioningFlag $true -DefenderAgentAutoProvisioningFlag $true -PolicyAgentAutoProvisioningFlag $true ` + -MdcContainerAgentlessDiscoveryK8SEnabled $true -MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId "containers" -MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress "mdc-containers-k8s-operator@$emailSuffix" ` + -MdcContainerImageAssessmentEnabled $true -MdcContainerImageAssessmentWorkloadIdentityProviderId "containers" -MdcContainerImageAssessmentServiceAccountEmailAddress "mdc-containers-artifact-assess@$emailSuffix" + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersGcpOffering +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritydefenderforcontainersgcpofferingobject +#> +function New-AzSecurityDefenderForContainersGcpOfferingObject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersGcpOffering])] +[CmdletBinding(PositionalBinding=$false)] +param( + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.Boolean] + # Is audit logs data collection enabled. + ${AuditLogsAutoProvisioningFlag}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The data collection service account email address in GCP for this offering. + ${DataPipelineNativeCloudConnectionServiceAccountEmailAddress}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The data collection GCP workload identity provider id for this offering. + ${DataPipelineNativeCloudConnectionWorkloadIdentityProviderId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.Boolean] + # Is Microsoft Defender for Cloud Kubernetes agent auto provisioning enabled. + ${DefenderAgentAutoProvisioningFlag}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.Boolean] + # Is Microsoft Defender container agentless discovery enabled. + ${MdcContainerAgentlessDiscoveryK8SEnabled}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The service account email address in GCP for this feature. + ${MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The workload identity provider id in GCP for this feature. + ${MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.Boolean] + # Is Microsoft Defender container image assessment enabled. + ${MdcContainerImageAssessmentEnabled}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The service account email address in GCP for this feature. + ${MdcContainerImageAssessmentServiceAccountEmailAddress}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The workload identity provider id in GCP for this feature. + ${MdcContainerImageAssessmentWorkloadIdentityProviderId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The service account email address in GCP for this offering. + ${NativeCloudConnectionServiceAccountEmailAddress}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The GCP workload identity provider id for this offering. + ${NativeCloudConnectionWorkloadIdentityProviderId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.Boolean] + # Is Policy Kubernetes agent auto provisioning enabled. + ${PolicyAgentAutoProvisioningFlag} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + __AllParameterSets = 'Az.Security.custom\New-AzSecurityDefenderForContainersGcpOfferingObject'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Security/Security.Autorest/exports/New-AzSecurityDefenderForDatabasesAwsOfferingObject.ps1 b/src/Security/Security.Autorest/exports/New-AzSecurityDefenderForDatabasesAwsOfferingObject.ps1 new file mode 100644 index 000000000000..858289e3cc13 --- /dev/null +++ b/src/Security/Security.Autorest/exports/New-AzSecurityDefenderForDatabasesAwsOfferingObject.ps1 @@ -0,0 +1,163 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create an in-memory object for DefenderForDatabasesAwsOffering. +.Description +Create an in-memory object for DefenderForDatabasesAwsOffering. +.Example +$arnPrefix = "arn:aws:iam::123456789012:role" +New-AzSecurityDefenderForDatabasesAwsOfferingObject ` + -ArcAutoProvisioningEnabled $true -ArcAutoProvisioningCloudRoleArn "$arnPrefix/DefenderForCloud-ArcAutoProvisioning" ` + -DatabaseDspmEnabled $true -DatabaseDspmCloudRoleArn "$arnPrefix/DefenderForCloud-DataSecurityPostureDB" + + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForDatabasesAwsOffering +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritydefenderfordatabasesawsofferingobject +#> +function New-AzSecurityDefenderForDatabasesAwsOfferingObject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForDatabasesAwsOffering])] +[CmdletBinding(PositionalBinding=$false)] +param( + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The cloud role ARN in AWS for this feature. + ${ArcAutoProvisioningCloudRoleArn}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.Boolean] + # Is arc auto provisioning enabled. + ${ArcAutoProvisioningEnabled}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # Optional Arc private link scope resource id to link the Arc agent. + ${ConfigurationPrivateLinkScope}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # Optional http proxy endpoint to use for the Arc agent. + ${ConfigurationProxy}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The cloud role ARN in AWS for this feature. + ${DatabaseDspmCloudRoleArn}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.Boolean] + # Is databases data security posture management (DSPM) protection enabled. + ${DatabaseDspmEnabled}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The cloud role ARN in AWS for this feature. + ${RdCloudRoleArn}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.Boolean] + # Is RDS protection enabled. + ${RdEnabled} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + __AllParameterSets = 'Az.Security.custom\New-AzSecurityDefenderForDatabasesAwsOfferingObject'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Security/Security.Autorest/exports/New-AzSecurityDefenderForDatabasesGcpOfferingObject.ps1 b/src/Security/Security.Autorest/exports/New-AzSecurityDefenderForDatabasesGcpOfferingObject.ps1 new file mode 100644 index 000000000000..ba0b35a83d62 --- /dev/null +++ b/src/Security/Security.Autorest/exports/New-AzSecurityDefenderForDatabasesGcpOfferingObject.ps1 @@ -0,0 +1,145 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create an in-memory object for DefenderForDatabasesGcpOffering. +.Description +Create an in-memory object for DefenderForDatabasesGcpOffering. +.Example +$emailSuffix = "myproject.iam.gserviceaccount.com" +New-AzSecurityDefenderForDatabasesGcpOfferingObject ` + -ArcAutoProvisioningEnabled $true ` + -DefenderForDatabaseArcAutoProvisioningServiceAccountEmailAddress "microsoft-databases-arc-ap@" -DefenderForDatabaseArcAutoProvisioningWorkloadIdentityProviderId "defender-for-databases-arc-ap" + + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForDatabasesGcpOffering +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritydefenderfordatabasesgcpofferingobject +#> +function New-AzSecurityDefenderForDatabasesGcpOfferingObject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForDatabasesGcpOffering])] +[CmdletBinding(PositionalBinding=$false)] +param( + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.Boolean] + # Is arc auto provisioning enabled. + ${ArcAutoProvisioningEnabled}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # Optional Arc private link scope resource id to link the Arc agent. + ${ConfigurationPrivateLinkScope}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # Optional http proxy endpoint to use for the Arc agent. + ${ConfigurationProxy}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The service account email address in GCP for this offering. + ${DefenderForDatabaseArcAutoProvisioningServiceAccountEmailAddress}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The GCP workload identity provider id for this offering. + ${DefenderForDatabaseArcAutoProvisioningWorkloadIdentityProviderId} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + __AllParameterSets = 'Az.Security.custom\New-AzSecurityDefenderForDatabasesGcpOfferingObject'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Security/Security.Autorest/exports/New-AzSecurityDefenderForServersAwsOfferingObject.ps1 b/src/Security/Security.Autorest/exports/New-AzSecurityDefenderForServersAwsOfferingObject.ps1 new file mode 100644 index 000000000000..ef38f9b04690 --- /dev/null +++ b/src/Security/Security.Autorest/exports/New-AzSecurityDefenderForServersAwsOfferingObject.ps1 @@ -0,0 +1,214 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create an in-memory object for DefenderForServersAwsOffering. +.Description +Create an in-memory object for DefenderForServersAwsOffering. +.Example +$arnPrefix = "arn:aws:iam::123456789012:role" +New-AzSecurityDefenderForServersAwsOfferingObject ` + -DefenderForServerCloudRoleArn "$arnPrefix/DefenderForCloud-DefenderForServers" ` + -ArcAutoProvisioningEnabled $true -ArcAutoProvisioningCloudRoleArn "$arnPrefix/DefenderForCloud-ArcAutoProvisioning" ` + -MdeAutoProvisioningEnabled $true ` + -VaAutoProvisioningEnabled $true -ConfigurationType TVM ` + -VMScannerEnabled $true -ConfigurationCloudRoleArn "$arnPrefix/DefenderForCloud-AgentlessScanner" -ConfigurationScanningMode Default ` + -SubPlanType P2 + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOffering +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +CONFIGURATIONEXCLUSIONTAG : VM tags that indicates that VM should not be scanned. + [(Any) ]: This indicates any property can be added to this object. +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritydefenderforserversawsofferingobject +#> +function New-AzSecurityDefenderForServersAwsOfferingObject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOffering])] +[CmdletBinding(PositionalBinding=$false)] +param( + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The cloud role ARN in AWS for this feature. + ${ArcAutoProvisioningCloudRoleArn}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.Boolean] + # Is arc auto provisioning enabled. + ${ArcAutoProvisioningEnabled}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The cloud role ARN in AWS for this feature. + ${ConfigurationCloudRoleArn}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfigurationExclusionTags] + # VM tags that indicates that VM should not be scanned. + # . + ${ConfigurationExclusionTag}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # Optional Arc private link scope resource id to link the Arc agent. + ${ConfigurationPrivateLinkScope}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # Optional HTTP proxy endpoint to use for the Arc agent. + ${ConfigurationProxy}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Default")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The scanning mode for the VM scan. + ${ConfigurationScanningMode}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Qualys", "TVM")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The Vulnerability Assessment solution to be provisioned. + # Can be either 'TVM' or 'Qualys'. + ${ConfigurationType}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The cloud role ARN in AWS for this feature. + ${DefenderForServerCloudRoleArn}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAny] + # configuration for Microsoft Defender for Endpoint autoprovisioning. + ${MdeAutoProvisioningConfiguration}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.Boolean] + # Is Microsoft Defender for Endpoint auto provisioning enabled. + ${MdeAutoProvisioningEnabled}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("P1", "P2")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The available sub plans. + ${SubPlanType}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.Boolean] + # Is Microsoft Defender for Server VM scanning enabled. + ${VMScannerEnabled}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.Boolean] + # Is Vulnerability Assessment auto provisioning enabled. + ${VaAutoProvisioningEnabled} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + __AllParameterSets = 'Az.Security.custom\New-AzSecurityDefenderForServersAwsOfferingObject'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Security/Security.Autorest/exports/New-AzSecurityDefenderForServersGcpOfferingObject.ps1 b/src/Security/Security.Autorest/exports/New-AzSecurityDefenderForServersGcpOfferingObject.ps1 new file mode 100644 index 000000000000..dc39ed54a34f --- /dev/null +++ b/src/Security/Security.Autorest/exports/New-AzSecurityDefenderForServersGcpOfferingObject.ps1 @@ -0,0 +1,206 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create an in-memory object for DefenderForServersGcpOffering. +.Description +Create an in-memory object for DefenderForServersGcpOffering. +.Example +$emailSuffix = "myproject.iam.gserviceaccount.com" +New-AzSecurityDefenderForServersGcpOfferingObject ` + -DefenderForServerServiceAccountEmailAddress "microsoft-defender-for-servers@$emailSuffix" -DefenderForServerWorkloadIdentityProviderId "defender-for-servers" ` + -ArcAutoProvisioningEnabled $true -MdeAutoProvisioningEnabled $true -VaAutoProvisioningEnabled $true -ConfigurationType TVM ` + -VMScannerEnabled $true -ConfigurationScanningMode Default ` + -SubPlanType P2 + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOffering +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +CONFIGURATIONEXCLUSIONTAG : VM tags that indicate that VM should not be scanned. + [(Any) ]: This indicates any property can be added to this object. +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritydefenderforserversgcpofferingobject +#> +function New-AzSecurityDefenderForServersGcpOfferingObject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOffering])] +[CmdletBinding(PositionalBinding=$false)] +param( + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.Boolean] + # Is arc auto provisioning enabled. + ${ArcAutoProvisioningEnabled}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersConfigurationExclusionTags] + # VM tags that indicate that VM should not be scanned. + # . + ${ConfigurationExclusionTag}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # Optional Arc private link scope resource id to link the Arc agent. + ${ConfigurationPrivateLinkScope}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # Optional HTTP proxy endpoint to use for the Arc agent. + ${ConfigurationProxy}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Default")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The scanning mode for the VM scan. + ${ConfigurationScanningMode}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Qualys", "TVM")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The Vulnerability Assessment solution to be provisioned. + # Can be either 'TVM' or 'Qualys'. + ${ConfigurationType}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The service account email address in GCP for this feature. + ${DefenderForServerServiceAccountEmailAddress}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The workload identity provider id in GCP for this feature. + ${DefenderForServerWorkloadIdentityProviderId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAny] + # configuration for Microsoft Defender for Endpoint autoprovisioning. + ${MdeAutoProvisioningConfiguration}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.Boolean] + # Is Microsoft Defender for Endpoint auto provisioning enabled. + ${MdeAutoProvisioningEnabled}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("P1", "P2")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The available sub plans. + ${SubPlanType}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.Boolean] + # Is Microsoft Defender for Server VM scanning enabled. + ${VMScannerEnabled}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.Boolean] + # Is Vulnerability Assessment auto provisioning enabled. + ${VaAutoProvisioningEnabled} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + __AllParameterSets = 'Az.Security.custom\New-AzSecurityDefenderForServersGcpOfferingObject'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Security/Security.Autorest/exports/New-AzSecurityGcpOrganizationalDataMemberObject.ps1 b/src/Security/Security.Autorest/exports/New-AzSecurityGcpOrganizationalDataMemberObject.ps1 new file mode 100644 index 000000000000..c3bd0052150d --- /dev/null +++ b/src/Security/Security.Autorest/exports/New-AzSecurityGcpOrganizationalDataMemberObject.ps1 @@ -0,0 +1,123 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create an in-memory object for GcpOrganizationalDataMember. +.Description +Create an in-memory object for GcpOrganizationalDataMember. +.Example +New-AzSecurityGcpOrganizationalDataMemberObject -ManagementProjectNumber "12345" -ParentHierarchyId "00000" + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GcpOrganizationalDataMember +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritygcporganizationaldatamemberobject +#> +function New-AzSecurityGcpOrganizationalDataMemberObject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GcpOrganizationalDataMember])] +[CmdletBinding(PositionalBinding=$false)] +param( + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The GCP management project number from organizational onboarding. + ${ManagementProjectNumber}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # If the multi cloud account is not of membership type organization, this will be the ID of the project's parent. + ${ParentHierarchyId} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + __AllParameterSets = 'Az.Security.custom\New-AzSecurityGcpOrganizationalDataMemberObject'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Security/Security.Autorest/exports/New-AzSecurityGcpOrganizationalDataOrganizationObject.ps1 b/src/Security/Security.Autorest/exports/New-AzSecurityGcpOrganizationalDataOrganizationObject.ps1 new file mode 100644 index 000000000000..6f1d1636fea7 --- /dev/null +++ b/src/Security/Security.Autorest/exports/New-AzSecurityGcpOrganizationalDataOrganizationObject.ps1 @@ -0,0 +1,129 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create an in-memory object for GcpOrganizationalDataOrganization. +.Description +Create an in-memory object for GcpOrganizationalDataOrganization. +.Example +New-AzSecurityGcpOrganizationalDataOrganizationObject -WorkloadIdentityProviderId "provider" -ServiceAccountEmailAddress "my@email.com" -ExcludedProjectNumber @(1,2) + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GcpOrganizationalDataOrganization +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritygcporganizationaldataorganizationobject +#> +function New-AzSecurityGcpOrganizationalDataOrganizationObject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GcpOrganizationalDataOrganization])] +[CmdletBinding(PositionalBinding=$false)] +param( + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String[]] + # If the multi cloud account is of membership type organization, list of accounts excluded from offering. + ${ExcludedProjectNumber}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The service account email address which represents the organization level permissions container. + ${ServiceAccountEmailAddress}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The GCP workload identity provider id which represents the permissions required to auto provision security connectors. + ${WorkloadIdentityProviderId} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + __AllParameterSets = 'Az.Security.custom\New-AzSecurityGcpOrganizationalDataOrganizationObject'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Security/Security.Autorest/exports/New-AzSecurityGcpProjectEnvironmentObject.ps1 b/src/Security/Security.Autorest/exports/New-AzSecurityGcpProjectEnvironmentObject.ps1 new file mode 100644 index 000000000000..91f50e92c2f3 --- /dev/null +++ b/src/Security/Security.Autorest/exports/New-AzSecurityGcpProjectEnvironmentObject.ps1 @@ -0,0 +1,144 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create an in-memory object for GcpProjectEnvironment. +.Description +Create an in-memory object for GcpProjectEnvironment. +.Example +$orgData = New-AzSecurityGcpOrganizationalDataOrganizationObject -WorkloadIdentityProviderId "provider" -ServiceAccountEmailAddress "my@email.com" -ExcludedProjectNumber @(1,2) +New-AzSecurityGcpProjectEnvironmentObject -ProjectDetailProjectId "asc-sdk-samples" -ScanInterval 24 -OrganizationalData $orgData -ProjectDetailProjectNumber "1234" + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GcpProjectEnvironment +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +ORGANIZATIONALDATA : The Gcp project's organizational data. + OrganizationMembershipType : The multi cloud account's membership type in the organization +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritygcpprojectenvironmentobject +#> +function New-AzSecurityGcpProjectEnvironmentObject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GcpProjectEnvironment])] +[CmdletBinding(PositionalBinding=$false)] +param( + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalData] + # The Gcp project's organizational data. + # . + ${OrganizationalData}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The GCP Project id. + ${ProjectDetailProjectId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The unique GCP Project number. + ${ProjectDetailProjectNumber}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.Int64] + # Scan interval in hours (value should be between 1-hour to 24-hours). + ${ScanInterval} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + __AllParameterSets = 'Az.Security.custom\New-AzSecurityGcpProjectEnvironmentObject'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Security/Security.Autorest/exports/New-AzSecurityGitHubScopeEnvironmentObject.ps1 b/src/Security/Security.Autorest/exports/New-AzSecurityGitHubScopeEnvironmentObject.ps1 new file mode 100644 index 000000000000..501ec9760f4a --- /dev/null +++ b/src/Security/Security.Autorest/exports/New-AzSecurityGitHubScopeEnvironmentObject.ps1 @@ -0,0 +1,111 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create an in-memory object for GitHubScopeEnvironment. +.Description +Create an in-memory object for GitHubScopeEnvironment. +.Example +New-AzSecurityGitHubScopeEnvironmentObject + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitHubScopeEnvironment +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritygithubscopeenvironmentobject +#> +function New-AzSecurityGitHubScopeEnvironmentObject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitHubScopeEnvironment])] +[CmdletBinding(PositionalBinding=$false)] +param() + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + __AllParameterSets = 'Az.Security.custom\New-AzSecurityGitHubScopeEnvironmentObject'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Security/Security.Autorest/exports/New-AzSecurityGitLabScopeEnvironmentObject.ps1 b/src/Security/Security.Autorest/exports/New-AzSecurityGitLabScopeEnvironmentObject.ps1 new file mode 100644 index 000000000000..c0941917b88a --- /dev/null +++ b/src/Security/Security.Autorest/exports/New-AzSecurityGitLabScopeEnvironmentObject.ps1 @@ -0,0 +1,111 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create an in-memory object for GitLabScopeEnvironment. +.Description +Create an in-memory object for GitLabScopeEnvironment. +.Example +New-AzSecurityGitLabScopeEnvironmentObject + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitLabScopeEnvironment +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritygitlabscopeenvironmentobject +#> +function New-AzSecurityGitLabScopeEnvironmentObject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitLabScopeEnvironment])] +[CmdletBinding(PositionalBinding=$false)] +param() + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + __AllParameterSets = 'Az.Security.custom\New-AzSecurityGitLabScopeEnvironmentObject'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Security/Security.Autorest/exports/New-AzSecurityInformationProtectionAwsOfferingObject.ps1 b/src/Security/Security.Autorest/exports/New-AzSecurityInformationProtectionAwsOfferingObject.ps1 new file mode 100644 index 000000000000..6bd70c3b75d0 --- /dev/null +++ b/src/Security/Security.Autorest/exports/New-AzSecurityInformationProtectionAwsOfferingObject.ps1 @@ -0,0 +1,117 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create an in-memory object for InformationProtectionAwsOffering. +.Description +Create an in-memory object for InformationProtectionAwsOffering. +.Example +New-AzSecurityInformationProtectionAwsOfferingObject -InformationProtectionCloudRoleArn "arn:aws:iam::123456789012:role/myRole" + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.InformationProtectionAwsOffering +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecurityinformationprotectionawsofferingobject +#> +function New-AzSecurityInformationProtectionAwsOfferingObject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.InformationProtectionAwsOffering])] +[CmdletBinding(PositionalBinding=$false)] +param( + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The cloud role ARN in AWS for this feature. + ${InformationProtectionCloudRoleArn} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + __AllParameterSets = 'Az.Security.custom\New-AzSecurityInformationProtectionAwsOfferingObject'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Security/Security.Autorest/exports/ProxyCmdletDefinitions.ps1 b/src/Security/Security.Autorest/exports/ProxyCmdletDefinitions.ps1 new file mode 100644 index 000000000000..1056c4bf17bf --- /dev/null +++ b/src/Security/Security.Autorest/exports/ProxyCmdletDefinitions.ps1 @@ -0,0 +1,8503 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Gets an Azure API Management API if it has been onboarded to Microsoft Defender for APIs. +If an Azure API Management API is onboarded to Microsoft Defender for APIs, the system will monitor the operations within the Azure API Management API for intrusive behaviors and provide alerts for attacks that have been detected. +.Description +Gets an Azure API Management API if it has been onboarded to Microsoft Defender for APIs. +If an Azure API Management API is onboarded to Microsoft Defender for APIs, the system will monitor the operations within the Azure API Management API for intrusive behaviors and provide alerts for attacks that have been detected. +.Example +Get-AzSecurityApiCollection -ResourceGroupName apicollectionstests -ServiceName "demoapimservice2" -ApiId "echo-api" +.Example +Get-AzSecurityApiCollection -ResourceGroupName "apicollectionstests" -ServiceName "demoapimservice2" +.Example +Get-AzSecurityApiCollection + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollection +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ApiId ]: API revision identifier. Must be unique in the API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + [GroupFqName ]: The GitLab group fully-qualified name. + [Id ]: Resource identity path + [OperationResultId ]: The operation result Id. + [OrgName ]: The Azure DevOps organization name. + [OwnerName ]: The GitHub owner name. + [ProjectName ]: The project name. + [RepoName ]: The repository name. + [ResourceGroupName ]: The name of the resource group within the user's subscription. The name is case insensitive. + [SecurityConnectorName ]: The security connector name. + [ServiceName ]: The name of the API Management service. + [SubscriptionId ]: Azure subscription ID +.Link +https://learn.microsoft.com/powershell/module/az.security/get-azsecurityapicollection +#> +function Get-AzSecurityApiCollection { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollection])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # API revision identifier. + # Must be unique in the API Management service instance. + # Non-current revision has ;rev=n as a suffix where n is the revision number. + ${ApiId}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List1', Mandatory)] + [Parameter(ParameterSetName='List2', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List2', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The name of the API Management service. + ${ServiceName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Parameter(ParameterSetName='List1')] + [Parameter(ParameterSetName='List2')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Azure subscription ID + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity] + # Identity Parameter + # . + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait forNET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.Security.private\Get-AzSecurityApiCollection_Get'; + GetViaIdentity = 'Az.Security.private\Get-AzSecurityApiCollection_GetViaIdentity'; + List = 'Az.Security.private\Get-AzSecurityApiCollection_List'; + List1 = 'Az.Security.private\Get-AzSecurityApiCollection_List1'; + List2 = 'Az.Security.private\Get-AzSecurityApiCollection_List2'; + } + if (('Get', 'List', 'List1', 'List2') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Returns a list of all Azure DevOps organizations accessible by the user token consumed by the connector. +.Description +Returns a list of all Azure DevOps organizations accessible by the user token consumed by the connector. +.Example +Get-AzSecurityConnectorAzureDevOpsOrgAvailable -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-azdo-01 + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgListResponse +.Link +https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorazuredevopsorgavailable +#> +function Get-AzSecurityConnectorAzureDevOpsOrgAvailable { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgListResponse])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The security connector name. + ${SecurityConnectorName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Azure subscription ID + ${SubscriptionId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait forNET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + List = 'Az.Security.private\Get-AzSecurityConnectorAzureDevOpsOrgAvailable_List'; + } + if (('List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Returns a monitored Azure DevOps organization resource. +.Description +Returns a monitored Azure DevOps organization resource. +.Example +Get-AzSecurityConnectorAzureDevOpsOrg -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-azdo-01 -OrgName dfdsdktests +.Example +Get-AzSecurityConnectorAzureDevOpsOrg -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-azdo-01 + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrg +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ApiId ]: API revision identifier. Must be unique in the API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + [GroupFqName ]: The GitLab group fully-qualified name. + [Id ]: Resource identity path + [OperationResultId ]: The operation result Id. + [OrgName ]: The Azure DevOps organization name. + [OwnerName ]: The GitHub owner name. + [ProjectName ]: The project name. + [RepoName ]: The repository name. + [ResourceGroupName ]: The name of the resource group within the user's subscription. The name is case insensitive. + [SecurityConnectorName ]: The security connector name. + [ServiceName ]: The name of the API Management service. + [SubscriptionId ]: Azure subscription ID +.Link +https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorazuredevopsorg +#> +function Get-AzSecurityConnectorAzureDevOpsOrg { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrg])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The Azure DevOps organization name. + ${OrgName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The security connector name. + ${SecurityConnectorName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Azure subscription ID + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity] + # Identity Parameter + # . + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait forNET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.Security.private\Get-AzSecurityConnectorAzureDevOpsOrg_Get'; + GetViaIdentity = 'Az.Security.private\Get-AzSecurityConnectorAzureDevOpsOrg_GetViaIdentity'; + List = 'Az.Security.private\Get-AzSecurityConnectorAzureDevOpsOrg_List'; + } + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Returns a monitored Azure DevOps project resource. +.Description +Returns a monitored Azure DevOps project resource. +.Example +Get-AzSecurityConnectorAzureDevOpsProject -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-azdo-01 -OrgName dfdsdktests -ProjectName ContosoSDKDfd +.Example +Get-AzSecurityConnectorAzureDevOpsProject -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-azdo-01 -OrgName dfdsdktests + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProject +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ApiId ]: API revision identifier. Must be unique in the API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + [GroupFqName ]: The GitLab group fully-qualified name. + [Id ]: Resource identity path + [OperationResultId ]: The operation result Id. + [OrgName ]: The Azure DevOps organization name. + [OwnerName ]: The GitHub owner name. + [ProjectName ]: The project name. + [RepoName ]: The repository name. + [ResourceGroupName ]: The name of the resource group within the user's subscription. The name is case insensitive. + [SecurityConnectorName ]: The security connector name. + [ServiceName ]: The name of the API Management service. + [SubscriptionId ]: Azure subscription ID +.Link +https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorazuredevopsproject +#> +function Get-AzSecurityConnectorAzureDevOpsProject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProject])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The Azure DevOps organization name. + ${OrgName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The project name. + ${ProjectName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The security connector name. + ${SecurityConnectorName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Azure subscription ID + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity] + # Identity Parameter + # . + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait forNET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.Security.private\Get-AzSecurityConnectorAzureDevOpsProject_Get'; + GetViaIdentity = 'Az.Security.private\Get-AzSecurityConnectorAzureDevOpsProject_GetViaIdentity'; + List = 'Az.Security.private\Get-AzSecurityConnectorAzureDevOpsProject_List'; + } + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Returns a monitored Azure DevOps repository resource. +.Description +Returns a monitored Azure DevOps repository resource. +.Example +Get-AzSecurityConnectorAzureDevOpsRepo -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-azdo-01 -OrgName dfdsdktests -ProjectName ContosoSDKDfd -RepoName TestApp0 +.Example +Get-AzSecurityConnectorAzureDevOpsRepo -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-azdo-01 -OrgName dfdsdktests -ProjectName ContosoSDKDfd + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepository +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ApiId ]: API revision identifier. Must be unique in the API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + [GroupFqName ]: The GitLab group fully-qualified name. + [Id ]: Resource identity path + [OperationResultId ]: The operation result Id. + [OrgName ]: The Azure DevOps organization name. + [OwnerName ]: The GitHub owner name. + [ProjectName ]: The project name. + [RepoName ]: The repository name. + [ResourceGroupName ]: The name of the resource group within the user's subscription. The name is case insensitive. + [SecurityConnectorName ]: The security connector name. + [ServiceName ]: The name of the API Management service. + [SubscriptionId ]: Azure subscription ID +.Link +https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorazuredevopsrepo +#> +function Get-AzSecurityConnectorAzureDevOpsRepo { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepository])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The Azure DevOps organization name. + ${OrgName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The project name. + ${ProjectName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The repository name. + ${RepoName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The security connector name. + ${SecurityConnectorName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Azure subscription ID + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity] + # Identity Parameter + # . + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait forNET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.Security.private\Get-AzSecurityConnectorAzureDevOpsRepo_Get'; + GetViaIdentity = 'Az.Security.private\Get-AzSecurityConnectorAzureDevOpsRepo_GetViaIdentity'; + List = 'Az.Security.private\Get-AzSecurityConnectorAzureDevOpsRepo_List'; + } + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Gets a DevOps Configuration. +.Description +Gets a DevOps Configuration. +.Example +Get-AzSecurityConnectorDevOpsConfiguration -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-azdo-01 +.Example +Get-AzSecurityConnectorDevOpsConfiguration -ResourceGroupName securityconnectors-tests -SecurityConnectorName aws-sdktest01 + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfiguration +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ApiId ]: API revision identifier. Must be unique in the API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + [GroupFqName ]: The GitLab group fully-qualified name. + [Id ]: Resource identity path + [OperationResultId ]: The operation result Id. + [OrgName ]: The Azure DevOps organization name. + [OwnerName ]: The GitHub owner name. + [ProjectName ]: The project name. + [RepoName ]: The repository name. + [ResourceGroupName ]: The name of the resource group within the user's subscription. The name is case insensitive. + [SecurityConnectorName ]: The security connector name. + [ServiceName ]: The name of the API Management service. + [SubscriptionId ]: Azure subscription ID +.Link +https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectordevopsconfiguration +#> +function Get-AzSecurityConnectorDevOpsConfiguration { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfiguration])] +[CmdletBinding(DefaultParameterSetName='Get', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The security connector name. + ${SecurityConnectorName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Azure subscription ID + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity] + # Identity Parameter + # . + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait forNET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.Security.private\Get-AzSecurityConnectorDevOpsConfiguration_Get'; + GetViaIdentity = 'Az.Security.private\Get-AzSecurityConnectorDevOpsConfiguration_GetViaIdentity'; + List = 'Az.Security.private\Get-AzSecurityConnectorDevOpsConfiguration_List'; + } + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Returns a list of all GitHub owners accessible by the user token consumed by the connector. +.Description +Returns a list of all GitHub owners accessible by the user token consumed by the connector. +.Example +Get-AzSecurityConnectorGitHubOwnerAvailable -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-gh-01 + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerListResponse +.Link +https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorgithubowneravailable +#> +function Get-AzSecurityConnectorGitHubOwnerAvailable { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerListResponse])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The security connector name. + ${SecurityConnectorName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Azure subscription ID + ${SubscriptionId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait forNET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + List = 'Az.Security.private\Get-AzSecurityConnectorGitHubOwnerAvailable_List'; + } + if (('List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Returns a monitored GitHub owner. +.Description +Returns a monitored GitHub owner. +.Example +Get-AzSecurityConnectorGitHubOwner -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-gh-01 -OwnerName dfdsdktests +.Example +Get-AzSecurityConnectorGitHubOwner -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-gh-01 + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwner +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ApiId ]: API revision identifier. Must be unique in the API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + [GroupFqName ]: The GitLab group fully-qualified name. + [Id ]: Resource identity path + [OperationResultId ]: The operation result Id. + [OrgName ]: The Azure DevOps organization name. + [OwnerName ]: The GitHub owner name. + [ProjectName ]: The project name. + [RepoName ]: The repository name. + [ResourceGroupName ]: The name of the resource group within the user's subscription. The name is case insensitive. + [SecurityConnectorName ]: The security connector name. + [ServiceName ]: The name of the API Management service. + [SubscriptionId ]: Azure subscription ID +.Link +https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorgithubowner +#> +function Get-AzSecurityConnectorGitHubOwner { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwner])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The GitHub owner name. + ${OwnerName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The security connector name. + ${SecurityConnectorName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Azure subscription ID + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity] + # Identity Parameter + # . + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait forNET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.Security.private\Get-AzSecurityConnectorGitHubOwner_Get'; + GetViaIdentity = 'Az.Security.private\Get-AzSecurityConnectorGitHubOwner_GetViaIdentity'; + List = 'Az.Security.private\Get-AzSecurityConnectorGitHubOwner_List'; + } + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Returns a monitored GitHub repository. +.Description +Returns a monitored GitHub repository. +.Example +Get-AzSecurityConnectorGitHubRepo -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-gh-01 -OwnerName dfdsdktests -RepoName TestApp0 +.Example +Get-AzSecurityConnectorGitHubRepo -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-gh-01 -OwnerName dfdsdktests + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepository +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ApiId ]: API revision identifier. Must be unique in the API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + [GroupFqName ]: The GitLab group fully-qualified name. + [Id ]: Resource identity path + [OperationResultId ]: The operation result Id. + [OrgName ]: The Azure DevOps organization name. + [OwnerName ]: The GitHub owner name. + [ProjectName ]: The project name. + [RepoName ]: The repository name. + [ResourceGroupName ]: The name of the resource group within the user's subscription. The name is case insensitive. + [SecurityConnectorName ]: The security connector name. + [ServiceName ]: The name of the API Management service. + [SubscriptionId ]: Azure subscription ID +.Link +https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorgithubrepo +#> +function Get-AzSecurityConnectorGitHubRepo { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepository])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The GitHub owner name. + ${OwnerName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The repository name. + ${RepoName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The security connector name. + ${SecurityConnectorName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Azure subscription ID + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity] + # Identity Parameter + # . + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait forNET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.Security.private\Get-AzSecurityConnectorGitHubRepo_Get'; + GetViaIdentity = 'Az.Security.private\Get-AzSecurityConnectorGitHubRepo_GetViaIdentity'; + List = 'Az.Security.private\Get-AzSecurityConnectorGitHubRepo_List'; + } + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Returns a list of all GitLab groups accessible by the user token consumed by the connector. +.Description +Returns a list of all GitLab groups accessible by the user token consumed by the connector. +.Example +Get-AzSecurityConnectorGitLabGroupAvailable -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-gl-01 + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupListResponse +.Link +https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorgitlabgroupavailable +#> +function Get-AzSecurityConnectorGitLabGroupAvailable { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupListResponse])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The security connector name. + ${SecurityConnectorName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Azure subscription ID + ${SubscriptionId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait forNET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + List = 'Az.Security.private\Get-AzSecurityConnectorGitLabGroupAvailable_List'; + } + if (('List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Returns a monitored GitLab Group resource for a given fully-qualified name. +.Description +Returns a monitored GitLab Group resource for a given fully-qualified name. +.Example +Get-AzSecurityConnectorGitLabGroup -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-gl-01 -GroupFqName dfdsdktests +.Example +Get-AzSecurityConnectorGitLabGroup -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-gl-01 + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroup +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ApiId ]: API revision identifier. Must be unique in the API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + [GroupFqName ]: The GitLab group fully-qualified name. + [Id ]: Resource identity path + [OperationResultId ]: The operation result Id. + [OrgName ]: The Azure DevOps organization name. + [OwnerName ]: The GitHub owner name. + [ProjectName ]: The project name. + [RepoName ]: The repository name. + [ResourceGroupName ]: The name of the resource group within the user's subscription. The name is case insensitive. + [SecurityConnectorName ]: The security connector name. + [ServiceName ]: The name of the API Management service. + [SubscriptionId ]: Azure subscription ID +.Link +https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorgitlabgroup +#> +function Get-AzSecurityConnectorGitLabGroup { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroup])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The GitLab group fully-qualified name. + ${GroupFqName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The security connector name. + ${SecurityConnectorName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Azure subscription ID + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity] + # Identity Parameter + # . + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait forNET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.Security.private\Get-AzSecurityConnectorGitLabGroup_Get'; + GetViaIdentity = 'Az.Security.private\Get-AzSecurityConnectorGitLabGroup_GetViaIdentity'; + List = 'Az.Security.private\Get-AzSecurityConnectorGitLabGroup_List'; + } + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Returns a monitored GitLab Project resource for a given fully-qualified group name and project name. +.Description +Returns a monitored GitLab Project resource for a given fully-qualified group name and project name. +.Example +Get-AzSecurityConnectorGitLabProject -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-gl-01 -GroupFqName dfdsdktests -ProjectName testapp0 +.Example +Get-AzSecurityConnectorGitLabProject -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-gl-01 -GroupFqName dfdsdktests + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProject +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ApiId ]: API revision identifier. Must be unique in the API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + [GroupFqName ]: The GitLab group fully-qualified name. + [Id ]: Resource identity path + [OperationResultId ]: The operation result Id. + [OrgName ]: The Azure DevOps organization name. + [OwnerName ]: The GitHub owner name. + [ProjectName ]: The project name. + [RepoName ]: The repository name. + [ResourceGroupName ]: The name of the resource group within the user's subscription. The name is case insensitive. + [SecurityConnectorName ]: The security connector name. + [ServiceName ]: The name of the API Management service. + [SubscriptionId ]: Azure subscription ID +.Link +https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorgitlabproject +#> +function Get-AzSecurityConnectorGitLabProject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProject])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The GitLab group fully-qualified name. + ${GroupFqName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The project name. + ${ProjectName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The security connector name. + ${SecurityConnectorName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Azure subscription ID + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity] + # Identity Parameter + # . + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait forNET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.Security.private\Get-AzSecurityConnectorGitLabProject_Get'; + GetViaIdentity = 'Az.Security.private\Get-AzSecurityConnectorGitLabProject_GetViaIdentity'; + List = 'Az.Security.private\Get-AzSecurityConnectorGitLabProject_List'; + } + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Gets nested subgroups of given GitLab Group which are onboarded to the connector. +.Description +Gets nested subgroups of given GitLab Group which are onboarded to the connector. +.Example +Get-AzSecurityConnectorGitLabSubgroup -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-gl-01 -GroupFqName dfdsdktests + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupListResponse +.Link +https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorgitlabsubgroup +#> +function Get-AzSecurityConnectorGitLabSubgroup { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupListResponse])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The GitLab group fully-qualified name. + ${GroupFqName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The security connector name. + ${SecurityConnectorName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Azure subscription ID + ${SubscriptionId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait forNET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + List = 'Az.Security.private\Get-AzSecurityConnectorGitLabSubgroup_List'; + } + if (('List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Retrieves details of a specific security connector +.Description +Retrieves details of a specific security connector +.Example +Get-AzSecurityConnector -ResourceGroupName "dfdtest-sdk" -Name "dfdsdktests-azdo-01" +.Example +Get-AzSecurityConnector + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnector +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ApiId ]: API revision identifier. Must be unique in the API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + [GroupFqName ]: The GitLab group fully-qualified name. + [Id ]: Resource identity path + [OperationResultId ]: The operation result Id. + [OrgName ]: The Azure DevOps organization name. + [OwnerName ]: The GitHub owner name. + [ProjectName ]: The project name. + [RepoName ]: The repository name. + [ResourceGroupName ]: The name of the resource group within the user's subscription. The name is case insensitive. + [SecurityConnectorName ]: The security connector name. + [ServiceName ]: The name of the API Management service. + [SubscriptionId ]: Azure subscription ID +.Link +https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnector +#> +function Get-AzSecurityConnector { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnector])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Alias('SecurityConnectorName')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The security connector name. + ${Name}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List1', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The name of the resource group within the user's subscription. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Parameter(ParameterSetName='List1')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Azure subscription ID + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity] + # Identity Parameter + # . + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait forNET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.Security.private\Get-AzSecurityConnector_Get'; + GetViaIdentity = 'Az.Security.private\Get-AzSecurityConnector_GetViaIdentity'; + List = 'Az.Security.private\Get-AzSecurityConnector_List'; + List1 = 'Az.Security.private\Get-AzSecurityConnector_List1'; + } + if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Offboard an Azure API Management API from Microsoft Defender for APIs. +The system will stop monitoring the operations within the Azure API Management API for intrusive behaviors. +.Description +Offboard an Azure API Management API from Microsoft Defender for APIs. +The system will stop monitoring the operations within the Azure API Management API for intrusive behaviors. +.Example +Invoke-AzSecurityApiCollectionApimOffboard -ResourceGroupName "apicollectionstests" -ServiceName "demoapimservice2" -ApiId "echo-api-2" + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ApiId ]: API revision identifier. Must be unique in the API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + [GroupFqName ]: The GitLab group fully-qualified name. + [Id ]: Resource identity path + [OperationResultId ]: The operation result Id. + [OrgName ]: The Azure DevOps organization name. + [OwnerName ]: The GitHub owner name. + [ProjectName ]: The project name. + [RepoName ]: The repository name. + [ResourceGroupName ]: The name of the resource group within the user's subscription. The name is case insensitive. + [SecurityConnectorName ]: The security connector name. + [ServiceName ]: The name of the API Management service. + [SubscriptionId ]: Azure subscription ID +.Link +https://learn.microsoft.com/powershell/module/az.security/invoke-azsecurityapicollectionapimoffboard +#> +function Invoke-AzSecurityApiCollectionApimOffboard { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # API revision identifier. + # Must be unique in the API Management service instance. + # Non-current revision has ;rev=n as a suffix where n is the revision number. + ${ApiId}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The name of the API Management service. + ${ServiceName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Azure subscription ID + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity] + # Identity Parameter + # . + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait forNET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Delete = 'Az.Security.private\Invoke-AzSecurityApiCollectionApimOffboard_Delete'; + DeleteViaIdentity = 'Az.Security.private\Invoke-AzSecurityApiCollectionApimOffboard_DeleteViaIdentity'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Onboard an Azure API Management API to Microsoft Defender for APIs. +The system will start monitoring the operations within the Azure Management API for intrusive behaviors and provide alerts for attacks that have been detected. +.Description +Onboard an Azure API Management API to Microsoft Defender for APIs. +The system will start monitoring the operations within the Azure Management API for intrusive behaviors and provide alerts for attacks that have been detected. +.Example +Invoke-AzSecurityApiCollectionApimOnboard -ResourceGroupName "apicollectionstests" -ServiceName "demoapimservice2" -ApiId "echo-api-2" + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollection +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ApiId ]: API revision identifier. Must be unique in the API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + [GroupFqName ]: The GitLab group fully-qualified name. + [Id ]: Resource identity path + [OperationResultId ]: The operation result Id. + [OrgName ]: The Azure DevOps organization name. + [OwnerName ]: The GitHub owner name. + [ProjectName ]: The project name. + [RepoName ]: The repository name. + [ResourceGroupName ]: The name of the resource group within the user's subscription. The name is case insensitive. + [SecurityConnectorName ]: The security connector name. + [ServiceName ]: The name of the API Management service. + [SubscriptionId ]: Azure subscription ID +.Link +https://learn.microsoft.com/powershell/module/az.security/invoke-azsecurityapicollectionapimonboard +#> +function Invoke-AzSecurityApiCollectionApimOnboard { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollection])] +[CmdletBinding(DefaultParameterSetName='Azure', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Azure', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # API revision identifier. + # Must be unique in the API Management service instance. + # Non-current revision has ;rev=n as a suffix where n is the revision number. + ${ApiId}, + + [Parameter(ParameterSetName='Azure', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Azure', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The name of the API Management service. + ${ServiceName}, + + [Parameter(ParameterSetName='Azure')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Azure subscription ID + ${SubscriptionId}, + + [Parameter(ParameterSetName='AzureViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity] + # Identity Parameter + # . + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait forNET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Azure = 'Az.Security.private\Invoke-AzSecurityApiCollectionApimOnboard_Azure'; + AzureViaIdentity = 'Az.Security.private\Invoke-AzSecurityApiCollectionApimOnboard_AzureViaIdentity'; + } + if (('Azure') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Create a DevOps Configuration. +.Description +Create a DevOps Configuration. +.Example +New-AzSecurityConnectorDevOpsConfiguration -ResourceGroupName "securityconnectors-pwsh-tmp" -SecurityConnectorName "ado-sdk-pwsh-test03" -AutoDiscovery Disabled -TopLevelInventoryList @("org1", "org2") -AuthorizationCode "myAuthorizationCode" + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfiguration +.Link +https://learn.microsoft.com/powershell/module/az.security/new-azsecurityconnectordevopsconfiguration +#> +function New-AzSecurityConnectorDevOpsConfiguration { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfiguration])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The security connector name. + ${SecurityConnectorName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Azure subscription ID + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # Gets or sets one-time OAuth code to exchange for refresh and access tokens.Only used during PUT/PATCH operations. + # The secret is cleared during GET. + ${AuthorizationCode}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Disabled", "Enabled", "NotApplicable")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # AutoDiscovery states. + ${AutoDiscovery}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String[]] + # List of top-level inventory to select when AutoDiscovery is disabled.This field is ignored when AutoDiscovery is enabled. + ${TopLevelInventoryList}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait forNET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + CreateExpanded = 'Az.Security.private\New-AzSecurityConnectorDevOpsConfiguration_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Create a security connector. +If a security connector is already created and a subsequent request is issued for the same security connector id, then it will be updated. +.Description +Create a security connector. +If a security connector is already created and a subsequent request is issued for the same security connector id, then it will be updated. +.Example +$account = "891376984375" +$arnPrefix = "arn:aws:iam::$($account):role" + +$cspmMonitorOffering = New-AzSecurityCspmMonitorAwsOfferingObject -NativeCloudConnectionCloudRoleArn "$arnPrefix/CspmMonitorAws" + +$dcspmOffering = New-AzSecurityDefenderCspmAwsOfferingObject ` + -VMScannerEnabled $true -ConfigurationScanningMode Default -ConfigurationCloudRoleArn "$arnPrefix/DefenderForCloud-AgentlessScanner" ` + -DataSensitivityDiscoveryEnabled $true -DataSensitivityDiscoveryCloudRoleArn "$arnPrefix/SensitiveDataDiscovery" ` + -DatabaseDspmEnabled $true -DatabaseDspmCloudRoleArn "$arnPrefix/DefenderForCloud-DataSecurityPostureDB" ` + -CiemDiscoveryCloudRoleArn "$arnPrefix/DefenderForCloud-Ciem" -CiemOidcAzureActiveDirectoryAppName "mciem-aws-oidc-connector" -CiemOidcCloudRoleArn "$arnPrefix/DefenderForCloud-OidcCiem" ` + -MdcContainerImageAssessmentEnabled $true -MdcContainerImageAssessmentCloudRoleArn "$arnPrefix/MDCContainersImageAssessmentRole" ` + -MdcContainerAgentlessDiscoveryK8SEnabled $true -MdcContainerAgentlessDiscoveryK8SCloudRoleArn "$arnPrefix/MDCContainersAgentlessDiscoveryK8sRole" + +$defenderForContainersOffering = New-AzSecurityDefenderForContainersAwsOfferingObject ` + -AutoProvisioning $true -KuberneteServiceCloudRoleArn "$arnPrefix/DefenderForCloud-Containers-K8s" -KuberneteScubaReaderCloudRoleArn "$arnPrefix/DefenderForCloud-DataCollection" ` + -KinesiToS3CloudRoleArn "$arnPrefix/DefenderForCloud-Containers-K8s-kinesis-to-s3" -CloudWatchToKinesiCloudRoleArn "$arnPrefix/DefenderForCloud-Containers-K8s-cloudwatch-to-kinesis" ` + -KubeAuditRetentionTime 30 -ScubaExternalId "a47ae0a2-7bf7-482a-897a-7a139d30736c" ` + -MdcContainerAgentlessDiscoveryK8SEnabled $true -MdcContainerAgentlessDiscoveryK8SCloudRoleArn "$arnPrefix/MDCContainersAgentlessDiscoveryK8sRole" ` + -MdcContainerImageAssessmentEnabled $true -MdcContainerImageAssessmentCloudRoleArn "$arnPrefix/MDCContainersImageAssessmentRole" ` + -EnableContainerVulnerabilityAssessment $false + +$environment = New-AzSecurityAwsEnvironmentObject -ScanInterval 24 + +New-AzSecurityConnector -Name "aws-sdktest01" -ResourceGroupName "securityConnectors-tests" ` + -EnvironmentData $environment -EnvironmentName AWS -HierarchyIdentifier "$account" ` + -Offering @($cspmMonitorOffering, $dcspmOffering, $defenderForContainersOffering) ` + -Location "CentralUS" +.Example +$account = "843025268399" +$emailSuffix = "myproject.iam.gserviceaccount.com" +$cspmMonitorOffering = New-AzSecurityCspmMonitorGcpOfferingObject -NativeCloudConnectionServiceAccountEmailAddress "microsoft-defender-cspm@$emailSuffix" -NativeCloudConnectionWorkloadIdentityProviderId "cspm" + +$dcspmOffering = New-AzSecurityDefenderCspmGcpOfferingObject ` + -VMScannerEnabled $true -ConfigurationScanningMode Default -ConfigurationExclusionTag @{key="value"} ` + -MdcContainerAgentlessDiscoveryK8SEnabled $true -MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress "mdc-containers-k8s-operator@$emailSuffix" -MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId "containers" ` + -MdcContainerImageAssessmentEnabled $true -MdcContainerImageAssessmentServiceAccountEmailAddress "mdc-containers-artifact-assess@$emailSuffix" -MdcContainerImageAssessmentWorkloadIdentityProviderId "containers" ` + -DataSensitivityDiscoveryEnabled $true -DataSensitivityDiscoveryServiceAccountEmailAddress "mdc-data-sec-posture-storage@$emailSuffix" -DataSensitivityDiscoveryWorkloadIdentityProviderId "data-security-posture-storage" ` + -CiemDiscoveryServiceAccountEmailAddress "microsoft-defender-ciem@$emailSuffix" -CiemDiscoveryAzureActiveDirectoryAppName "mciem-gcp-oidc-app" -CiemDiscoveryWorkloadIdentityProviderId "ciem-discovery" + +$defenderForContainersOffering = New-AzSecurityDefenderForContainersGcpOfferingObject ` + -NativeCloudConnectionServiceAccountEmailAddress "microsoft-defender-containers@$emailSuffix" -NativeCloudConnectionWorkloadIdentityProviderId "containers" ` + -DataPipelineNativeCloudConnectionServiceAccountEmailAddress "ms-defender-containers-stream@$emailSuffix" -DataPipelineNativeCloudConnectionWorkloadIdentityProviderId "containers-streams" ` + -AuditLogsAutoProvisioningFlag $true -DefenderAgentAutoProvisioningFlag $true -PolicyAgentAutoProvisioningFlag $true ` + -MdcContainerAgentlessDiscoveryK8SEnabled $true -MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId "containers" -MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress "mdc-containers-k8s-operator@$emailSuffix" ` + -MdcContainerImageAssessmentEnabled $true -MdcContainerImageAssessmentWorkloadIdentityProviderId "containers" -MdcContainerImageAssessmentServiceAccountEmailAddress "mdc-containers-artifact-assess@$emailSuffix" + +$environment = New-AzSecurityGcpProjectEnvironmentObject -ScanInterval 24 -ProjectDetailProjectId "asc-sdk-samples" -ProjectDetailProjectNumber "$account" + +New-AzSecurityConnector -Name "gcp-sdktest01" -ResourceGroupName "securityConnectors-tests" -EnvironmentData $environment -EnvironmentName GCP -HierarchyIdentifier "$account" ` + -Offering @($cspmMonitorOffering, $dcspmOffering, $defenderForContainersOffering) -Location "CentralUS" +.Example +New-AzSecurityConnector -ResourceGroupName "securityConnectors-pwsh-tmp" -Name "ado-sdk-pwsh-test03" ` + -EnvironmentName AzureDevOps -EnvironmentData (New-AzSecurityAzureDevOpsScopeEnvironmentObject) ` + -HierarchyIdentifier ([guid]::NewGuid().ToString()) -Location "CentralUS" ` + -Offering @(New-AzSecurityCspmMonitorAzureDevOpsOfferingObject) +.Example +New-AzSecurityConnector -ResourceGroupName "securityConnectors-pwsh-tmp" -Name "gh-sdk-pwsh-test03" ` + -EnvironmentName GitHub -EnvironmentData (New-AzSecurityGitHubScopeEnvironmentObject) ` + -HierarchyIdentifier ([guid]::NewGuid().ToString()) -Location "CentralUS" ` + -Offering @(New-AzSecurityCspmMonitorGithubOfferingObject) +.Example +New-AzSecurityConnector -ResourceGroupName "securityConnectors-pwsh-tmp" -Name "gl-sdk-pwsh-test03" ` + -EnvironmentName GitLab -EnvironmentData (New-AzSecurityGitLabScopeEnvironmentObject) ` + -HierarchyIdentifier ([guid]::NewGuid().ToString()) -Location "CentralUS" ` + -Offering @(New-AzSecurityCspmMonitorGitLabOfferingObject) + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnector +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +ENVIRONMENTDATA : The security connector environment data. + EnvironmentType : The type of the environment data. + +OFFERING : A collection of offerings for the security connector. + OfferingType : The type of the security offering. +.Link +https://learn.microsoft.com/powershell/module/az.security/new-azsecurityconnector +#> +function New-AzSecurityConnector { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnector])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('SecurityConnectorName')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The security connector name. + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The name of the resource group within the user's subscription. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Azure subscription ID + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironment] + # The security connector environment data. + # . + ${EnvironmentData}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Azure", "AWS", "GCP", "Github", "AzureDevOps", "GitLab")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The multi cloud resource's cloud name. + ${EnvironmentName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # Entity tag is used for comparing two or more entities from the same requested resource. + ${Etag}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The multi cloud resource identifier (account id in case of AWS connector, project number in case of GCP connector). + ${HierarchyIdentifier}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # Kind of the resource + ${Kind}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # Location where the resource is stored + ${Location}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOffering[]] + # A collection of offerings for the security connector. + # . + ${Offering}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITags]))] + [System.Collections.Hashtable] + # A list of key value pairs that describe the resource. + ${Tag}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait forNET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + CreateExpanded = 'Az.Security.private\New-AzSecurityConnector_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Deletes a DevOps Connector. +.Description +Deletes a DevOps Connector. +.Example +Remove-AzSecurityConnectorDevOpsConfiguration -ResourceGroupName "securityconnectors-pwsh-tmp" -SecurityConnectorName "ado-sdk-pwsh-test03" + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ApiId ]: API revision identifier. Must be unique in the API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + [GroupFqName ]: The GitLab group fully-qualified name. + [Id ]: Resource identity path + [OperationResultId ]: The operation result Id. + [OrgName ]: The Azure DevOps organization name. + [OwnerName ]: The GitHub owner name. + [ProjectName ]: The project name. + [RepoName ]: The repository name. + [ResourceGroupName ]: The name of the resource group within the user's subscription. The name is case insensitive. + [SecurityConnectorName ]: The security connector name. + [ServiceName ]: The name of the API Management service. + [SubscriptionId ]: Azure subscription ID +.Link +https://learn.microsoft.com/powershell/module/az.security/remove-azsecurityconnectordevopsconfiguration +#> +function Remove-AzSecurityConnectorDevOpsConfiguration { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The security connector name. + ${SecurityConnectorName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Azure subscription ID + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity] + # Identity Parameter + # . + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait forNET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Delete = 'Az.Security.private\Remove-AzSecurityConnectorDevOpsConfiguration_Delete'; + DeleteViaIdentity = 'Az.Security.private\Remove-AzSecurityConnectorDevOpsConfiguration_DeleteViaIdentity'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Deletes a security connector. +.Description +Deletes a security connector. +.Example +Remove-AzSecurityConnector -ResourceGroupName "securityconnectors-pwsh-tmp" -Name "ado-sdk-pwsh-test03" + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ApiId ]: API revision identifier. Must be unique in the API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + [GroupFqName ]: The GitLab group fully-qualified name. + [Id ]: Resource identity path + [OperationResultId ]: The operation result Id. + [OrgName ]: The Azure DevOps organization name. + [OwnerName ]: The GitHub owner name. + [ProjectName ]: The project name. + [RepoName ]: The repository name. + [ResourceGroupName ]: The name of the resource group within the user's subscription. The name is case insensitive. + [SecurityConnectorName ]: The security connector name. + [ServiceName ]: The name of the API Management service. + [SubscriptionId ]: Azure subscription ID +.Link +https://learn.microsoft.com/powershell/module/az.security/remove-azsecurityconnector +#> +function Remove-AzSecurityConnector { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Alias('SecurityConnectorName')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The security connector name. + ${Name}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The name of the resource group within the user's subscription. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Azure subscription ID + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity] + # Identity Parameter + # . + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait forNET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Delete = 'Az.Security.private\Remove-AzSecurityConnector_Delete'; + DeleteViaIdentity = 'Az.Security.private\Remove-AzSecurityConnector_DeleteViaIdentity'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Updates monitored Azure DevOps organization details. +.Description +Updates monitored Azure DevOps organization details. +.Example +$config = New-AzSecurityConnectorActionableRemediationObject -State Enabled -InheritFromParentState Disabled -CategoryConfiguration @( @{category="IaC"; minimumSeverityLevel="High"}) +Update-AzSecurityConnectorAzureDevOpsOrg -ResourceGroupName "securityConnectors-pwsh-tmp" -SecurityConnectorName "ado-sdk-pwsh-test03" -OrgName "org1" -ActionableRemediation $config + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrg +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +ACTIONABLEREMEDIATION : Configuration payload for PR Annotations. + [BranchConfiguration ]: Repository branch configuration for PR Annotations. + [AnnotateDefaultBranch ]: Configuration of PR Annotations on default branch. Enabled - PR Annotations are enabled on the resource's default branch. Disabled - PR Annotations are disabled on the resource's default branch. + [BranchName >]: Gets or sets branches that should have annotations. + [CategoryConfiguration >]: Gets or sets list of categories and severity levels. + [Category ]: Rule categories. Code - code scanning results. Artifact scanning results. Dependencies scanning results. IaC results. Secrets scanning results. Container scanning results. + [MinimumSeverityLevel ]: Gets or sets minimum severity level for a given category. + [InheritFromParentState ]: Update Settings. Enabled - Resource should inherit configurations from parent. Disabled - Resource should not inherit configurations from parent. + [State ]: ActionableRemediation Setting. None - the setting was never set. Enabled - ActionableRemediation is enabled. Disabled - ActionableRemediation is disabled. + +INPUTOBJECT : Identity Parameter + [ApiId ]: API revision identifier. Must be unique in the API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + [GroupFqName ]: The GitLab group fully-qualified name. + [Id ]: Resource identity path + [OperationResultId ]: The operation result Id. + [OrgName ]: The Azure DevOps organization name. + [OwnerName ]: The GitHub owner name. + [ProjectName ]: The project name. + [RepoName ]: The repository name. + [ResourceGroupName ]: The name of the resource group within the user's subscription. The name is case insensitive. + [SecurityConnectorName ]: The security connector name. + [ServiceName ]: The name of the API Management service. + [SubscriptionId ]: Azure subscription ID +.Link +https://learn.microsoft.com/powershell/module/az.security/update-azsecurityconnectorazuredevopsorg +#> +function Update-AzSecurityConnectorAzureDevOpsOrg { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrg])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The Azure DevOps organization name. + ${OrgName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The security connector name. + ${SecurityConnectorName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Azure subscription ID + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity] + # Identity Parameter + # . + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediation] + # Configuration payload for PR Annotations. + # . + ${ActionableRemediation}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait forNET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + UpdateExpanded = 'Az.Security.private\Update-AzSecurityConnectorAzureDevOpsOrg_UpdateExpanded'; + UpdateViaIdentityExpanded = 'Az.Security.private\Update-AzSecurityConnectorAzureDevOpsOrg_UpdateViaIdentityExpanded'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Updates a monitored Azure DevOps project resource. +.Description +Updates a monitored Azure DevOps project resource. +.Example +$config = New-AzSecurityConnectorActionableRemediationObject -State Disabled -InheritFromParentState Disabled -CategoryConfiguration @( @{category="IaC"; minimumSeverityLevel="Low"}) +Update-AzSecurityConnectorAzureDevOpsProject -ResourceGroupName "securityConnectors-pwsh-tmp" -SecurityConnectorName "ado-sdk-pwsh-test03" -OrgName "org1" -ProjectName "Build" -ActionableRemediation $config + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProject +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +ACTIONABLEREMEDIATION : Configuration payload for PR Annotations. + [BranchConfiguration ]: Repository branch configuration for PR Annotations. + [AnnotateDefaultBranch ]: Configuration of PR Annotations on default branch. Enabled - PR Annotations are enabled on the resource's default branch. Disabled - PR Annotations are disabled on the resource's default branch. + [BranchName >]: Gets or sets branches that should have annotations. + [CategoryConfiguration >]: Gets or sets list of categories and severity levels. + [Category ]: Rule categories. Code - code scanning results. Artifact scanning results. Dependencies scanning results. IaC results. Secrets scanning results. Container scanning results. + [MinimumSeverityLevel ]: Gets or sets minimum severity level for a given category. + [InheritFromParentState ]: Update Settings. Enabled - Resource should inherit configurations from parent. Disabled - Resource should not inherit configurations from parent. + [State ]: ActionableRemediation Setting. None - the setting was never set. Enabled - ActionableRemediation is enabled. Disabled - ActionableRemediation is disabled. + +INPUTOBJECT : Identity Parameter + [ApiId ]: API revision identifier. Must be unique in the API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + [GroupFqName ]: The GitLab group fully-qualified name. + [Id ]: Resource identity path + [OperationResultId ]: The operation result Id. + [OrgName ]: The Azure DevOps organization name. + [OwnerName ]: The GitHub owner name. + [ProjectName ]: The project name. + [RepoName ]: The repository name. + [ResourceGroupName ]: The name of the resource group within the user's subscription. The name is case insensitive. + [SecurityConnectorName ]: The security connector name. + [ServiceName ]: The name of the API Management service. + [SubscriptionId ]: Azure subscription ID +.Link +https://learn.microsoft.com/powershell/module/az.security/update-azsecurityconnectorazuredevopsproject +#> +function Update-AzSecurityConnectorAzureDevOpsProject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProject])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The Azure DevOps organization name. + ${OrgName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The project name. + ${ProjectName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The security connector name. + ${SecurityConnectorName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Azure subscription ID + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity] + # Identity Parameter + # . + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediation] + # Configuration payload for PR Annotations. + # . + ${ActionableRemediation}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # Gets or sets parent Azure DevOps Organization name. + ${ParentOrgName}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait forNET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + UpdateExpanded = 'Az.Security.private\Update-AzSecurityConnectorAzureDevOpsProject_UpdateExpanded'; + UpdateViaIdentityExpanded = 'Az.Security.private\Update-AzSecurityConnectorAzureDevOpsProject_UpdateViaIdentityExpanded'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Updates a monitored Azure DevOps repository resource. +.Description +Updates a monitored Azure DevOps repository resource. +.Example +$config = New-AzSecurityConnectorActionableRemediationObject -State Enabled -InheritFromParentState Disabled -CategoryConfiguration @( @{category="IaC"; minimumSeverityLevel="Low"} ) +Update-AzSecurityConnectorAzureDevOpsRepo -ResourceGroupName "securityConnectors-pwsh-tmp" -SecurityConnectorName "ado-sdk-pwsh-test03" -OrgName "org1" -ProjectName "Build" -RepoName "Build" -ActionableRemediation $config + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepository +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +ACTIONABLEREMEDIATION : Configuration payload for PR Annotations. + [BranchConfiguration ]: Repository branch configuration for PR Annotations. + [AnnotateDefaultBranch ]: Configuration of PR Annotations on default branch. Enabled - PR Annotations are enabled on the resource's default branch. Disabled - PR Annotations are disabled on the resource's default branch. + [BranchName >]: Gets or sets branches that should have annotations. + [CategoryConfiguration >]: Gets or sets list of categories and severity levels. + [Category ]: Rule categories. Code - code scanning results. Artifact scanning results. Dependencies scanning results. IaC results. Secrets scanning results. Container scanning results. + [MinimumSeverityLevel ]: Gets or sets minimum severity level for a given category. + [InheritFromParentState ]: Update Settings. Enabled - Resource should inherit configurations from parent. Disabled - Resource should not inherit configurations from parent. + [State ]: ActionableRemediation Setting. None - the setting was never set. Enabled - ActionableRemediation is enabled. Disabled - ActionableRemediation is disabled. + +INPUTOBJECT : Identity Parameter + [ApiId ]: API revision identifier. Must be unique in the API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + [GroupFqName ]: The GitLab group fully-qualified name. + [Id ]: Resource identity path + [OperationResultId ]: The operation result Id. + [OrgName ]: The Azure DevOps organization name. + [OwnerName ]: The GitHub owner name. + [ProjectName ]: The project name. + [RepoName ]: The repository name. + [ResourceGroupName ]: The name of the resource group within the user's subscription. The name is case insensitive. + [SecurityConnectorName ]: The security connector name. + [ServiceName ]: The name of the API Management service. + [SubscriptionId ]: Azure subscription ID +.Link +https://learn.microsoft.com/powershell/module/az.security/update-azsecurityconnectorazuredevopsrepo +#> +function Update-AzSecurityConnectorAzureDevOpsRepo { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepository])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The Azure DevOps organization name. + ${OrgName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The project name. + ${ProjectName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The repository name. + ${RepoName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The security connector name. + ${SecurityConnectorName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Azure subscription ID + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity] + # Identity Parameter + # . + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediation] + # Configuration payload for PR Annotations. + # . + ${ActionableRemediation}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # Gets or sets parent Azure DevOps Organization name. + ${ParentOrgName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # Gets or sets parent Azure DevOps Project name. + ${ParentProjectName}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait forNET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + UpdateExpanded = 'Az.Security.private\Update-AzSecurityConnectorAzureDevOpsRepo_UpdateExpanded'; + UpdateViaIdentityExpanded = 'Az.Security.private\Update-AzSecurityConnectorAzureDevOpsRepo_UpdateViaIdentityExpanded'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Updates a DevOps Configuration. +.Description +Updates a DevOps Configuration. +.Example +Update-AzSecurityConnectorDevOpsConfiguration -ResourceGroupName "securityConnectors-pwsh-tmp" -SecurityConnectorName "ado-sdk-pwsh-test03" -AutoDiscovery Enabled + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfiguration +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ApiId ]: API revision identifier. Must be unique in the API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + [GroupFqName ]: The GitLab group fully-qualified name. + [Id ]: Resource identity path + [OperationResultId ]: The operation result Id. + [OrgName ]: The Azure DevOps organization name. + [OwnerName ]: The GitHub owner name. + [ProjectName ]: The project name. + [RepoName ]: The repository name. + [ResourceGroupName ]: The name of the resource group within the user's subscription. The name is case insensitive. + [SecurityConnectorName ]: The security connector name. + [ServiceName ]: The name of the API Management service. + [SubscriptionId ]: Azure subscription ID +.Link +https://learn.microsoft.com/powershell/module/az.security/update-azsecurityconnectordevopsconfiguration +#> +function Update-AzSecurityConnectorDevOpsConfiguration { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfiguration])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The security connector name. + ${SecurityConnectorName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Azure subscription ID + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity] + # Identity Parameter + # . + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # Gets or sets one-time OAuth code to exchange for refresh and access tokens.Only used during PUT/PATCH operations. + # The secret is cleared during GET. + ${AuthorizationCode}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Disabled", "Enabled", "NotApplicable")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # AutoDiscovery states. + ${AutoDiscovery}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String[]] + # List of top-level inventory to select when AutoDiscovery is disabled.This field is ignored when AutoDiscovery is enabled. + ${TopLevelInventoryList}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait forNET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + UpdateExpanded = 'Az.Security.private\Update-AzSecurityConnectorDevOpsConfiguration_UpdateExpanded'; + UpdateViaIdentityExpanded = 'Az.Security.private\Update-AzSecurityConnectorDevOpsConfiguration_UpdateViaIdentityExpanded'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Updates a security connector +.Description +Updates a security connector +.Example +Update-AzSecurityConnector -ResourceGroupName "securityConnectors-pwsh-tmp" -Name "ado-sdk-pwsh-test03" -Tag @{myTag="v1"} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnector +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +ENVIRONMENTDATA : The security connector environment data. + EnvironmentType : The type of the environment data. + +INPUTOBJECT : Identity Parameter + [ApiId ]: API revision identifier. Must be unique in the API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + [GroupFqName ]: The GitLab group fully-qualified name. + [Id ]: Resource identity path + [OperationResultId ]: The operation result Id. + [OrgName ]: The Azure DevOps organization name. + [OwnerName ]: The GitHub owner name. + [ProjectName ]: The project name. + [RepoName ]: The repository name. + [ResourceGroupName ]: The name of the resource group within the user's subscription. The name is case insensitive. + [SecurityConnectorName ]: The security connector name. + [ServiceName ]: The name of the API Management service. + [SubscriptionId ]: Azure subscription ID + +OFFERING : A collection of offerings for the security connector. + OfferingType : The type of the security offering. +.Link +https://learn.microsoft.com/powershell/module/az.security/update-azsecurityconnector +#> +function Update-AzSecurityConnector { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnector])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Alias('SecurityConnectorName')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The security connector name. + ${Name}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The name of the resource group within the user's subscription. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Azure subscription ID + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity] + # Identity Parameter + # . + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironment] + # The security connector environment data. + # . + ${EnvironmentData}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Azure", "AWS", "GCP", "Github", "AzureDevOps", "GitLab")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The multi cloud resource's cloud name. + ${EnvironmentName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # Entity tag is used for comparing two or more entities from the same requested resource. + ${Etag}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The multi cloud resource identifier (account id in case of AWS connector, project number in case of GCP connector). + ${HierarchyIdentifier}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # Kind of the resource + ${Kind}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # Location where the resource is stored + ${Location}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOffering[]] + # A collection of offerings for the security connector. + # . + ${Offering}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITags]))] + [System.Collections.Hashtable] + # A list of key value pairs that describe the resource. + ${Tag}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait forNET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + UpdateExpanded = 'Az.Security.private\Update-AzSecurityConnector_UpdateExpanded'; + UpdateViaIdentityExpanded = 'Az.Security.private\Update-AzSecurityConnector_UpdateViaIdentityExpanded'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Create an in-memory object for AwsEnvironment. +.Description +Create an in-memory object for AwsEnvironment. +.Example +$member = New-AzSecurityAwsOrganizationalDataMemberObject -ParentHierarchyId "123" +New-AzSecurityAwsEnvironmentObject -Region "Central US" -ScanInterval 24 -OrganizationalData $member +.Example +$organization = New-AzSecurityAwsOrganizationalDataMasterObject -StacksetName "myAwsStackSet" -ExcludedAccountId "123456789012" +New-AzSecurityAwsEnvironmentObject -Region "Central US" -ScanInterval 24 -OrganizationalData $organization + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AwsEnvironment +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +ORGANIZATIONALDATA : The AWS account's organizational data. + OrganizationMembershipType : The multi cloud account's membership type in the organization +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecurityawsenvironmentobject +#> +function New-AzSecurityAwsEnvironmentObject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AwsEnvironment])] +[CmdletBinding(PositionalBinding=$false)] +param( + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalData] + # The AWS account's organizational data. + # . + ${OrganizationalData}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String[]] + # list of regions to scan. + ${Region}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.Int64] + # Scan interval in hours (value should be between 1-hour to 24-hours). + ${ScanInterval} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + __AllParameterSets = 'Az.Security.custom\New-AzSecurityAwsEnvironmentObject'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Create an in-memory object for AwsOrganizationalDataMaster. +.Description +Create an in-memory object for AwsOrganizationalDataMaster. +.Example +New-AzSecurityAwsOrganizationalDataMasterObject -StacksetName "myAwsStackSet" -ExcludedAccountId "123456789012" + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AwsOrganizationalDataMaster +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecurityawsorganizationaldatamasterobject +#> +function New-AzSecurityAwsOrganizationalDataMasterObject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AwsOrganizationalDataMaster])] +[CmdletBinding(PositionalBinding=$false)] +param( + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String[]] + # If the multi cloud account is of membership type organization, list of accounts excluded from offering. + ${ExcludedAccountId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # If the multi cloud account is of membership type organization, this will be the name of the onboarding stackset. + ${StacksetName} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + __AllParameterSets = 'Az.Security.custom\New-AzSecurityAwsOrganizationalDataMasterObject'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Create an in-memory object for AwsOrganizationalDataMember. +.Description +Create an in-memory object for AwsOrganizationalDataMember. +.Example +New-AzSecurityAwsOrganizationalDataMemberObject -ParentHierarchyId "123" + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AwsOrganizationalDataMember +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecurityawsorganizationaldatamemberobject +#> +function New-AzSecurityAwsOrganizationalDataMemberObject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AwsOrganizationalDataMember])] +[CmdletBinding(PositionalBinding=$false)] +param( + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # If the multi cloud account is not of membership type organization, this will be the ID of the account's parent. + ${ParentHierarchyId} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + __AllParameterSets = 'Az.Security.custom\New-AzSecurityAwsOrganizationalDataMemberObject'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Create an in-memory object for AzureDevOpsScopeEnvironment. +.Description +Create an in-memory object for AzureDevOpsScopeEnvironment. +.Example +New-AzSecurityAzureDevOpsScopeEnvironmentObject + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsScopeEnvironment +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecurityazuredevopsscopeenvironmentobject +#> +function New-AzSecurityAzureDevOpsScopeEnvironmentObject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsScopeEnvironment])] +[CmdletBinding(PositionalBinding=$false)] +param() + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + __AllParameterSets = 'Az.Security.custom\New-AzSecurityAzureDevOpsScopeEnvironmentObject'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Create an in-memory object for ActionableRemediation. +.Description +Create an in-memory object for ActionableRemediation. +.Example +New-AzSecurityConnectorActionableRemediationObject -State Enabled -InheritFromParentState Disabled ` + -BranchConfiguration @{AnnotateDefaultBranch="Enabled"; branchName=@("main", "hotfix")} -CategoryConfiguration @( @{category="First"; minimumSeverityLevel="High"}, @{category="Second"; minimumSeverityLevel="Low"}) + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ActionableRemediation +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +BRANCHCONFIGURATION : Repository branch configuration for PR Annotations. + [AnnotateDefaultBranch ]: Configuration of PR Annotations on default branch. Enabled - PR Annotations are enabled on the resource's default branch. Disabled - PR Annotations are disabled on the resource's default branch. + [BranchName >]: Gets or sets branches that should have annotations. + +CATEGORYCONFIGURATION : Gets or sets list of categories and severity levels. + [Category ]: Rule categories. Code - code scanning results. Artifact scanning results. Dependencies scanning results. IaC results. Secrets scanning results. Container scanning results. + [MinimumSeverityLevel ]: Gets or sets minimum severity level for a given category. +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecurityconnectoractionableremediationobject +#> +function New-AzSecurityConnectorActionableRemediationObject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ActionableRemediation])] +[CmdletBinding(PositionalBinding=$false)] +param( + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITargetBranchConfiguration] + # Repository branch configuration for PR Annotations. + # . + ${BranchConfiguration}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICategoryConfiguration[]] + # Gets or sets list of categories and severity levels. + # . + ${CategoryConfiguration}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Disabled", "Enabled")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # Update Settings. + # + # Enabled - Resource should inherit configurations from parent. + # Disabled - Resource should not inherit configurations from parent. + ${InheritFromParentState}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("None", "Disabled", "Enabled")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # ActionableRemediation Setting. + # None - the setting was never set. + # Enabled - ActionableRemediation is enabled. + # Disabled - ActionableRemediation is disabled. + ${State} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + __AllParameterSets = 'Az.Security.custom\New-AzSecurityConnectorActionableRemediationObject'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Create an in-memory object for CspmMonitorAwsOffering. +.Description +Create an in-memory object for CspmMonitorAwsOffering. +.Example +New-AzSecurityCspmMonitorAwsOfferingObject -NativeCloudConnectionCloudRoleArn "arn:aws:iam::123456789012:role/CspmMonitorAws" + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CspmMonitorAwsOffering +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritycspmmonitorawsofferingobject +#> +function New-AzSecurityCspmMonitorAwsOfferingObject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CspmMonitorAwsOffering])] +[CmdletBinding(PositionalBinding=$false)] +param( + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The cloud role ARN in AWS for this feature. + ${NativeCloudConnectionCloudRoleArn} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + __AllParameterSets = 'Az.Security.custom\New-AzSecurityCspmMonitorAwsOfferingObject'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Create an in-memory object for CspmMonitorAzureDevOpsOffering. +.Description +Create an in-memory object for CspmMonitorAzureDevOpsOffering. +.Example +New-AzSecurityCspmMonitorAzureDevOpsOfferingObject + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CspmMonitorAzureDevOpsOffering +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritycspmmonitorazuredevopsofferingobject +#> +function New-AzSecurityCspmMonitorAzureDevOpsOfferingObject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CspmMonitorAzureDevOpsOffering])] +[CmdletBinding(PositionalBinding=$false)] +param() + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + __AllParameterSets = 'Az.Security.custom\New-AzSecurityCspmMonitorAzureDevOpsOfferingObject'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Create an in-memory object for CspmMonitorGcpOffering. +.Description +Create an in-memory object for CspmMonitorGcpOffering. +.Example +New-AzSecurityCspmMonitorGcpOfferingObject -NativeCloudConnectionServiceAccountEmailAddress "microsoft-defender-cspm@asc-sdk-samples.iam.gserviceaccount.com" -NativeCloudConnectionWorkloadIdentityProviderId "cspm" + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CspmMonitorGcpOffering +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritycspmmonitorgcpofferingobject +#> +function New-AzSecurityCspmMonitorGcpOfferingObject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CspmMonitorGcpOffering])] +[CmdletBinding(PositionalBinding=$false)] +param( + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The service account email address in GCP for this offering. + ${NativeCloudConnectionServiceAccountEmailAddress}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The GCP workload identity provider id for the offering. + ${NativeCloudConnectionWorkloadIdentityProviderId} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + __AllParameterSets = 'Az.Security.custom\New-AzSecurityCspmMonitorGcpOfferingObject'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Create an in-memory object for CspmMonitorGithubOffering. +.Description +Create an in-memory object for CspmMonitorGithubOffering. +.Example +New-AzSecurityCspmMonitorGithubOfferingObject + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CspmMonitorGithubOffering +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritycspmmonitorgithubofferingobject +#> +function New-AzSecurityCspmMonitorGithubOfferingObject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CspmMonitorGithubOffering])] +[CmdletBinding(PositionalBinding=$false)] +param() + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + __AllParameterSets = 'Az.Security.custom\New-AzSecurityCspmMonitorGithubOfferingObject'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Create an in-memory object for CspmMonitorGitLabOffering. +.Description +Create an in-memory object for CspmMonitorGitLabOffering. +.Example +New-AzSecurityCspmMonitorGitLabOfferingObject + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CspmMonitorGitLabOffering +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritycspmmonitorgitlabofferingobject +#> +function New-AzSecurityCspmMonitorGitLabOfferingObject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CspmMonitorGitLabOffering])] +[CmdletBinding(PositionalBinding=$false)] +param() + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + __AllParameterSets = 'Az.Security.custom\New-AzSecurityCspmMonitorGitLabOfferingObject'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Create an in-memory object for DefenderCspmAwsOffering. +.Description +Create an in-memory object for DefenderCspmAwsOffering. +.Example +$arnPrefix = "arn:aws:iam::123456789012:role" +New-AzSecurityDefenderCspmAwsOfferingObject ` + -VMScannerEnabled $true -ConfigurationScanningMode Default -ConfigurationCloudRoleArn "$arnPrefix/DefenderForCloud-AgentlessScanner" -ConfigurationExclusionTag @{key="value"} ` + -DataSensitivityDiscoveryEnabled $true -DataSensitivityDiscoveryCloudRoleArn "$arnPrefix/SensitiveDataDiscovery" ` + -DatabaseDspmEnabled $true -DatabaseDspmCloudRoleArn "$arnPrefix/DefenderForCloud-DataSecurityPostureDB" ` + -CiemDiscoveryCloudRoleArn "$arnPrefix/DefenderForCloud-Ciem" -CiemOidcAzureActiveDirectoryAppName "mciem-aws-oidc-connector" -CiemOidcCloudRoleArn "$arnPrefix/DefenderForCloud-OidcCiem" ` + -MdcContainerImageAssessmentEnabled $true -MdcContainerImageAssessmentCloudRoleArn "$arnPrefix/MDCContainersImageAssessmentRole" ` + -MdcContainerAgentlessDiscoveryK8SEnabled $true -MdcContainerAgentlessDiscoveryK8SCloudRoleArn "$arnPrefix/MDCContainersAgentlessDiscoveryK8sRole" + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOffering +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +CONFIGURATIONEXCLUSIONTAG : VM tags that indicates that VM should not be scanned. + [(Any) ]: This indicates any property can be added to this object. +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritydefendercspmawsofferingobject +#> +function New-AzSecurityDefenderCspmAwsOfferingObject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOffering])] +[CmdletBinding(PositionalBinding=$false)] +param( + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The cloud role ARN in AWS for CIEM discovery. + ${CiemDiscoveryCloudRoleArn}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # the azure active directory app name used of authenticating against AWS. + ${CiemOidcAzureActiveDirectoryAppName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The cloud role ARN in AWS for CIEM oidc connection. + ${CiemOidcCloudRoleArn}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The cloud role ARN in AWS for this feature. + ${ConfigurationCloudRoleArn}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfigurationExclusionTags] + # VM tags that indicates that VM should not be scanned. + # . + ${ConfigurationExclusionTag}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Default")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The scanning mode for the VM scan. + ${ConfigurationScanningMode}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The cloud role ARN in AWS for this feature. + ${DataSensitivityDiscoveryCloudRoleArn}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.Boolean] + # Is Microsoft Defender Data Sensitivity discovery enabled. + ${DataSensitivityDiscoveryEnabled}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The cloud role ARN in AWS for this feature. + ${DatabaseDspmCloudRoleArn}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.Boolean] + # Is databases DSPM protection enabled. + ${DatabaseDspmEnabled}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The cloud role ARN in AWS for this feature. + ${MdcContainerAgentlessDiscoveryK8SCloudRoleArn}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.Boolean] + # Is Microsoft Defender container agentless discovery K8s enabled. + ${MdcContainerAgentlessDiscoveryK8SEnabled}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The cloud role ARN in AWS for this feature. + ${MdcContainerImageAssessmentCloudRoleArn}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.Boolean] + # Is Microsoft Defender container image assessment enabled. + ${MdcContainerImageAssessmentEnabled}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.Boolean] + # Is Microsoft Defender for Server VM scanning enabled. + ${VMScannerEnabled} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + __AllParameterSets = 'Az.Security.custom\New-AzSecurityDefenderCspmAwsOfferingObject'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Create an in-memory object for DefenderCspmGcpOffering. +.Description +Create an in-memory object for DefenderCspmGcpOffering. +.Example +$emailSuffix = "myproject.iam.gserviceaccount.com" +New-AzSecurityDefenderCspmGcpOfferingObject ` + -VMScannerEnabled $true -ConfigurationScanningMode Default -ConfigurationExclusionTag @{key="value"} ` + -MdcContainerAgentlessDiscoveryK8SEnabled $true -MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress "mdc-containers-k8s-operator@$emailSuffix" -MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId "containers" ` + -MdcContainerImageAssessmentEnabled $true -MdcContainerImageAssessmentServiceAccountEmailAddress "mdc-containers-artifact-assess@$emailSuffix" -MdcContainerImageAssessmentWorkloadIdentityProviderId "containers" ` + -DataSensitivityDiscoveryEnabled $true -DataSensitivityDiscoveryServiceAccountEmailAddress "mdc-data-sec-posture-storage@$emailSuffix" -DataSensitivityDiscoveryWorkloadIdentityProviderId "data-security-posture-storage" ` + -CiemDiscoveryServiceAccountEmailAddress "microsoft-defender-ciem@$emailSuffix" -CiemDiscoveryAzureActiveDirectoryAppName "mciem-gcp-oidc-app" -CiemDiscoveryWorkloadIdentityProviderId "ciem-discovery" + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmGcpOffering +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +CONFIGURATIONEXCLUSIONTAG : VM tags that indicates that VM should not be scanned. + [(Any) ]: This indicates any property can be added to this object. +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritydefendercspmgcpofferingobject +#> +function New-AzSecurityDefenderCspmGcpOfferingObject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmGcpOffering])] +[CmdletBinding(PositionalBinding=$false)] +param( + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # the azure active directory app name used of authenticating against GCP workload identity federation. + ${CiemDiscoveryAzureActiveDirectoryAppName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The service account email address in GCP for CIEM discovery offering. + ${CiemDiscoveryServiceAccountEmailAddress}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The GCP workload identity provider id for CIEM discovery offering. + ${CiemDiscoveryWorkloadIdentityProviderId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersConfigurationExclusionTags] + # VM tags that indicates that VM should not be scanned. + # . + ${ConfigurationExclusionTag}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Default")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The scanning mode for the VM scan. + ${ConfigurationScanningMode}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.Boolean] + # Is Microsoft Defender Data Sensitivity discovery enabled. + ${DataSensitivityDiscoveryEnabled}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The service account email address in GCP for this feature. + ${DataSensitivityDiscoveryServiceAccountEmailAddress}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The workload identity provider id in GCP for this feature. + ${DataSensitivityDiscoveryWorkloadIdentityProviderId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.Boolean] + # Is Microsoft Defender container agentless discovery enabled. + ${MdcContainerAgentlessDiscoveryK8SEnabled}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The service account email address in GCP for this feature. + ${MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The workload identity provider id in GCP for this feature. + ${MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.Boolean] + # Is Microsoft Defender container image assessment enabled. + ${MdcContainerImageAssessmentEnabled}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The service account email address in GCP for this feature. + ${MdcContainerImageAssessmentServiceAccountEmailAddress}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The workload identity provider id in GCP for this feature. + ${MdcContainerImageAssessmentWorkloadIdentityProviderId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.Boolean] + # Is Microsoft Defender for Server VM scanning enabled. + ${VMScannerEnabled} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + __AllParameterSets = 'Az.Security.custom\New-AzSecurityDefenderCspmGcpOfferingObject'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Create an in-memory object for DefenderForContainersAwsOffering. +.Description +Create an in-memory object for DefenderForContainersAwsOffering. +.Example +$arnPrefix = "arn:aws:iam::123456789012:role" +New-AzSecurityDefenderForContainersAwsOfferingObject ` + -AutoProvisioning $true -KuberneteServiceCloudRoleArn "$arnPrefix/DefenderForCloud-Containers-K8s" -KuberneteScubaReaderCloudRoleArn "$arnPrefix/DefenderForCloud-DataCollection" ` + -KinesiToS3CloudRoleArn "$arnPrefix/DefenderForCloud-Containers-K8s-kinesis-to-s3" -CloudWatchToKinesiCloudRoleArn "$arnPrefix/DefenderForCloud-Containers-K8s-cloudwatch-to-kinesis" ` + -KubeAuditRetentionTime 30 -ScubaExternalId "a47ae0a2-7bf7-482a-897a-7a139d30736c" ` + -MdcContainerAgentlessDiscoveryK8SEnabled $true -MdcContainerAgentlessDiscoveryK8SCloudRoleArn "$arnPrefix/MDCContainersAgentlessDiscoveryK8sRole" ` + -MdcContainerImageAssessmentEnabled $true -MdcContainerImageAssessmentCloudRoleArn "$arnPrefix/MDCContainersImageAssessmentRole" ` + -EnableContainerVulnerabilityAssessment $false + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersAwsOffering +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritydefenderforcontainersawsofferingobject +#> +function New-AzSecurityDefenderForContainersAwsOfferingObject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersAwsOffering])] +[CmdletBinding(PositionalBinding=$false)] +param( + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.Boolean] + # Is audit logs pipeline auto provisioning enabled. + ${AutoProvisioning}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The cloud role ARN in AWS used by CloudWatch to transfer data into Kinesis. + ${CloudWatchToKinesiCloudRoleArn}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The cloud role ARN in AWS for this feature. + ${ContainerVulnerabilityAssessmentCloudRoleArn}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The cloud role ARN in AWS for this feature. + ${ContainerVulnerabilityAssessmentTaskCloudRoleArn}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.Boolean] + # Enable container vulnerability assessment feature. + ${EnableContainerVulnerabilityAssessment}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The cloud role ARN in AWS used by Kinesis to transfer data into S3. + ${KinesiToS3CloudRoleArn}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.Int64] + # The retention time in days of kube audit logs set on the CloudWatch log group. + ${KubeAuditRetentionTime}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The cloud role ARN in AWS for this feature used for reading data. + ${KuberneteScubaReaderCloudRoleArn}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The cloud role ARN in AWS for this feature used for provisioning resources. + ${KuberneteServiceCloudRoleArn}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The cloud role ARN in AWS for this feature. + ${MdcContainerAgentlessDiscoveryK8SCloudRoleArn}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.Boolean] + # Is Microsoft Defender container agentless discovery K8s enabled. + ${MdcContainerAgentlessDiscoveryK8SEnabled}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The cloud role ARN in AWS for this feature. + ${MdcContainerImageAssessmentCloudRoleArn}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.Boolean] + # Is Microsoft Defender container image assessment enabled. + ${MdcContainerImageAssessmentEnabled}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The externalId used by the data reader to prevent the confused deputy attack. + ${ScubaExternalId} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + __AllParameterSets = 'Az.Security.custom\New-AzSecurityDefenderForContainersAwsOfferingObject'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Create an in-memory object for DefenderForContainersGcpOffering. +.Description +Create an in-memory object for DefenderForContainersGcpOffering. +.Example +$emailSuffix = "myproject.iam.gserviceaccount.com" +New-AzSecurityDefenderForContainersGcpOfferingObject ` + -NativeCloudConnectionServiceAccountEmailAddress "microsoft-defender-containers@$emailSuffix" -NativeCloudConnectionWorkloadIdentityProviderId "containers" ` + -DataPipelineNativeCloudConnectionServiceAccountEmailAddress "ms-defender-containers-stream@$emailSuffix" -DataPipelineNativeCloudConnectionWorkloadIdentityProviderId "containers-streams" ` + -AuditLogsAutoProvisioningFlag $true -DefenderAgentAutoProvisioningFlag $true -PolicyAgentAutoProvisioningFlag $true ` + -MdcContainerAgentlessDiscoveryK8SEnabled $true -MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId "containers" -MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress "mdc-containers-k8s-operator@$emailSuffix" ` + -MdcContainerImageAssessmentEnabled $true -MdcContainerImageAssessmentWorkloadIdentityProviderId "containers" -MdcContainerImageAssessmentServiceAccountEmailAddress "mdc-containers-artifact-assess@$emailSuffix" + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersGcpOffering +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritydefenderforcontainersgcpofferingobject +#> +function New-AzSecurityDefenderForContainersGcpOfferingObject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersGcpOffering])] +[CmdletBinding(PositionalBinding=$false)] +param( + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.Boolean] + # Is audit logs data collection enabled. + ${AuditLogsAutoProvisioningFlag}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The data collection service account email address in GCP for this offering. + ${DataPipelineNativeCloudConnectionServiceAccountEmailAddress}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The data collection GCP workload identity provider id for this offering. + ${DataPipelineNativeCloudConnectionWorkloadIdentityProviderId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.Boolean] + # Is Microsoft Defender for Cloud Kubernetes agent auto provisioning enabled. + ${DefenderAgentAutoProvisioningFlag}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.Boolean] + # Is Microsoft Defender container agentless discovery enabled. + ${MdcContainerAgentlessDiscoveryK8SEnabled}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The service account email address in GCP for this feature. + ${MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The workload identity provider id in GCP for this feature. + ${MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.Boolean] + # Is Microsoft Defender container image assessment enabled. + ${MdcContainerImageAssessmentEnabled}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The service account email address in GCP for this feature. + ${MdcContainerImageAssessmentServiceAccountEmailAddress}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The workload identity provider id in GCP for this feature. + ${MdcContainerImageAssessmentWorkloadIdentityProviderId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The service account email address in GCP for this offering. + ${NativeCloudConnectionServiceAccountEmailAddress}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The GCP workload identity provider id for this offering. + ${NativeCloudConnectionWorkloadIdentityProviderId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.Boolean] + # Is Policy Kubernetes agent auto provisioning enabled. + ${PolicyAgentAutoProvisioningFlag} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + __AllParameterSets = 'Az.Security.custom\New-AzSecurityDefenderForContainersGcpOfferingObject'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Create an in-memory object for DefenderForDatabasesAwsOffering. +.Description +Create an in-memory object for DefenderForDatabasesAwsOffering. +.Example +$arnPrefix = "arn:aws:iam::123456789012:role" +New-AzSecurityDefenderForDatabasesAwsOfferingObject ` + -ArcAutoProvisioningEnabled $true -ArcAutoProvisioningCloudRoleArn "$arnPrefix/DefenderForCloud-ArcAutoProvisioning" ` + -DatabaseDspmEnabled $true -DatabaseDspmCloudRoleArn "$arnPrefix/DefenderForCloud-DataSecurityPostureDB" + + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForDatabasesAwsOffering +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritydefenderfordatabasesawsofferingobject +#> +function New-AzSecurityDefenderForDatabasesAwsOfferingObject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForDatabasesAwsOffering])] +[CmdletBinding(PositionalBinding=$false)] +param( + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The cloud role ARN in AWS for this feature. + ${ArcAutoProvisioningCloudRoleArn}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.Boolean] + # Is arc auto provisioning enabled. + ${ArcAutoProvisioningEnabled}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # Optional Arc private link scope resource id to link the Arc agent. + ${ConfigurationPrivateLinkScope}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # Optional http proxy endpoint to use for the Arc agent. + ${ConfigurationProxy}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The cloud role ARN in AWS for this feature. + ${DatabaseDspmCloudRoleArn}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.Boolean] + # Is databases data security posture management (DSPM) protection enabled. + ${DatabaseDspmEnabled}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The cloud role ARN in AWS for this feature. + ${RdCloudRoleArn}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.Boolean] + # Is RDS protection enabled. + ${RdEnabled} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + __AllParameterSets = 'Az.Security.custom\New-AzSecurityDefenderForDatabasesAwsOfferingObject'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Create an in-memory object for DefenderForDatabasesGcpOffering. +.Description +Create an in-memory object for DefenderForDatabasesGcpOffering. +.Example +$emailSuffix = "myproject.iam.gserviceaccount.com" +New-AzSecurityDefenderForDatabasesGcpOfferingObject ` + -ArcAutoProvisioningEnabled $true ` + -DefenderForDatabaseArcAutoProvisioningServiceAccountEmailAddress "microsoft-databases-arc-ap@" -DefenderForDatabaseArcAutoProvisioningWorkloadIdentityProviderId "defender-for-databases-arc-ap" + + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForDatabasesGcpOffering +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritydefenderfordatabasesgcpofferingobject +#> +function New-AzSecurityDefenderForDatabasesGcpOfferingObject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForDatabasesGcpOffering])] +[CmdletBinding(PositionalBinding=$false)] +param( + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.Boolean] + # Is arc auto provisioning enabled. + ${ArcAutoProvisioningEnabled}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # Optional Arc private link scope resource id to link the Arc agent. + ${ConfigurationPrivateLinkScope}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # Optional http proxy endpoint to use for the Arc agent. + ${ConfigurationProxy}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The service account email address in GCP for this offering. + ${DefenderForDatabaseArcAutoProvisioningServiceAccountEmailAddress}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The GCP workload identity provider id for this offering. + ${DefenderForDatabaseArcAutoProvisioningWorkloadIdentityProviderId} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + __AllParameterSets = 'Az.Security.custom\New-AzSecurityDefenderForDatabasesGcpOfferingObject'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Create an in-memory object for DefenderForServersAwsOffering. +.Description +Create an in-memory object for DefenderForServersAwsOffering. +.Example +$arnPrefix = "arn:aws:iam::123456789012:role" +New-AzSecurityDefenderForServersAwsOfferingObject ` + -DefenderForServerCloudRoleArn "$arnPrefix/DefenderForCloud-DefenderForServers" ` + -ArcAutoProvisioningEnabled $true -ArcAutoProvisioningCloudRoleArn "$arnPrefix/DefenderForCloud-ArcAutoProvisioning" ` + -MdeAutoProvisioningEnabled $true ` + -VaAutoProvisioningEnabled $true -ConfigurationType TVM ` + -VMScannerEnabled $true -ConfigurationCloudRoleArn "$arnPrefix/DefenderForCloud-AgentlessScanner" -ConfigurationScanningMode Default ` + -SubPlanType P2 + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOffering +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +CONFIGURATIONEXCLUSIONTAG : VM tags that indicates that VM should not be scanned. + [(Any) ]: This indicates any property can be added to this object. +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritydefenderforserversawsofferingobject +#> +function New-AzSecurityDefenderForServersAwsOfferingObject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOffering])] +[CmdletBinding(PositionalBinding=$false)] +param( + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The cloud role ARN in AWS for this feature. + ${ArcAutoProvisioningCloudRoleArn}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.Boolean] + # Is arc auto provisioning enabled. + ${ArcAutoProvisioningEnabled}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The cloud role ARN in AWS for this feature. + ${ConfigurationCloudRoleArn}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfigurationExclusionTags] + # VM tags that indicates that VM should not be scanned. + # . + ${ConfigurationExclusionTag}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # Optional Arc private link scope resource id to link the Arc agent. + ${ConfigurationPrivateLinkScope}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # Optional HTTP proxy endpoint to use for the Arc agent. + ${ConfigurationProxy}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Default")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The scanning mode for the VM scan. + ${ConfigurationScanningMode}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Qualys", "TVM")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The Vulnerability Assessment solution to be provisioned. + # Can be either 'TVM' or 'Qualys'. + ${ConfigurationType}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The cloud role ARN in AWS for this feature. + ${DefenderForServerCloudRoleArn}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAny] + # configuration for Microsoft Defender for Endpoint autoprovisioning. + ${MdeAutoProvisioningConfiguration}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.Boolean] + # Is Microsoft Defender for Endpoint auto provisioning enabled. + ${MdeAutoProvisioningEnabled}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("P1", "P2")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The available sub plans. + ${SubPlanType}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.Boolean] + # Is Microsoft Defender for Server VM scanning enabled. + ${VMScannerEnabled}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.Boolean] + # Is Vulnerability Assessment auto provisioning enabled. + ${VaAutoProvisioningEnabled} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + __AllParameterSets = 'Az.Security.custom\New-AzSecurityDefenderForServersAwsOfferingObject'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Create an in-memory object for DefenderForServersGcpOffering. +.Description +Create an in-memory object for DefenderForServersGcpOffering. +.Example +$emailSuffix = "myproject.iam.gserviceaccount.com" +New-AzSecurityDefenderForServersGcpOfferingObject ` + -DefenderForServerServiceAccountEmailAddress "microsoft-defender-for-servers@$emailSuffix" -DefenderForServerWorkloadIdentityProviderId "defender-for-servers" ` + -ArcAutoProvisioningEnabled $true -MdeAutoProvisioningEnabled $true -VaAutoProvisioningEnabled $true -ConfigurationType TVM ` + -VMScannerEnabled $true -ConfigurationScanningMode Default ` + -SubPlanType P2 + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOffering +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +CONFIGURATIONEXCLUSIONTAG : VM tags that indicate that VM should not be scanned. + [(Any) ]: This indicates any property can be added to this object. +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritydefenderforserversgcpofferingobject +#> +function New-AzSecurityDefenderForServersGcpOfferingObject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOffering])] +[CmdletBinding(PositionalBinding=$false)] +param( + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.Boolean] + # Is arc auto provisioning enabled. + ${ArcAutoProvisioningEnabled}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersConfigurationExclusionTags] + # VM tags that indicate that VM should not be scanned. + # . + ${ConfigurationExclusionTag}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # Optional Arc private link scope resource id to link the Arc agent. + ${ConfigurationPrivateLinkScope}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # Optional HTTP proxy endpoint to use for the Arc agent. + ${ConfigurationProxy}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Default")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The scanning mode for the VM scan. + ${ConfigurationScanningMode}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Qualys", "TVM")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The Vulnerability Assessment solution to be provisioned. + # Can be either 'TVM' or 'Qualys'. + ${ConfigurationType}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The service account email address in GCP for this feature. + ${DefenderForServerServiceAccountEmailAddress}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The workload identity provider id in GCP for this feature. + ${DefenderForServerWorkloadIdentityProviderId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAny] + # configuration for Microsoft Defender for Endpoint autoprovisioning. + ${MdeAutoProvisioningConfiguration}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.Boolean] + # Is Microsoft Defender for Endpoint auto provisioning enabled. + ${MdeAutoProvisioningEnabled}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("P1", "P2")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The available sub plans. + ${SubPlanType}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.Boolean] + # Is Microsoft Defender for Server VM scanning enabled. + ${VMScannerEnabled}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.Boolean] + # Is Vulnerability Assessment auto provisioning enabled. + ${VaAutoProvisioningEnabled} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + __AllParameterSets = 'Az.Security.custom\New-AzSecurityDefenderForServersGcpOfferingObject'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Create an in-memory object for GcpOrganizationalDataMember. +.Description +Create an in-memory object for GcpOrganizationalDataMember. +.Example +New-AzSecurityGcpOrganizationalDataMemberObject -ManagementProjectNumber "12345" -ParentHierarchyId "00000" + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GcpOrganizationalDataMember +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritygcporganizationaldatamemberobject +#> +function New-AzSecurityGcpOrganizationalDataMemberObject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GcpOrganizationalDataMember])] +[CmdletBinding(PositionalBinding=$false)] +param( + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The GCP management project number from organizational onboarding. + ${ManagementProjectNumber}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # If the multi cloud account is not of membership type organization, this will be the ID of the project's parent. + ${ParentHierarchyId} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + __AllParameterSets = 'Az.Security.custom\New-AzSecurityGcpOrganizationalDataMemberObject'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Create an in-memory object for GcpOrganizationalDataOrganization. +.Description +Create an in-memory object for GcpOrganizationalDataOrganization. +.Example +New-AzSecurityGcpOrganizationalDataOrganizationObject -WorkloadIdentityProviderId "provider" -ServiceAccountEmailAddress "my@email.com" -ExcludedProjectNumber @(1,2) + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GcpOrganizationalDataOrganization +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritygcporganizationaldataorganizationobject +#> +function New-AzSecurityGcpOrganizationalDataOrganizationObject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GcpOrganizationalDataOrganization])] +[CmdletBinding(PositionalBinding=$false)] +param( + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String[]] + # If the multi cloud account is of membership type organization, list of accounts excluded from offering. + ${ExcludedProjectNumber}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The service account email address which represents the organization level permissions container. + ${ServiceAccountEmailAddress}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The GCP workload identity provider id which represents the permissions required to auto provision security connectors. + ${WorkloadIdentityProviderId} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + __AllParameterSets = 'Az.Security.custom\New-AzSecurityGcpOrganizationalDataOrganizationObject'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Create an in-memory object for GcpProjectEnvironment. +.Description +Create an in-memory object for GcpProjectEnvironment. +.Example +$orgData = New-AzSecurityGcpOrganizationalDataOrganizationObject -WorkloadIdentityProviderId "provider" -ServiceAccountEmailAddress "my@email.com" -ExcludedProjectNumber @(1,2) +New-AzSecurityGcpProjectEnvironmentObject -ProjectDetailProjectId "asc-sdk-samples" -ScanInterval 24 -OrganizationalData $orgData -ProjectDetailProjectNumber "1234" + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GcpProjectEnvironment +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +ORGANIZATIONALDATA : The Gcp project's organizational data. + OrganizationMembershipType : The multi cloud account's membership type in the organization +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritygcpprojectenvironmentobject +#> +function New-AzSecurityGcpProjectEnvironmentObject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GcpProjectEnvironment])] +[CmdletBinding(PositionalBinding=$false)] +param( + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalData] + # The Gcp project's organizational data. + # . + ${OrganizationalData}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The GCP Project id. + ${ProjectDetailProjectId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The unique GCP Project number. + ${ProjectDetailProjectNumber}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.Int64] + # Scan interval in hours (value should be between 1-hour to 24-hours). + ${ScanInterval} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + __AllParameterSets = 'Az.Security.custom\New-AzSecurityGcpProjectEnvironmentObject'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Create an in-memory object for GitHubScopeEnvironment. +.Description +Create an in-memory object for GitHubScopeEnvironment. +.Example +New-AzSecurityGitHubScopeEnvironmentObject + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitHubScopeEnvironment +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritygithubscopeenvironmentobject +#> +function New-AzSecurityGitHubScopeEnvironmentObject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitHubScopeEnvironment])] +[CmdletBinding(PositionalBinding=$false)] +param() + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + __AllParameterSets = 'Az.Security.custom\New-AzSecurityGitHubScopeEnvironmentObject'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Create an in-memory object for GitLabScopeEnvironment. +.Description +Create an in-memory object for GitLabScopeEnvironment. +.Example +New-AzSecurityGitLabScopeEnvironmentObject + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitLabScopeEnvironment +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritygitlabscopeenvironmentobject +#> +function New-AzSecurityGitLabScopeEnvironmentObject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitLabScopeEnvironment])] +[CmdletBinding(PositionalBinding=$false)] +param() + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + __AllParameterSets = 'Az.Security.custom\New-AzSecurityGitLabScopeEnvironmentObject'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Create an in-memory object for InformationProtectionAwsOffering. +.Description +Create an in-memory object for InformationProtectionAwsOffering. +.Example +New-AzSecurityInformationProtectionAwsOfferingObject -InformationProtectionCloudRoleArn "arn:aws:iam::123456789012:role/myRole" + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.InformationProtectionAwsOffering +.Link +https://learn.microsoft.com/powershell/module/Az.Security/new-azsecurityinformationprotectionawsofferingobject +#> +function New-AzSecurityInformationProtectionAwsOfferingObject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.InformationProtectionAwsOffering])] +[CmdletBinding(PositionalBinding=$false)] +param( + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The cloud role ARN in AWS for this feature. + ${InformationProtectionCloudRoleArn} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + __AllParameterSets = 'Az.Security.custom\New-AzSecurityInformationProtectionAwsOfferingObject'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Security/Security.Autorest/exports/README.md b/src/Security/Security.Autorest/exports/README.md new file mode 100644 index 000000000000..42d2158d314f --- /dev/null +++ b/src/Security/Security.Autorest/exports/README.md @@ -0,0 +1,20 @@ +# Exports +This directory contains the cmdlets *exported by* `Az.Security`. No other cmdlets in this repository are directly exported. What that means is the `Az.Security` module will run [Export-ModuleMember](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/export-modulemember) on the cmldets in this directory. The cmdlets in this directory are generated at **build-time**. Do not put any custom code, files, cmdlets, etc. into this directory. Please use `..\custom` for all custom implementation. + +## Info +- Modifiable: no +- Generated: all +- Committed: no +- Packaged: yes + +## Details +The cmdlets generated here are created every time you run `build-module.ps1`. These cmdlets are a merge of all (excluding `InternalExport`) cmdlets from the private binary (`..\bin\Az.Security.private.dll`) and from the `..\custom\Az.Security.custom.psm1` module. Cmdlets that are *not merged* from those directories are decorated with the `InternalExport` attribute. This happens when you set the cmdlet to **hide** from configuration. For more information on hiding, see [cmdlet hiding](https://github.com/Azure/autorest/blob/master/docs/powershell/options.md#cmdlet-hiding-exportation-suppression) or the [README.md](..\internal/README.md) in the `..\internal` folder. + +## Purpose +We generate script cmdlets out of the binary cmdlets and custom cmdlets. The format of script cmdlets are simplistic; thus, easier to generate at build time. Generating the cmdlets is required as to allow merging of generated binary, hand-written binary, and hand-written custom cmdlets. For Azure cmdlets, having script cmdlets simplifies the mechanism for exporting Azure profiles. + +## Structure +The cmdlets generated here will flat in the directory (no sub-folders) as long as there are no Azure profiles specified for any cmdlets. Azure profiles (the `Profiles` attribute) is only applied when generating with the `--azure` attribute (or `azure: true` in the configuration). When Azure profiles are applied, the folder structure has a folder per profile. Each profile folder has only those cmdlets that apply to that profile. + +## Usage +When `./Az.Security.psm1` is loaded, it dynamically exports cmdlets here based on the folder structure and on the selected profile. If there are no sub-folders, it exports all cmdlets at the root of this folder. If there are sub-folders, it checks to see the selected profile. If no profile is selected, it exports the cmdlets in the last sub-folder (alphabetically). If a profile is selected, it exports the cmdlets in the sub-folder that matches the profile name. If there is no sub-folder that matches the profile name, it exports no cmdlets and writes a warning message. \ No newline at end of file diff --git a/src/Security/Security.Autorest/exports/Remove-AzSecurityConnector.ps1 b/src/Security/Security.Autorest/exports/Remove-AzSecurityConnector.ps1 new file mode 100644 index 000000000000..17879178e6a5 --- /dev/null +++ b/src/Security/Security.Autorest/exports/Remove-AzSecurityConnector.ps1 @@ -0,0 +1,217 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Deletes a security connector. +.Description +Deletes a security connector. +.Example +Remove-AzSecurityConnector -ResourceGroupName "securityconnectors-pwsh-tmp" -Name "ado-sdk-pwsh-test03" + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ApiId ]: API revision identifier. Must be unique in the API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + [GroupFqName ]: The GitLab group fully-qualified name. + [Id ]: Resource identity path + [OperationResultId ]: The operation result Id. + [OrgName ]: The Azure DevOps organization name. + [OwnerName ]: The GitHub owner name. + [ProjectName ]: The project name. + [RepoName ]: The repository name. + [ResourceGroupName ]: The name of the resource group within the user's subscription. The name is case insensitive. + [SecurityConnectorName ]: The security connector name. + [ServiceName ]: The name of the API Management service. + [SubscriptionId ]: Azure subscription ID +.Link +https://learn.microsoft.com/powershell/module/az.security/remove-azsecurityconnector +#> +function Remove-AzSecurityConnector { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Alias('SecurityConnectorName')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The security connector name. + ${Name}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The name of the resource group within the user's subscription. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Azure subscription ID + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity] + # Identity Parameter + # . + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait forNET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Delete = 'Az.Security.private\Remove-AzSecurityConnector_Delete'; + DeleteViaIdentity = 'Az.Security.private\Remove-AzSecurityConnector_DeleteViaIdentity'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Security/Security.Autorest/exports/Remove-AzSecurityConnectorDevOpsConfiguration.ps1 b/src/Security/Security.Autorest/exports/Remove-AzSecurityConnectorDevOpsConfiguration.ps1 new file mode 100644 index 000000000000..9ed1f38e2ab2 --- /dev/null +++ b/src/Security/Security.Autorest/exports/Remove-AzSecurityConnectorDevOpsConfiguration.ps1 @@ -0,0 +1,228 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Deletes a DevOps Connector. +.Description +Deletes a DevOps Connector. +.Example +Remove-AzSecurityConnectorDevOpsConfiguration -ResourceGroupName "securityconnectors-pwsh-tmp" -SecurityConnectorName "ado-sdk-pwsh-test03" + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ApiId ]: API revision identifier. Must be unique in the API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + [GroupFqName ]: The GitLab group fully-qualified name. + [Id ]: Resource identity path + [OperationResultId ]: The operation result Id. + [OrgName ]: The Azure DevOps organization name. + [OwnerName ]: The GitHub owner name. + [ProjectName ]: The project name. + [RepoName ]: The repository name. + [ResourceGroupName ]: The name of the resource group within the user's subscription. The name is case insensitive. + [SecurityConnectorName ]: The security connector name. + [ServiceName ]: The name of the API Management service. + [SubscriptionId ]: Azure subscription ID +.Link +https://learn.microsoft.com/powershell/module/az.security/remove-azsecurityconnectordevopsconfiguration +#> +function Remove-AzSecurityConnectorDevOpsConfiguration { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The security connector name. + ${SecurityConnectorName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Azure subscription ID + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity] + # Identity Parameter + # . + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait forNET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Delete = 'Az.Security.private\Remove-AzSecurityConnectorDevOpsConfiguration_Delete'; + DeleteViaIdentity = 'Az.Security.private\Remove-AzSecurityConnectorDevOpsConfiguration_DeleteViaIdentity'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Security/Security.Autorest/exports/Update-AzSecurityConnector.ps1 b/src/Security/Security.Autorest/exports/Update-AzSecurityConnector.ps1 new file mode 100644 index 000000000000..3e544cc2adfa --- /dev/null +++ b/src/Security/Security.Autorest/exports/Update-AzSecurityConnector.ps1 @@ -0,0 +1,270 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Updates a security connector +.Description +Updates a security connector +.Example +Update-AzSecurityConnector -ResourceGroupName "securityConnectors-pwsh-tmp" -Name "ado-sdk-pwsh-test03" -Tag @{myTag="v1"} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnector +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +ENVIRONMENTDATA : The security connector environment data. + EnvironmentType : The type of the environment data. + +INPUTOBJECT : Identity Parameter + [ApiId ]: API revision identifier. Must be unique in the API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + [GroupFqName ]: The GitLab group fully-qualified name. + [Id ]: Resource identity path + [OperationResultId ]: The operation result Id. + [OrgName ]: The Azure DevOps organization name. + [OwnerName ]: The GitHub owner name. + [ProjectName ]: The project name. + [RepoName ]: The repository name. + [ResourceGroupName ]: The name of the resource group within the user's subscription. The name is case insensitive. + [SecurityConnectorName ]: The security connector name. + [ServiceName ]: The name of the API Management service. + [SubscriptionId ]: Azure subscription ID + +OFFERING : A collection of offerings for the security connector. + OfferingType : The type of the security offering. +.Link +https://learn.microsoft.com/powershell/module/az.security/update-azsecurityconnector +#> +function Update-AzSecurityConnector { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnector])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Alias('SecurityConnectorName')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The security connector name. + ${Name}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The name of the resource group within the user's subscription. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Azure subscription ID + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity] + # Identity Parameter + # . + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironment] + # The security connector environment data. + # . + ${EnvironmentData}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Azure", "AWS", "GCP", "Github", "AzureDevOps", "GitLab")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The multi cloud resource's cloud name. + ${EnvironmentName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # Entity tag is used for comparing two or more entities from the same requested resource. + ${Etag}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # The multi cloud resource identifier (account id in case of AWS connector, project number in case of GCP connector). + ${HierarchyIdentifier}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # Kind of the resource + ${Kind}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # Location where the resource is stored + ${Location}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOffering[]] + # A collection of offerings for the security connector. + # . + ${Offering}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITags]))] + [System.Collections.Hashtable] + # A list of key value pairs that describe the resource. + ${Tag}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait forNET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + UpdateExpanded = 'Az.Security.private\Update-AzSecurityConnector_UpdateExpanded'; + UpdateViaIdentityExpanded = 'Az.Security.private\Update-AzSecurityConnector_UpdateViaIdentityExpanded'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Security/Security.Autorest/exports/Update-AzSecurityConnectorAzureDevOpsOrg.ps1 b/src/Security/Security.Autorest/exports/Update-AzSecurityConnectorAzureDevOpsOrg.ps1 new file mode 100644 index 000000000000..7c3be5e7e188 --- /dev/null +++ b/src/Security/Security.Autorest/exports/Update-AzSecurityConnectorAzureDevOpsOrg.ps1 @@ -0,0 +1,246 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Updates monitored Azure DevOps organization details. +.Description +Updates monitored Azure DevOps organization details. +.Example +$config = New-AzSecurityConnectorActionableRemediationObject -State Enabled -InheritFromParentState Disabled -CategoryConfiguration @( @{category="IaC"; minimumSeverityLevel="High"}) +Update-AzSecurityConnectorAzureDevOpsOrg -ResourceGroupName "securityConnectors-pwsh-tmp" -SecurityConnectorName "ado-sdk-pwsh-test03" -OrgName "org1" -ActionableRemediation $config + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrg +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +ACTIONABLEREMEDIATION : Configuration payload for PR Annotations. + [BranchConfiguration ]: Repository branch configuration for PR Annotations. + [AnnotateDefaultBranch ]: Configuration of PR Annotations on default branch. Enabled - PR Annotations are enabled on the resource's default branch. Disabled - PR Annotations are disabled on the resource's default branch. + [BranchName >]: Gets or sets branches that should have annotations. + [CategoryConfiguration >]: Gets or sets list of categories and severity levels. + [Category ]: Rule categories. Code - code scanning results. Artifact scanning results. Dependencies scanning results. IaC results. Secrets scanning results. Container scanning results. + [MinimumSeverityLevel ]: Gets or sets minimum severity level for a given category. + [InheritFromParentState ]: Update Settings. Enabled - Resource should inherit configurations from parent. Disabled - Resource should not inherit configurations from parent. + [State ]: ActionableRemediation Setting. None - the setting was never set. Enabled - ActionableRemediation is enabled. Disabled - ActionableRemediation is disabled. + +INPUTOBJECT : Identity Parameter + [ApiId ]: API revision identifier. Must be unique in the API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + [GroupFqName ]: The GitLab group fully-qualified name. + [Id ]: Resource identity path + [OperationResultId ]: The operation result Id. + [OrgName ]: The Azure DevOps organization name. + [OwnerName ]: The GitHub owner name. + [ProjectName ]: The project name. + [RepoName ]: The repository name. + [ResourceGroupName ]: The name of the resource group within the user's subscription. The name is case insensitive. + [SecurityConnectorName ]: The security connector name. + [ServiceName ]: The name of the API Management service. + [SubscriptionId ]: Azure subscription ID +.Link +https://learn.microsoft.com/powershell/module/az.security/update-azsecurityconnectorazuredevopsorg +#> +function Update-AzSecurityConnectorAzureDevOpsOrg { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrg])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The Azure DevOps organization name. + ${OrgName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The security connector name. + ${SecurityConnectorName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Azure subscription ID + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity] + # Identity Parameter + # . + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediation] + # Configuration payload for PR Annotations. + # . + ${ActionableRemediation}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait forNET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + UpdateExpanded = 'Az.Security.private\Update-AzSecurityConnectorAzureDevOpsOrg_UpdateExpanded'; + UpdateViaIdentityExpanded = 'Az.Security.private\Update-AzSecurityConnectorAzureDevOpsOrg_UpdateViaIdentityExpanded'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Security/Security.Autorest/exports/Update-AzSecurityConnectorAzureDevOpsProject.ps1 b/src/Security/Security.Autorest/exports/Update-AzSecurityConnectorAzureDevOpsProject.ps1 new file mode 100644 index 000000000000..1b36e71c7126 --- /dev/null +++ b/src/Security/Security.Autorest/exports/Update-AzSecurityConnectorAzureDevOpsProject.ps1 @@ -0,0 +1,258 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Updates a monitored Azure DevOps project resource. +.Description +Updates a monitored Azure DevOps project resource. +.Example +$config = New-AzSecurityConnectorActionableRemediationObject -State Disabled -InheritFromParentState Disabled -CategoryConfiguration @( @{category="IaC"; minimumSeverityLevel="Low"}) +Update-AzSecurityConnectorAzureDevOpsProject -ResourceGroupName "securityConnectors-pwsh-tmp" -SecurityConnectorName "ado-sdk-pwsh-test03" -OrgName "org1" -ProjectName "Build" -ActionableRemediation $config + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProject +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +ACTIONABLEREMEDIATION : Configuration payload for PR Annotations. + [BranchConfiguration ]: Repository branch configuration for PR Annotations. + [AnnotateDefaultBranch ]: Configuration of PR Annotations on default branch. Enabled - PR Annotations are enabled on the resource's default branch. Disabled - PR Annotations are disabled on the resource's default branch. + [BranchName >]: Gets or sets branches that should have annotations. + [CategoryConfiguration >]: Gets or sets list of categories and severity levels. + [Category ]: Rule categories. Code - code scanning results. Artifact scanning results. Dependencies scanning results. IaC results. Secrets scanning results. Container scanning results. + [MinimumSeverityLevel ]: Gets or sets minimum severity level for a given category. + [InheritFromParentState ]: Update Settings. Enabled - Resource should inherit configurations from parent. Disabled - Resource should not inherit configurations from parent. + [State ]: ActionableRemediation Setting. None - the setting was never set. Enabled - ActionableRemediation is enabled. Disabled - ActionableRemediation is disabled. + +INPUTOBJECT : Identity Parameter + [ApiId ]: API revision identifier. Must be unique in the API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + [GroupFqName ]: The GitLab group fully-qualified name. + [Id ]: Resource identity path + [OperationResultId ]: The operation result Id. + [OrgName ]: The Azure DevOps organization name. + [OwnerName ]: The GitHub owner name. + [ProjectName ]: The project name. + [RepoName ]: The repository name. + [ResourceGroupName ]: The name of the resource group within the user's subscription. The name is case insensitive. + [SecurityConnectorName ]: The security connector name. + [ServiceName ]: The name of the API Management service. + [SubscriptionId ]: Azure subscription ID +.Link +https://learn.microsoft.com/powershell/module/az.security/update-azsecurityconnectorazuredevopsproject +#> +function Update-AzSecurityConnectorAzureDevOpsProject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProject])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The Azure DevOps organization name. + ${OrgName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The project name. + ${ProjectName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The security connector name. + ${SecurityConnectorName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Azure subscription ID + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity] + # Identity Parameter + # . + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediation] + # Configuration payload for PR Annotations. + # . + ${ActionableRemediation}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # Gets or sets parent Azure DevOps Organization name. + ${ParentOrgName}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait forNET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + UpdateExpanded = 'Az.Security.private\Update-AzSecurityConnectorAzureDevOpsProject_UpdateExpanded'; + UpdateViaIdentityExpanded = 'Az.Security.private\Update-AzSecurityConnectorAzureDevOpsProject_UpdateViaIdentityExpanded'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Security/Security.Autorest/exports/Update-AzSecurityConnectorAzureDevOpsRepo.ps1 b/src/Security/Security.Autorest/exports/Update-AzSecurityConnectorAzureDevOpsRepo.ps1 new file mode 100644 index 000000000000..e960c381ea79 --- /dev/null +++ b/src/Security/Security.Autorest/exports/Update-AzSecurityConnectorAzureDevOpsRepo.ps1 @@ -0,0 +1,270 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Updates a monitored Azure DevOps repository resource. +.Description +Updates a monitored Azure DevOps repository resource. +.Example +$config = New-AzSecurityConnectorActionableRemediationObject -State Enabled -InheritFromParentState Disabled -CategoryConfiguration @( @{category="IaC"; minimumSeverityLevel="Low"} ) +Update-AzSecurityConnectorAzureDevOpsRepo -ResourceGroupName "securityConnectors-pwsh-tmp" -SecurityConnectorName "ado-sdk-pwsh-test03" -OrgName "org1" -ProjectName "Build" -RepoName "Build" -ActionableRemediation $config + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepository +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +ACTIONABLEREMEDIATION : Configuration payload for PR Annotations. + [BranchConfiguration ]: Repository branch configuration for PR Annotations. + [AnnotateDefaultBranch ]: Configuration of PR Annotations on default branch. Enabled - PR Annotations are enabled on the resource's default branch. Disabled - PR Annotations are disabled on the resource's default branch. + [BranchName >]: Gets or sets branches that should have annotations. + [CategoryConfiguration >]: Gets or sets list of categories and severity levels. + [Category ]: Rule categories. Code - code scanning results. Artifact scanning results. Dependencies scanning results. IaC results. Secrets scanning results. Container scanning results. + [MinimumSeverityLevel ]: Gets or sets minimum severity level for a given category. + [InheritFromParentState ]: Update Settings. Enabled - Resource should inherit configurations from parent. Disabled - Resource should not inherit configurations from parent. + [State ]: ActionableRemediation Setting. None - the setting was never set. Enabled - ActionableRemediation is enabled. Disabled - ActionableRemediation is disabled. + +INPUTOBJECT : Identity Parameter + [ApiId ]: API revision identifier. Must be unique in the API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + [GroupFqName ]: The GitLab group fully-qualified name. + [Id ]: Resource identity path + [OperationResultId ]: The operation result Id. + [OrgName ]: The Azure DevOps organization name. + [OwnerName ]: The GitHub owner name. + [ProjectName ]: The project name. + [RepoName ]: The repository name. + [ResourceGroupName ]: The name of the resource group within the user's subscription. The name is case insensitive. + [SecurityConnectorName ]: The security connector name. + [ServiceName ]: The name of the API Management service. + [SubscriptionId ]: Azure subscription ID +.Link +https://learn.microsoft.com/powershell/module/az.security/update-azsecurityconnectorazuredevopsrepo +#> +function Update-AzSecurityConnectorAzureDevOpsRepo { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepository])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The Azure DevOps organization name. + ${OrgName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The project name. + ${ProjectName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The repository name. + ${RepoName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The security connector name. + ${SecurityConnectorName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Azure subscription ID + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity] + # Identity Parameter + # . + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediation] + # Configuration payload for PR Annotations. + # . + ${ActionableRemediation}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # Gets or sets parent Azure DevOps Organization name. + ${ParentOrgName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # Gets or sets parent Azure DevOps Project name. + ${ParentProjectName}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait forNET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + UpdateExpanded = 'Az.Security.private\Update-AzSecurityConnectorAzureDevOpsRepo_UpdateExpanded'; + UpdateViaIdentityExpanded = 'Az.Security.private\Update-AzSecurityConnectorAzureDevOpsRepo_UpdateViaIdentityExpanded'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Security/Security.Autorest/exports/Update-AzSecurityConnectorDevOpsConfiguration.ps1 b/src/Security/Security.Autorest/exports/Update-AzSecurityConnectorDevOpsConfiguration.ps1 new file mode 100644 index 000000000000..91603e0bd52a --- /dev/null +++ b/src/Security/Security.Autorest/exports/Update-AzSecurityConnectorDevOpsConfiguration.ps1 @@ -0,0 +1,243 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Updates a DevOps Configuration. +.Description +Updates a DevOps Configuration. +.Example +Update-AzSecurityConnectorDevOpsConfiguration -ResourceGroupName "securityConnectors-pwsh-tmp" -SecurityConnectorName "ado-sdk-pwsh-test03" -AutoDiscovery Enabled + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfiguration +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ApiId ]: API revision identifier. Must be unique in the API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + [GroupFqName ]: The GitLab group fully-qualified name. + [Id ]: Resource identity path + [OperationResultId ]: The operation result Id. + [OrgName ]: The Azure DevOps organization name. + [OwnerName ]: The GitHub owner name. + [ProjectName ]: The project name. + [RepoName ]: The repository name. + [ResourceGroupName ]: The name of the resource group within the user's subscription. The name is case insensitive. + [SecurityConnectorName ]: The security connector name. + [ServiceName ]: The name of the API Management service. + [SubscriptionId ]: Azure subscription ID +.Link +https://learn.microsoft.com/powershell/module/az.security/update-azsecurityconnectordevopsconfiguration +#> +function Update-AzSecurityConnectorDevOpsConfiguration { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfiguration])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [System.String] + # The security connector name. + ${SecurityConnectorName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Azure subscription ID + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity] + # Identity Parameter + # . + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # Gets or sets one-time OAuth code to exchange for refresh and access tokens.Only used during PUT/PATCH operations. + # The secret is cleared during GET. + ${AuthorizationCode}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Disabled", "Enabled", "NotApplicable")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String] + # AutoDiscovery states. + ${AutoDiscovery}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Body')] + [System.String[]] + # List of top-level inventory to select when AutoDiscovery is disabled.This field is ignored when AutoDiscovery is enabled. + ${TopLevelInventoryList}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait forNET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + UpdateExpanded = 'Az.Security.private\Update-AzSecurityConnectorDevOpsConfiguration_UpdateExpanded'; + UpdateViaIdentityExpanded = 'Az.Security.private\Update-AzSecurityConnectorDevOpsConfiguration_UpdateViaIdentityExpanded'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Security/Security.Autorest/generate-help.ps1 b/src/Security/Security.Autorest/generate-help.ps1 new file mode 100644 index 000000000000..bc9e2a65d174 --- /dev/null +++ b/src/Security/Security.Autorest/generate-help.ps1 @@ -0,0 +1,74 @@ +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- +param([switch]$NotIsolated) +$ErrorActionPreference = 'Stop' + +$pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path +if(-not $NotIsolated) { + Write-Host -ForegroundColor Green 'Creating isolated process...' + & "$pwsh" -NonInteractive -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -NotIsolated + return +} + +$exportsFolder = Join-Path $PSScriptRoot 'exports' +if(-not (Test-Path $exportsFolder)) { + Write-Error "Exports folder '$exportsFolder' was not found." +} + +$directories = Get-ChildItem -Directory -Path $exportsFolder +$hasProfiles = ($directories | Measure-Object).Count -gt 0 +if(-not $hasProfiles) { + $directories = Get-Item -Path $exportsFolder +} + +$docsFolder = Join-Path $PSScriptRoot 'docs' +if(Test-Path $docsFolder) { + $null = Get-ChildItem -Path $docsFolder -Recurse -Exclude 'README.md' | Remove-Item -Recurse -ErrorAction SilentlyContinue +} +$null = New-Item -ItemType Directory -Force -Path $docsFolder -ErrorAction SilentlyContinue +$examplesFolder = Join-Path $PSScriptRoot 'examples' + +$modulePsd1 = Get-Item -Path (Join-Path $PSScriptRoot './Az.Security.psd1') +$modulePath = $modulePsd1.FullName +$moduleName = $modulePsd1.BaseName + +# Load DLL to use build-time cmdlets +Import-Module -Name $modulePath +Import-Module -Name (Join-Path $PSScriptRoot './bin/Az.Security.private.dll') +$instance = [Microsoft.Azure.PowerShell.Cmdlets.Security.Module]::Instance +# Module info is shared per profile +$moduleInfo = Get-Module -Name $moduleName + +foreach($directory in $directories) +{ + if($hasProfiles) { + Select-AzProfile -Name $directory.Name + } + # Reload module per profile + Import-Module -Name $modulePath -Force + + $cmdletNames = Get-ScriptCmdlet -ScriptFolder $directory.FullName + $cmdletHelpInfo = $cmdletNames | ForEach-Object { Get-Help -Name $_ -Full } + $cmdletFunctionInfo = Get-ScriptCmdlet -ScriptFolder $directory.FullName -AsFunctionInfo + + $docsPath = Join-Path $docsFolder $directory.Name + $null = New-Item -ItemType Directory -Force -Path $docsPath -ErrorAction SilentlyContinue + $examplesPath = Join-Path $examplesFolder $directory.Name + $addComplexInterfaceInfo = ![System.Convert]::ToBoolean('true') + Export-HelpMarkdown -ModuleInfo $moduleInfo -FunctionInfo $cmdletFunctionInfo -HelpInfo $cmdletHelpInfo -DocsFolder $docsPath -ExamplesFolder $examplesPath -AddComplexInterfaceInfo:$addComplexInterfaceInfo + Write-Host -ForegroundColor Green "Created documentation in '$docsPath'" +} + +Write-Host -ForegroundColor Green '-------------Done-------------' \ No newline at end of file diff --git a/src/Security/Security.Autorest/generate-portal-ux.ps1 b/src/Security/Security.Autorest/generate-portal-ux.ps1 new file mode 100644 index 000000000000..5307ba742cf2 --- /dev/null +++ b/src/Security/Security.Autorest/generate-portal-ux.ps1 @@ -0,0 +1,374 @@ +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# +# This Script will create a folder dedicated to Azure-specific content and includes metadata files essential for enhancing the user experience (UX) within the Azure portal. +# These files are utilized by the Azure portal to effectively present the usage of cmdlets related to specific resources on portal pages. +# ---------------------------------------------------------------------------------- +param([switch]$NotIsolated) +$ErrorActionPreference = 'Stop' + +$pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path +if(-not $NotIsolated) { + Write-Host -ForegroundColor Green 'Creating isolated process...' + & "$pwsh" -NonInteractive -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -NotIsolated + return +} + +$moduleName = 'Az.Security' +$rootModuleName = '' +if ($rootModuleName -eq "") +{ + $rootModuleName = $moduleName +} +$modulePsd1 = Get-Item -Path (Join-Path $PSScriptRoot "./$moduleName.psd1") +$modulePath = $modulePsd1.FullName + +# Load DLL to use build-time cmdlets +Import-Module -Name $modulePath +Import-Module -Name (Join-Path $PSScriptRoot "./bin/$moduleName.private.dll") +$instance = [Microsoft.Azure.PowerShell.Cmdlets.Security.Module]::Instance +# Module info is shared per profile +$moduleInfo = Get-Module -Name $moduleName +$parameterSetsInfo = Get-Module -Name "$moduleName.private" + +function Test-FunctionSupported() +{ + [CmdletBinding()] + Param ( + [Parameter()] + [string] + $FunctionName + ) + + If (-not $FunctionName.Contains("_")) { + return $false + } + + $cmdletName, $parameterSetName = $FunctionName.Split("_") + If ($parameterSetName.Contains("List") -or $parameterSetName.Contains("ViaIdentity") -or $parameterSetName.Contains("ViaJson")) { + return $false + } + If ($cmdletName.StartsWith("New") -or $cmdletName.StartsWith("Set") -or $cmdletName.StartsWith("Update")) { + return $false + } + + $parameterSetInfo = $parameterSetsInfo.ExportedCmdlets[$FunctionName] + foreach ($parameterInfo in $parameterSetInfo.Parameters.Values) + { + $category = (Get-ParameterAttribute -ParameterInfo $parameterInfo -AttributeName "CategoryAttribute").Categories + $invalideCategory = @('Query', 'Body') + if ($invalideCategory -contains $category) + { + return $false + } + } + + $customFiles = Get-ChildItem -Path custom -Filter "$cmdletName.*" + if ($customFiles.Length -ne 0) + { + Write-Host -ForegroundColor Yellow "There are come custom files for $cmdletName, skip generate UX data for it." + return $false + } + + return $true +} + +function Get-MappedCmdletFromFunctionName() +{ + [CmdletBinding()] + Param ( + [Parameter()] + [string] + $FunctionName + ) + + $cmdletName, $parameterSetName = $FunctionName.Split("_") + + return $cmdletName +} + +function Get-ParameterAttribute() +{ + [CmdletBinding()] + Param ( + [Parameter()] + [System.Management.Automation.ParameterMetadata] + $ParameterInfo, + [Parameter()] + [String] + $AttributeName + ) + return $ParameterInfo.Attributes | Where-Object { $_.TypeId.Name -eq $AttributeName } +} + +function Get-CmdletAttribute() +{ + [CmdletBinding()] + Param ( + [Parameter()] + [System.Management.Automation.CommandInfo] + $CmdletInfo, + [Parameter()] + [String] + $AttributeName + ) + + return $CmdletInfo.ImplementingType.GetTypeInfo().GetCustomAttributes([System.object], $true) | Where-Object { $_.TypeId.Name -eq $AttributeName } +} + +function Get-CmdletDescription() +{ + [CmdletBinding()] + Param ( + [Parameter()] + [String] + $CmdletName + ) + $helpInfo = Get-Help $CmdletName -Full + + $description = $helpInfo.Description.Text + if ($null -eq $description) + { + return "" + } + return $description +} + +# Test whether the parameter is from swagger http path +function Test-ParameterFromSwagger() +{ + [CmdletBinding()] + Param ( + [Parameter()] + [System.Management.Automation.ParameterMetadata] + $ParameterInfo + ) + $category = (Get-ParameterAttribute -ParameterInfo $ParameterInfo -AttributeName "CategoryAttribute").Categories + $doNotExport = Get-ParameterAttribute -ParameterInfo $ParameterInfo -AttributeName "DoNotExportAttribute" + if ($null -ne $doNotExport) + { + return $false + } + + $valideCategory = @('Path') + if ($valideCategory -contains $category) + { + return $true + } + return $false +} + +function New-ExampleForParameterSet() +{ + [CmdletBinding()] + Param ( + [Parameter()] + [System.Management.Automation.CommandInfo] + $ParameterSetInfo + ) + $parameters = $ParameterSetInfo.Parameters.Values | Where-Object { Test-ParameterFromSwagger $_ } + $result = @() + foreach ($parameter in $parameters) + { + $category = (Get-ParameterAttribute -parameterInfo $parameter -AttributeName "CategoryAttribute").Categories + $sourceName = (Get-ParameterAttribute -parameterInfo $parameter -AttributeName "InfoAttribute").SerializedName + $name = $parameter.Name + $result += [ordered]@{ + name = "-$Name" + value = "[$category.$sourceName]" + } + } + + return $result +} + +function New-ParameterArrayInParameterSet() +{ + [CmdletBinding()] + Param ( + [Parameter()] + [System.Management.Automation.CommandInfo] + $ParameterSetInfo + ) + $parameters = $ParameterSetInfo.Parameters.Values | Where-Object { Test-ParameterFromSwagger $_ } + $result = @() + foreach ($parameter in $parameters) + { + $isMandatory = (Get-ParameterAttribute -parameterInfo $parameter -AttributeName "ParameterAttribute").Mandatory + $parameterName = $parameter.Name + $parameterType = $parameter.ParameterType.ToString().Split('.')[1] + if ($parameter.SwitchParameter) + { + $parameterSignature = "-$parameterName" + } + else + { + $parameterSignature = "-$parameterName <$parameterType>" + } + if ($parameterName -eq "SubscriptionId") + { + $isMandatory = $false + } + if (-not $isMandatory) + { + $parameterSignature = "[$parameterSignature]" + } + $result += $parameterSignature + } + + return $result +} + +function New-MetadataForParameterSet() +{ + [CmdletBinding()] + Param ( + [Parameter()] + [System.Management.Automation.CommandInfo] + $ParameterSetInfo + ) + $httpAttribute = Get-CmdletAttribute -CmdletInfo $ParameterSetInfo -AttributeName "HttpPathAttribute" + $httpPath = $httpAttribute.Path + $apiVersion = $httpAttribute.ApiVersion + $provider = [System.Text.RegularExpressions.Regex]::New("/providers/([\w+\.]+)/").Match($httpPath).Groups[1].Value + $resourcePath = "/" + $httpPath.Split("$provider/")[1] + $resourceType = [System.Text.RegularExpressions.Regex]::New("/([\w]+)/\{\w+\}").Matches($resourcePath) | ForEach-Object {$_.groups[1].Value} | Join-String -Separator "/" + $cmdletName = Get-MappedCmdletFromFunctionName $ParameterSetInfo.Name + $description = (Get-CmdletAttribute -CmdletInfo $ParameterSetInfo -AttributeName "DescriptionAttribute").Description + [object[]]$example = New-ExampleForParameterSet $ParameterSetInfo + [string[]]$signature = New-ParameterArrayInParameterSet $ParameterSetInfo + + return @{ + Path = $httpPath + Provider = $provider + ResourceType = $resourceType + ApiVersion = $apiVersion + CmdletName = $cmdletName + Description = $description + Example = $example + Signature = @{ + parameters = $signature + } + } +} + +function Merge-WithExistCmdletMetadata() +{ + [CmdletBinding()] + Param ( + [Parameter()] + [System.Collections.Specialized.OrderedDictionary] + $ExistedCmdletInfo, + [Parameter()] + [Hashtable] + $ParameterSetMetadata + ) + $ExistedCmdletInfo.help.parameterSets += $ParameterSetMetadata.Signature + $ExistedCmdletInfo.examples += [ordered]@{ + description = $ParameterSetMetadata.Description + parameters = $ParameterSetMetadata.Example + } + + return $ExistedCmdletInfo +} + +function New-MetadataForCmdlet() +{ + [CmdletBinding()] + Param ( + [Parameter()] + [Hashtable] + $ParameterSetMetadata + ) + $cmdletName = $ParameterSetMetadata.CmdletName + $description = Get-CmdletDescription $cmdletName + $result = [ordered]@{ + name = $cmdletName + description = $description + path = $ParameterSetMetadata.Path + help = [ordered]@{ + learnMore = [ordered]@{ + url = "https://learn.microsoft.com/powershell/module/$rootModuleName/$cmdletName".ToLower() + } + parameterSets = @() + } + examples = @() + } + $result = Merge-WithExistCmdletMetadata -ExistedCmdletInfo $result -ParameterSetMetadata $ParameterSetMetadata + return $result +} + +$parameterSets = $parameterSetsInfo.ExportedCmdlets.Keys | Where-Object { Test-FunctionSupported($_) } +$resourceTypes = @{} +foreach ($parameterSetName in $parameterSets) +{ + $cmdletInfo = $parameterSetsInfo.ExportedCommands[$parameterSetName] + $parameterSetMetadata = New-MetadataForParameterSet -ParameterSetInfo $cmdletInfo + $cmdletName = $parameterSetMetadata.CmdletName + if (-not ($moduleInfo.ExportedCommands.ContainsKey($cmdletName))) + { + continue + } + if ($resourceTypes.ContainsKey($parameterSetMetadata.ResourceType)) + { + $ExistedCmdletInfo = $resourceTypes[$parameterSetMetadata.ResourceType].commands | Where-Object { $_.name -eq $cmdletName } + if ($ExistedCmdletInfo) + { + $ExistedCmdletInfo = Merge-WithExistCmdletMetadata -ExistedCmdletInfo $ExistedCmdletInfo -ParameterSetMetadata $parameterSetMetadata + } + else + { + $cmdletInfo = New-MetadataForCmdlet -ParameterSetMetadata $parameterSetMetadata + $resourceTypes[$parameterSetMetadata.ResourceType].commands += $cmdletInfo + } + } + else + { + $cmdletInfo = New-MetadataForCmdlet -ParameterSetMetadata $parameterSetMetadata + $resourceTypes[$parameterSetMetadata.ResourceType] = [ordered]@{ + resourceType = $parameterSetMetadata.ResourceType + apiVersion = $parameterSetMetadata.ApiVersion + learnMore = @{ + url = "https://learn.microsoft.com/powershell/module/$rootModuleName".ToLower() + } + commands = @($cmdletInfo) + provider = $parameterSetMetadata.Provider + } + } +} + +$UXFolder = 'UX' +if (Test-Path $UXFolder) +{ + Remove-Item -Path $UXFolder -Recurse +} +$null = New-Item -ItemType Directory -Path $UXFolder + +foreach ($resourceType in $resourceTypes.Keys) +{ + $resourceTypeFileName = $resourceType -replace "/", "-" + if ($resourceTypeFileName -eq "") + { + continue + } + $resourceTypeInfo = $resourceTypes[$resourceType] + $provider = $resourceTypeInfo.provider + $providerFolder = "$UXFolder/$provider" + if (-not (Test-Path $providerFolder)) + { + $null = New-Item -ItemType Directory -Path $providerFolder + } + $resourceTypeInfo.Remove("provider") + $resourceTypeInfo | ConvertTo-Json -Depth 10 | Out-File "$providerFolder/$resourceTypeFileName.json" +} diff --git a/src/Security/Security.Autorest/generated/Module.cs b/src/Security/Security.Autorest/generated/Module.cs new file mode 100644 index 000000000000..e8c5ccd844aa --- /dev/null +++ b/src/Security/Security.Autorest/generated/Module.cs @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + using SendAsyncStepDelegate = global::System.Func, global::System.Threading.Tasks.Task>, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>; + using PipelineChangeDelegate = global::System.Action, global::System.Threading.Tasks.Task>, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>>; + using GetParameterDelegate = global::System.Func; + using ModuleLoadPipelineDelegate = global::System.Action, global::System.Threading.Tasks.Task>, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>>, global::System.Action, global::System.Threading.Tasks.Task>, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>>>; + using ArgumentCompleterDelegate = global::System.Func; + using GetTelemetryIdDelegate = global::System.Func; + using TelemetryDelegate = global::System.Action; + using NewRequestPipelineDelegate = global::System.Action, global::System.Threading.Tasks.Task>, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>>, global::System.Action, global::System.Threading.Tasks.Task>, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>>>; + using SignalDelegate = global::System.Func, global::System.Threading.Tasks.Task>; + using EventListenerDelegate = global::System.Func, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Management.Automation.InvocationInfo, string, string, string, global::System.Exception, global::System.Threading.Tasks.Task>; + using NextDelegate = global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>; + + /// A class that contains the module-common code and data. + public partial class Module + { + /// The currently selected profile. + public string Profile = global::System.String.Empty; + + public global::System.Net.Http.HttpClientHandler _handler = new global::System.Net.Http.HttpClientHandler(); + + private static bool _init = false; + + private static readonly global::System.Object _initLock = new global::System.Object(); + + private static Microsoft.Azure.PowerShell.Cmdlets.Security.Module _instance; + + /// the ISendAsync pipeline instance + private Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.HttpPipeline _pipeline; + + /// the ISendAsync pipeline instance (when proxy is enabled) + private Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.HttpPipeline _pipelineWithProxy; + + private static readonly global::System.Object _singletonLock = new global::System.Object(); + + public bool _useProxy = false; + + public global::System.Net.WebProxy _webProxy = new global::System.Net.WebProxy(); + + /// Gets completion data for azure specific fields + public ArgumentCompleterDelegate ArgumentCompleter { get; set; } + + /// The instance of the Client API + public Microsoft.Azure.PowerShell.Cmdlets.Security.Security ClientAPI { get; set; } + + /// A delegate that gets called for each signalled event + public EventListenerDelegate EventListener { get; set; } + + /// The delegate to call to get parameter data from a common module. + public GetParameterDelegate GetParameterValue { get; set; } + + /// The delegate to get the telemetry Id. + public GetTelemetryIdDelegate GetTelemetryId { get; set; } + + /// the singleton of this module class + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Module Instance { get { if (_instance == null) { lock (_singletonLock) { if (_instance == null) { _instance = new Module(); }}} return _instance; } } + + /// The Name of this module + public string Name => @"Az.Security"; + + /// The delegate to call when this module is loaded (supporting a commmon module). + public ModuleLoadPipelineDelegate OnModuleLoad { get; set; } + + /// The delegate to call before each new request (supporting a commmon module). + public NewRequestPipelineDelegate OnNewRequest { get; set; } + + /// The name of the currently selected Azure profile + public global::System.String ProfileName { get; set; } + + /// The ResourceID for this module (azure arm). + public string ResourceId => @"Az.Security"; + + /// The delegate for creating a telemetry. + public TelemetryDelegate Telemetry { get; set; } + + /// The from the cmdlet + /// The HttpPipeline for the request + + partial void AfterCreatePipeline(global::System.Management.Automation.InvocationInfo invocationInfo, ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.HttpPipeline pipeline); + + /// The from the cmdlet + /// The HttpPipeline for the request + + partial void BeforeCreatePipeline(global::System.Management.Automation.InvocationInfo invocationInfo, ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.HttpPipeline pipeline); + + partial void CustomInit(); + + /// Creates an instance of the HttpPipeline for each call. + /// The from the cmdlet + /// the cmdlet's correlation id. + /// the cmdlet's process record correlation id. + /// the cmdlet's parameterset name. + /// a dict for extensible parameters + /// An instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.HttpPipeline for the remote call. + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.HttpPipeline CreatePipeline(global::System.Management.Automation.InvocationInfo invocationInfo, string correlationId, string processRecordId, string parameterSetName = null, global::System.Collections.Generic.IDictionary extensibleParameters = null) + { + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.HttpPipeline pipeline = null; + BeforeCreatePipeline(invocationInfo, ref pipeline); + pipeline = (pipeline ?? (_useProxy ? _pipelineWithProxy : _pipeline)).Clone(); + AfterCreatePipeline(invocationInfo, ref pipeline); + pipeline.Append(new Runtime.CmdInfoHandler(processRecordId, invocationInfo, parameterSetName).SendAsync); + OnNewRequest?.Invoke( invocationInfo, correlationId,processRecordId, (step)=> { pipeline.Prepend(step); } , (step)=> { pipeline.Append(step); } ); + return pipeline; + } + + /// Gets parameters from a common module. + /// The from the cmdlet + /// the cmdlet's correlation id. + /// The name of the parameter to get the value for. + /// + /// The parameter value from the common module. (Note: this should be type converted on the way back) + /// + public object GetParameter(global::System.Management.Automation.InvocationInfo invocationInfo, string correlationId, string parameterName) => GetParameterValue?.Invoke( ResourceId, Name, invocationInfo, correlationId,parameterName ); + + /// Initialization steps performed after the module is loaded. + public void Init() + { + if (_init == false) + { + lock (_initLock) { + if (_init == false) { + OnModuleLoad?.Invoke( ResourceId, Name ,(step)=> { _pipeline.Prepend(step); } , (step)=> { _pipeline.Append(step); } ); + OnModuleLoad?.Invoke( ResourceId, Name ,(step)=> { _pipelineWithProxy.Prepend(step); } , (step)=> { _pipelineWithProxy.Append(step); } ); + CustomInit(); + _init = true; + } + } + } + } + + /// Creates the module instance. + private Module() + { + // constructor + ClientAPI = new Microsoft.Azure.PowerShell.Cmdlets.Security.Security(); + _handler.Proxy = _webProxy; + _pipeline = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.HttpPipeline(new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.HttpClientFactory(new global::System.Net.Http.HttpClient())); + _pipelineWithProxy = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.HttpPipeline(new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.HttpClientFactory(new global::System.Net.Http.HttpClient(_handler))); + } + + /// The HTTP Proxy to use. + /// The HTTP Proxy Credentials + /// True if the proxy should use default credentials + public void SetProxyConfiguration(global::System.Uri proxy, global::System.Management.Automation.PSCredential proxyCredential, bool proxyUseDefaultCredentials) + { + _useProxy = proxy != null; + if (proxy == null) + { + return; + } + // set the proxy configuration + _webProxy.Address = proxy; + _webProxy.BypassProxyOnLocal = false; + if (proxyUseDefaultCredentials) + { + _webProxy.Credentials = null; + _webProxy.UseDefaultCredentials = true; + } + else + { + _webProxy.UseDefaultCredentials = false; + _webProxy.Credentials = proxyCredential ?.GetNetworkCredential(); + } + } + + /// Called to dispatch events to the common module listener + /// The ID of the event + /// The cancellation token for the event + /// A delegate to get the detailed event data + /// The callback for the event dispatcher + /// The from the cmdlet + /// the cmdlet's parameterset name. + /// the cmdlet's correlation id. + /// the cmdlet's process record correlation id. + /// the exception that is being thrown (if available) + /// + /// A that will be complete when handling of the event is completed. + /// + public async global::System.Threading.Tasks.Task Signal(string id, global::System.Threading.CancellationToken token, global::System.Func getEventData, SignalDelegate signal, global::System.Management.Automation.InvocationInfo invocationInfo, string parameterSetName, string correlationId, string processRecordId, global::System.Exception exception) + { + using( NoSynchronizationContext ) + { + await EventListener?.Invoke(id,token,getEventData, signal, invocationInfo, parameterSetName, correlationId,processRecordId,exception); + } + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/ActionableRemediation.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/ActionableRemediation.PowerShell.cs new file mode 100644 index 000000000000..0dd95c0ba1a1 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/ActionableRemediation.PowerShell.cs @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// Configuration payload for PR Annotations. + [System.ComponentModel.TypeConverter(typeof(ActionableRemediationTypeConverter))] + public partial class ActionableRemediation + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ActionableRemediation(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("State")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediationInternal)this).State = (string) content.GetValueForProperty("State",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediationInternal)this).State, global::System.Convert.ToString); + } + if (content.Contains("CategoryConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediationInternal)this).CategoryConfiguration = (System.Collections.Generic.List) content.GetValueForProperty("CategoryConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediationInternal)this).CategoryConfiguration, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CategoryConfigurationTypeConverter.ConvertFrom)); + } + if (content.Contains("BranchConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediationInternal)this).BranchConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITargetBranchConfiguration) content.GetValueForProperty("BranchConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediationInternal)this).BranchConfiguration, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.TargetBranchConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("InheritFromParentState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediationInternal)this).InheritFromParentState = (string) content.GetValueForProperty("InheritFromParentState",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediationInternal)this).InheritFromParentState, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ActionableRemediation(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("State")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediationInternal)this).State = (string) content.GetValueForProperty("State",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediationInternal)this).State, global::System.Convert.ToString); + } + if (content.Contains("CategoryConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediationInternal)this).CategoryConfiguration = (System.Collections.Generic.List) content.GetValueForProperty("CategoryConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediationInternal)this).CategoryConfiguration, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CategoryConfigurationTypeConverter.ConvertFrom)); + } + if (content.Contains("BranchConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediationInternal)this).BranchConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITargetBranchConfiguration) content.GetValueForProperty("BranchConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediationInternal)this).BranchConfiguration, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.TargetBranchConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("InheritFromParentState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediationInternal)this).InheritFromParentState = (string) content.GetValueForProperty("InheritFromParentState",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediationInternal)this).InheritFromParentState, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediation DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ActionableRemediation(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediation DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ActionableRemediation(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediation FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// Configuration payload for PR Annotations. + [System.ComponentModel.TypeConverter(typeof(ActionableRemediationTypeConverter))] + public partial interface IActionableRemediation + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/ActionableRemediation.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/ActionableRemediation.TypeConverter.cs new file mode 100644 index 000000000000..84a3f6616bef --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/ActionableRemediation.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ActionableRemediationTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediation ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediation).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ActionableRemediation.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ActionableRemediation.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ActionableRemediation.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/ActionableRemediation.cs b/src/Security/Security.Autorest/generated/api/Models/ActionableRemediation.cs new file mode 100644 index 000000000000..beac87962681 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/ActionableRemediation.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// Configuration payload for PR Annotations. + public partial class ActionableRemediation : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediation, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediationInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITargetBranchConfiguration _branchConfiguration; + + /// Repository branch configuration for PR Annotations. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITargetBranchConfiguration BranchConfiguration { get => (this._branchConfiguration = this._branchConfiguration ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.TargetBranchConfiguration()); set => this._branchConfiguration = value; } + + /// Backing field for property. + private System.Collections.Generic.List _categoryConfiguration; + + /// Gets or sets list of categories and severity levels. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public System.Collections.Generic.List CategoryConfiguration { get => this._categoryConfiguration; set => this._categoryConfiguration = value; } + + /// Backing field for property. + private string _inheritFromParentState; + + /// + /// Update Settings. + /// + /// Enabled - Resource should inherit configurations from parent. + /// Disabled - Resource should not inherit configurations from parent. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string InheritFromParentState { get => this._inheritFromParentState; set => this._inheritFromParentState = value; } + + /// Backing field for property. + private string _state; + + /// + /// ActionableRemediation Setting. + /// None - the setting was never set. + /// Enabled - ActionableRemediation is enabled. + /// Disabled - ActionableRemediation is disabled. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string State { get => this._state; set => this._state = value; } + + /// Creates an new instance. + public ActionableRemediation() + { + + } + } + /// Configuration payload for PR Annotations. + public partial interface IActionableRemediation : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// Repository branch configuration for PR Annotations. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Repository branch configuration for PR Annotations.", + SerializedName = @"branchConfiguration", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITargetBranchConfiguration) })] + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITargetBranchConfiguration BranchConfiguration { get; set; } + /// Gets or sets list of categories and severity levels. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Gets or sets list of categories and severity levels.", + SerializedName = @"categoryConfigurations", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICategoryConfiguration) })] + System.Collections.Generic.List CategoryConfiguration { get; set; } + /// + /// Update Settings. + /// + /// Enabled - Resource should inherit configurations from parent. + /// Disabled - Resource should not inherit configurations from parent. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Update Settings. + + Enabled - Resource should inherit configurations from parent. + Disabled - Resource should not inherit configurations from parent.", + SerializedName = @"inheritFromParentState", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Disabled", "Enabled")] + string InheritFromParentState { get; set; } + /// + /// ActionableRemediation Setting. + /// None - the setting was never set. + /// Enabled - ActionableRemediation is enabled. + /// Disabled - ActionableRemediation is disabled. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"ActionableRemediation Setting. + None - the setting was never set. + Enabled - ActionableRemediation is enabled. + Disabled - ActionableRemediation is disabled.", + SerializedName = @"state", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("None", "Disabled", "Enabled")] + string State { get; set; } + + } + /// Configuration payload for PR Annotations. + internal partial interface IActionableRemediationInternal + + { + /// Repository branch configuration for PR Annotations. + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITargetBranchConfiguration BranchConfiguration { get; set; } + /// Gets or sets list of categories and severity levels. + System.Collections.Generic.List CategoryConfiguration { get; set; } + /// + /// Update Settings. + /// + /// Enabled - Resource should inherit configurations from parent. + /// Disabled - Resource should not inherit configurations from parent. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Disabled", "Enabled")] + string InheritFromParentState { get; set; } + /// + /// ActionableRemediation Setting. + /// None - the setting was never set. + /// Enabled - ActionableRemediation is enabled. + /// Disabled - ActionableRemediation is disabled. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("None", "Disabled", "Enabled")] + string State { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/ActionableRemediation.json.cs b/src/Security/Security.Autorest/generated/api/Models/ActionableRemediation.json.cs new file mode 100644 index 000000000000..3960bf36de07 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/ActionableRemediation.json.cs @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// Configuration payload for PR Annotations. + public partial class ActionableRemediation + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal ActionableRemediation(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_state = If( json?.PropertyT("state"), out var __jsonState) ? (string)__jsonState : (string)_state;} + {_categoryConfiguration = If( json?.PropertyT("categoryConfigurations"), out var __jsonCategoryConfigurations) ? If( __jsonCategoryConfigurations as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICategoryConfiguration) (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CategoryConfiguration.FromJson(__u) )) ))() : null : _categoryConfiguration;} + {_branchConfiguration = If( json?.PropertyT("branchConfiguration"), out var __jsonBranchConfiguration) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.TargetBranchConfiguration.FromJson(__jsonBranchConfiguration) : _branchConfiguration;} + {_inheritFromParentState = If( json?.PropertyT("inheritFromParentState"), out var __jsonInheritFromParentState) ? (string)__jsonInheritFromParentState : (string)_inheritFromParentState;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediation. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediation. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediation FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new ActionableRemediation(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._state)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._state.ToString()) : null, "state" ,container.Add ); + if (null != this._categoryConfiguration) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.XNodeArray(); + foreach( var __x in this._categoryConfiguration ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("categoryConfigurations",__w); + } + AddIf( null != this._branchConfiguration ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._branchConfiguration.ToJson(null,serializationMode) : null, "branchConfiguration" ,container.Add ); + AddIf( null != (((object)this._inheritFromParentState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._inheritFromParentState.ToString()) : null, "inheritFromParentState" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/Any.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/Any.PowerShell.cs new file mode 100644 index 000000000000..ceec77690b04 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/Any.PowerShell.cs @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// Anything + [System.ComponentModel.TypeConverter(typeof(AnyTypeConverter))] + public partial class Any + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal Any(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal Any(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAny DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new Any(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAny DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new Any(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAny FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// Anything + [System.ComponentModel.TypeConverter(typeof(AnyTypeConverter))] + public partial interface IAny + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/Any.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/Any.TypeConverter.cs new file mode 100644 index 000000000000..9805ae88c2a2 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/Any.TypeConverter.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AnyTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAny ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAny).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return Any.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return Any.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return Any.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/Any.cs b/src/Security/Security.Autorest/generated/api/Models/Any.cs new file mode 100644 index 000000000000..77a3854185d2 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/Any.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// Anything + public partial class Any : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAny, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAnyInternal + { + + /// Creates an new instance. + public Any() + { + + } + } + /// Anything + public partial interface IAny : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + + } + /// Anything + internal partial interface IAnyInternal + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/Any.json.cs b/src/Security/Security.Autorest/generated/api/Models/Any.json.cs new file mode 100644 index 000000000000..9cb80b167a8c --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/Any.json.cs @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// Anything + public partial class Any + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal Any(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAny. + /// + /// a to deserialize from. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAny. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAny FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new Any(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/ApiCollection.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/ApiCollection.PowerShell.cs new file mode 100644 index 000000000000..a603e684b504 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/ApiCollection.PowerShell.cs @@ -0,0 +1,268 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// An API collection as represented by Microsoft Defender for APIs. + [System.ComponentModel.TypeConverter(typeof(ApiCollectionTypeConverter))] + public partial class ApiCollection + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ApiCollection(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ApiCollectionPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionInternal)this).ProvisioningState, global::System.Convert.ToString); + } + if (content.Contains("DisplayName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionInternal)this).DisplayName, global::System.Convert.ToString); + } + if (content.Contains("DiscoveredVia")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionInternal)this).DiscoveredVia = (string) content.GetValueForProperty("DiscoveredVia",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionInternal)this).DiscoveredVia, global::System.Convert.ToString); + } + if (content.Contains("BaseUrl")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionInternal)this).BaseUrl = (string) content.GetValueForProperty("BaseUrl",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionInternal)this).BaseUrl, global::System.Convert.ToString); + } + if (content.Contains("NumberOfApiEndpoint")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionInternal)this).NumberOfApiEndpoint = (long?) content.GetValueForProperty("NumberOfApiEndpoint",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionInternal)this).NumberOfApiEndpoint, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("NumberOfInactiveApiEndpoint")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionInternal)this).NumberOfInactiveApiEndpoint = (long?) content.GetValueForProperty("NumberOfInactiveApiEndpoint",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionInternal)this).NumberOfInactiveApiEndpoint, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("NumberOfUnauthenticatedApiEndpoint")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionInternal)this).NumberOfUnauthenticatedApiEndpoint = (long?) content.GetValueForProperty("NumberOfUnauthenticatedApiEndpoint",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionInternal)this).NumberOfUnauthenticatedApiEndpoint, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("NumberOfExternalApiEndpoint")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionInternal)this).NumberOfExternalApiEndpoint = (long?) content.GetValueForProperty("NumberOfExternalApiEndpoint",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionInternal)this).NumberOfExternalApiEndpoint, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("NumberOfApiEndpointsWithSensitiveDataExposed")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionInternal)this).NumberOfApiEndpointsWithSensitiveDataExposed = (long?) content.GetValueForProperty("NumberOfApiEndpointsWithSensitiveDataExposed",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionInternal)this).NumberOfApiEndpointsWithSensitiveDataExposed, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("SensitivityLabel")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionInternal)this).SensitivityLabel = (string) content.GetValueForProperty("SensitivityLabel",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionInternal)this).SensitivityLabel, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ApiCollection(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ApiCollectionPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionInternal)this).ProvisioningState, global::System.Convert.ToString); + } + if (content.Contains("DisplayName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionInternal)this).DisplayName, global::System.Convert.ToString); + } + if (content.Contains("DiscoveredVia")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionInternal)this).DiscoveredVia = (string) content.GetValueForProperty("DiscoveredVia",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionInternal)this).DiscoveredVia, global::System.Convert.ToString); + } + if (content.Contains("BaseUrl")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionInternal)this).BaseUrl = (string) content.GetValueForProperty("BaseUrl",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionInternal)this).BaseUrl, global::System.Convert.ToString); + } + if (content.Contains("NumberOfApiEndpoint")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionInternal)this).NumberOfApiEndpoint = (long?) content.GetValueForProperty("NumberOfApiEndpoint",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionInternal)this).NumberOfApiEndpoint, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("NumberOfInactiveApiEndpoint")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionInternal)this).NumberOfInactiveApiEndpoint = (long?) content.GetValueForProperty("NumberOfInactiveApiEndpoint",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionInternal)this).NumberOfInactiveApiEndpoint, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("NumberOfUnauthenticatedApiEndpoint")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionInternal)this).NumberOfUnauthenticatedApiEndpoint = (long?) content.GetValueForProperty("NumberOfUnauthenticatedApiEndpoint",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionInternal)this).NumberOfUnauthenticatedApiEndpoint, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("NumberOfExternalApiEndpoint")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionInternal)this).NumberOfExternalApiEndpoint = (long?) content.GetValueForProperty("NumberOfExternalApiEndpoint",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionInternal)this).NumberOfExternalApiEndpoint, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("NumberOfApiEndpointsWithSensitiveDataExposed")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionInternal)this).NumberOfApiEndpointsWithSensitiveDataExposed = (long?) content.GetValueForProperty("NumberOfApiEndpointsWithSensitiveDataExposed",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionInternal)this).NumberOfApiEndpointsWithSensitiveDataExposed, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("SensitivityLabel")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionInternal)this).SensitivityLabel = (string) content.GetValueForProperty("SensitivityLabel",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionInternal)this).SensitivityLabel, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollection DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ApiCollection(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollection DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ApiCollection(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollection FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// An API collection as represented by Microsoft Defender for APIs. + [System.ComponentModel.TypeConverter(typeof(ApiCollectionTypeConverter))] + public partial interface IApiCollection + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/ApiCollection.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/ApiCollection.TypeConverter.cs new file mode 100644 index 000000000000..4ac5593946bf --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/ApiCollection.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ApiCollectionTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollection ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollection).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ApiCollection.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ApiCollection.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ApiCollection.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/ApiCollection.cs b/src/Security/Security.Autorest/generated/api/Models/ApiCollection.cs new file mode 100644 index 000000000000..0e34b6277e2f --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/ApiCollection.cs @@ -0,0 +1,321 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// An API collection as represented by Microsoft Defender for APIs. + public partial class ApiCollection : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollection, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionInternal, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.Resource(); + + /// + /// The base URI for this API collection. All endpoints of this API collection extend this base URI. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string BaseUrl { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)Property).BaseUrl; } + + /// The resource Id of the resource from where this API collection was discovered. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string DiscoveredVia { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)Property).DiscoveredVia; } + + /// The display name of the API collection. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string DisplayName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)Property).DisplayName; } + + /// Resource Id + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)__resource).Id; } + + /// Internal Acessors for BaseUrl + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionInternal.BaseUrl { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)Property).BaseUrl; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)Property).BaseUrl = value; } + + /// Internal Acessors for DiscoveredVia + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionInternal.DiscoveredVia { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)Property).DiscoveredVia; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)Property).DiscoveredVia = value; } + + /// Internal Acessors for DisplayName + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionInternal.DisplayName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)Property).DisplayName; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)Property).DisplayName = value; } + + /// Internal Acessors for NumberOfApiEndpoint + long? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionInternal.NumberOfApiEndpoint { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)Property).NumberOfApiEndpoint; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)Property).NumberOfApiEndpoint = value; } + + /// Internal Acessors for NumberOfApiEndpointsWithSensitiveDataExposed + long? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionInternal.NumberOfApiEndpointsWithSensitiveDataExposed { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)Property).NumberOfApiEndpointsWithSensitiveDataExposed; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)Property).NumberOfApiEndpointsWithSensitiveDataExposed = value; } + + /// Internal Acessors for NumberOfExternalApiEndpoint + long? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionInternal.NumberOfExternalApiEndpoint { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)Property).NumberOfExternalApiEndpoint; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)Property).NumberOfExternalApiEndpoint = value; } + + /// Internal Acessors for NumberOfInactiveApiEndpoint + long? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionInternal.NumberOfInactiveApiEndpoint { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)Property).NumberOfInactiveApiEndpoint; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)Property).NumberOfInactiveApiEndpoint = value; } + + /// Internal Acessors for NumberOfUnauthenticatedApiEndpoint + long? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionInternal.NumberOfUnauthenticatedApiEndpoint { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)Property).NumberOfUnauthenticatedApiEndpoint; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)Property).NumberOfUnauthenticatedApiEndpoint = value; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionProperties Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ApiCollectionProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProvisioningState + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionInternal.ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)Property).ProvisioningState; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)Property).ProvisioningState = value; } + + /// Internal Acessors for SensitivityLabel + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionInternal.SensitivityLabel { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)Property).SensitivityLabel; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)Property).SensitivityLabel = value; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)__resource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)__resource).Name = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)__resource).Type = value; } + + /// Resource name + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)__resource).Name; } + + /// The number of API endpoints discovered in this API collection. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public long? NumberOfApiEndpoint { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)Property).NumberOfApiEndpoint; } + + /// + /// The number of API endpoints in this API collection which are exposing sensitive data in their requests and/or responses. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public long? NumberOfApiEndpointsWithSensitiveDataExposed { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)Property).NumberOfApiEndpointsWithSensitiveDataExposed; } + + /// + /// The number of API endpoints in this API collection for which API traffic from the internet was observed. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public long? NumberOfExternalApiEndpoint { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)Property).NumberOfExternalApiEndpoint; } + + /// + /// The number of API endpoints in this API collection that have not received any API traffic in the last 30 days. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public long? NumberOfInactiveApiEndpoint { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)Property).NumberOfInactiveApiEndpoint; } + + /// The number of API endpoints in this API collection that are unauthenticated. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public long? NumberOfUnauthenticatedApiEndpoint { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)Property).NumberOfUnauthenticatedApiEndpoint; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionProperties _property; + + /// Describes the properties of an API collection. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ApiCollectionProperties()); set => this._property = value; } + + /// Gets the provisioning state of the API collection. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)Property).ProvisioningState; } + + /// Gets the resource group name + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string ResourceGroupName { get => (new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Success ? new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Groups["resourceGroupName"].Value : null); } + + /// + /// The highest priority sensitivity label from Microsoft Purview in this API collection. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string SensitivityLabel { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)Property).SensitivityLabel; } + + /// Resource type + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)__resource).Type; } + + /// Creates an new instance. + public ApiCollection() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__resource), __resource); + await eventListener.AssertObjectIsValid(nameof(__resource), __resource); + } + } + /// An API collection as represented by Microsoft Defender for APIs. + public partial interface IApiCollection : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResource + { + /// + /// The base URI for this API collection. All endpoints of this API collection extend this base URI. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The base URI for this API collection. All endpoints of this API collection extend this base URI.", + SerializedName = @"baseUrl", + PossibleTypes = new [] { typeof(string) })] + string BaseUrl { get; } + /// The resource Id of the resource from where this API collection was discovered. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The resource Id of the resource from where this API collection was discovered.", + SerializedName = @"discoveredVia", + PossibleTypes = new [] { typeof(string) })] + string DiscoveredVia { get; } + /// The display name of the API collection. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The display name of the API collection.", + SerializedName = @"displayName", + PossibleTypes = new [] { typeof(string) })] + string DisplayName { get; } + /// The number of API endpoints discovered in this API collection. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The number of API endpoints discovered in this API collection.", + SerializedName = @"numberOfApiEndpoints", + PossibleTypes = new [] { typeof(long) })] + long? NumberOfApiEndpoint { get; } + /// + /// The number of API endpoints in this API collection which are exposing sensitive data in their requests and/or responses. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The number of API endpoints in this API collection which are exposing sensitive data in their requests and/or responses.", + SerializedName = @"numberOfApiEndpointsWithSensitiveDataExposed", + PossibleTypes = new [] { typeof(long) })] + long? NumberOfApiEndpointsWithSensitiveDataExposed { get; } + /// + /// The number of API endpoints in this API collection for which API traffic from the internet was observed. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The number of API endpoints in this API collection for which API traffic from the internet was observed.", + SerializedName = @"numberOfExternalApiEndpoints", + PossibleTypes = new [] { typeof(long) })] + long? NumberOfExternalApiEndpoint { get; } + /// + /// The number of API endpoints in this API collection that have not received any API traffic in the last 30 days. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The number of API endpoints in this API collection that have not received any API traffic in the last 30 days.", + SerializedName = @"numberOfInactiveApiEndpoints", + PossibleTypes = new [] { typeof(long) })] + long? NumberOfInactiveApiEndpoint { get; } + /// The number of API endpoints in this API collection that are unauthenticated. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The number of API endpoints in this API collection that are unauthenticated.", + SerializedName = @"numberOfUnauthenticatedApiEndpoints", + PossibleTypes = new [] { typeof(long) })] + long? NumberOfUnauthenticatedApiEndpoint { get; } + /// Gets the provisioning state of the API collection. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets the provisioning state of the API collection.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Succeeded", "Failed", "Canceled", "InProgress")] + string ProvisioningState { get; } + /// + /// The highest priority sensitivity label from Microsoft Purview in this API collection. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The highest priority sensitivity label from Microsoft Purview in this API collection.", + SerializedName = @"sensitivityLabel", + PossibleTypes = new [] { typeof(string) })] + string SensitivityLabel { get; } + + } + /// An API collection as represented by Microsoft Defender for APIs. + internal partial interface IApiCollectionInternal : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal + { + /// + /// The base URI for this API collection. All endpoints of this API collection extend this base URI. + /// + string BaseUrl { get; set; } + /// The resource Id of the resource from where this API collection was discovered. + string DiscoveredVia { get; set; } + /// The display name of the API collection. + string DisplayName { get; set; } + /// The number of API endpoints discovered in this API collection. + long? NumberOfApiEndpoint { get; set; } + /// + /// The number of API endpoints in this API collection which are exposing sensitive data in their requests and/or responses. + /// + long? NumberOfApiEndpointsWithSensitiveDataExposed { get; set; } + /// + /// The number of API endpoints in this API collection for which API traffic from the internet was observed. + /// + long? NumberOfExternalApiEndpoint { get; set; } + /// + /// The number of API endpoints in this API collection that have not received any API traffic in the last 30 days. + /// + long? NumberOfInactiveApiEndpoint { get; set; } + /// The number of API endpoints in this API collection that are unauthenticated. + long? NumberOfUnauthenticatedApiEndpoint { get; set; } + /// Describes the properties of an API collection. + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionProperties Property { get; set; } + /// Gets the provisioning state of the API collection. + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Succeeded", "Failed", "Canceled", "InProgress")] + string ProvisioningState { get; set; } + /// + /// The highest priority sensitivity label from Microsoft Purview in this API collection. + /// + string SensitivityLabel { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/ApiCollection.json.cs b/src/Security/Security.Autorest/generated/api/Models/ApiCollection.json.cs new file mode 100644 index 000000000000..53f76bd813bc --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/ApiCollection.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// An API collection as represented by Microsoft Defender for APIs. + public partial class ApiCollection + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal ApiCollection(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __resource = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.Resource(json); + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ApiCollectionProperties.FromJson(__jsonProperties) : _property;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollection. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollection. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollection FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new ApiCollection(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __resource?.ToJson(container, serializationMode); + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/ApiCollectionList.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/ApiCollectionList.PowerShell.cs new file mode 100644 index 000000000000..3c9c58821bf1 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/ApiCollectionList.PowerShell.cs @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// Page of a list of API collections as represented by Microsoft Defender for APIs. + /// + [System.ComponentModel.TypeConverter(typeof(ApiCollectionListTypeConverter))] + public partial class ApiCollectionList + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ApiCollectionList(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionListInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionListInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ApiCollectionTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionListInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionListInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ApiCollectionList(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionListInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionListInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ApiCollectionTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionListInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionListInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionList DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ApiCollectionList(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionList DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ApiCollectionList(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionList FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// Page of a list of API collections as represented by Microsoft Defender for APIs. + [System.ComponentModel.TypeConverter(typeof(ApiCollectionListTypeConverter))] + public partial interface IApiCollectionList + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/ApiCollectionList.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/ApiCollectionList.TypeConverter.cs new file mode 100644 index 000000000000..93766bf9864b --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/ApiCollectionList.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ApiCollectionListTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionList ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionList).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ApiCollectionList.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ApiCollectionList.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ApiCollectionList.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/ApiCollectionList.cs b/src/Security/Security.Autorest/generated/api/Models/ApiCollectionList.cs new file mode 100644 index 000000000000..2e4344c27d25 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/ApiCollectionList.cs @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// + /// Page of a list of API collections as represented by Microsoft Defender for APIs. + /// + public partial class ApiCollectionList : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionList, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionListInternal + { + + /// Internal Acessors for NextLink + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionListInternal.NextLink { get => this._nextLink; set { {_nextLink = value;} } } + + /// Internal Acessors for Value + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionListInternal.Value { get => this._value; set { {_value = value;} } } + + /// Backing field for property. + private string _nextLink; + + /// The URI to fetch the next page. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; } + + /// Backing field for property. + private System.Collections.Generic.List _value; + + /// API collections in this page. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public System.Collections.Generic.List Value { get => this._value; } + + /// Creates an new instance. + public ApiCollectionList() + { + + } + } + /// Page of a list of API collections as represented by Microsoft Defender for APIs. + public partial interface IApiCollectionList : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// The URI to fetch the next page. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The URI to fetch the next page.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; } + /// API collections in this page. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"API collections in this page.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollection) })] + System.Collections.Generic.List Value { get; } + + } + /// Page of a list of API collections as represented by Microsoft Defender for APIs. + internal partial interface IApiCollectionListInternal + + { + /// The URI to fetch the next page. + string NextLink { get; set; } + /// API collections in this page. + System.Collections.Generic.List Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/ApiCollectionList.json.cs b/src/Security/Security.Autorest/generated/api/Models/ApiCollectionList.json.cs new file mode 100644 index 000000000000..a337804a8d3b --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/ApiCollectionList.json.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// + /// Page of a list of API collections as represented by Microsoft Defender for APIs. + /// + public partial class ApiCollectionList + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal ApiCollectionList(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollection) (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ApiCollection.FromJson(__u) )) ))() : null : _value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)_nextLink;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionList. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionList. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionList FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new ApiCollectionList(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/ApiCollectionProperties.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/ApiCollectionProperties.PowerShell.cs new file mode 100644 index 000000000000..c7a94de9f2ba --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/ApiCollectionProperties.PowerShell.cs @@ -0,0 +1,236 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// Describes the properties of an API collection. + [System.ComponentModel.TypeConverter(typeof(ApiCollectionPropertiesTypeConverter))] + public partial class ApiCollectionProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ApiCollectionProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)this).ProvisioningState, global::System.Convert.ToString); + } + if (content.Contains("DisplayName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)this).DisplayName, global::System.Convert.ToString); + } + if (content.Contains("DiscoveredVia")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)this).DiscoveredVia = (string) content.GetValueForProperty("DiscoveredVia",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)this).DiscoveredVia, global::System.Convert.ToString); + } + if (content.Contains("BaseUrl")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)this).BaseUrl = (string) content.GetValueForProperty("BaseUrl",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)this).BaseUrl, global::System.Convert.ToString); + } + if (content.Contains("NumberOfApiEndpoint")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)this).NumberOfApiEndpoint = (long?) content.GetValueForProperty("NumberOfApiEndpoint",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)this).NumberOfApiEndpoint, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("NumberOfInactiveApiEndpoint")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)this).NumberOfInactiveApiEndpoint = (long?) content.GetValueForProperty("NumberOfInactiveApiEndpoint",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)this).NumberOfInactiveApiEndpoint, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("NumberOfUnauthenticatedApiEndpoint")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)this).NumberOfUnauthenticatedApiEndpoint = (long?) content.GetValueForProperty("NumberOfUnauthenticatedApiEndpoint",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)this).NumberOfUnauthenticatedApiEndpoint, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("NumberOfExternalApiEndpoint")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)this).NumberOfExternalApiEndpoint = (long?) content.GetValueForProperty("NumberOfExternalApiEndpoint",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)this).NumberOfExternalApiEndpoint, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("NumberOfApiEndpointsWithSensitiveDataExposed")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)this).NumberOfApiEndpointsWithSensitiveDataExposed = (long?) content.GetValueForProperty("NumberOfApiEndpointsWithSensitiveDataExposed",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)this).NumberOfApiEndpointsWithSensitiveDataExposed, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("SensitivityLabel")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)this).SensitivityLabel = (string) content.GetValueForProperty("SensitivityLabel",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)this).SensitivityLabel, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ApiCollectionProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)this).ProvisioningState, global::System.Convert.ToString); + } + if (content.Contains("DisplayName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)this).DisplayName, global::System.Convert.ToString); + } + if (content.Contains("DiscoveredVia")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)this).DiscoveredVia = (string) content.GetValueForProperty("DiscoveredVia",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)this).DiscoveredVia, global::System.Convert.ToString); + } + if (content.Contains("BaseUrl")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)this).BaseUrl = (string) content.GetValueForProperty("BaseUrl",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)this).BaseUrl, global::System.Convert.ToString); + } + if (content.Contains("NumberOfApiEndpoint")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)this).NumberOfApiEndpoint = (long?) content.GetValueForProperty("NumberOfApiEndpoint",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)this).NumberOfApiEndpoint, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("NumberOfInactiveApiEndpoint")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)this).NumberOfInactiveApiEndpoint = (long?) content.GetValueForProperty("NumberOfInactiveApiEndpoint",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)this).NumberOfInactiveApiEndpoint, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("NumberOfUnauthenticatedApiEndpoint")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)this).NumberOfUnauthenticatedApiEndpoint = (long?) content.GetValueForProperty("NumberOfUnauthenticatedApiEndpoint",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)this).NumberOfUnauthenticatedApiEndpoint, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("NumberOfExternalApiEndpoint")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)this).NumberOfExternalApiEndpoint = (long?) content.GetValueForProperty("NumberOfExternalApiEndpoint",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)this).NumberOfExternalApiEndpoint, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("NumberOfApiEndpointsWithSensitiveDataExposed")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)this).NumberOfApiEndpointsWithSensitiveDataExposed = (long?) content.GetValueForProperty("NumberOfApiEndpointsWithSensitiveDataExposed",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)this).NumberOfApiEndpointsWithSensitiveDataExposed, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("SensitivityLabel")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)this).SensitivityLabel = (string) content.GetValueForProperty("SensitivityLabel",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal)this).SensitivityLabel, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ApiCollectionProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ApiCollectionProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// Describes the properties of an API collection. + [System.ComponentModel.TypeConverter(typeof(ApiCollectionPropertiesTypeConverter))] + public partial interface IApiCollectionProperties + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/ApiCollectionProperties.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/ApiCollectionProperties.TypeConverter.cs new file mode 100644 index 000000000000..1582ebd78e1a --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/ApiCollectionProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ApiCollectionPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ApiCollectionProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ApiCollectionProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ApiCollectionProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/ApiCollectionProperties.cs b/src/Security/Security.Autorest/generated/api/Models/ApiCollectionProperties.cs new file mode 100644 index 000000000000..b8bd338286fd --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/ApiCollectionProperties.cs @@ -0,0 +1,298 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// Describes the properties of an API collection. + public partial class ApiCollectionProperties : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionProperties, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal + { + + /// Backing field for property. + private string _baseUrl; + + /// + /// The base URI for this API collection. All endpoints of this API collection extend this base URI. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string BaseUrl { get => this._baseUrl; } + + /// Backing field for property. + private string _discoveredVia; + + /// The resource Id of the resource from where this API collection was discovered. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string DiscoveredVia { get => this._discoveredVia; } + + /// Backing field for property. + private string _displayName; + + /// The display name of the API collection. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string DisplayName { get => this._displayName; } + + /// Internal Acessors for BaseUrl + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal.BaseUrl { get => this._baseUrl; set { {_baseUrl = value;} } } + + /// Internal Acessors for DiscoveredVia + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal.DiscoveredVia { get => this._discoveredVia; set { {_discoveredVia = value;} } } + + /// Internal Acessors for DisplayName + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal.DisplayName { get => this._displayName; set { {_displayName = value;} } } + + /// Internal Acessors for NumberOfApiEndpoint + long? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal.NumberOfApiEndpoint { get => this._numberOfApiEndpoint; set { {_numberOfApiEndpoint = value;} } } + + /// Internal Acessors for NumberOfApiEndpointsWithSensitiveDataExposed + long? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal.NumberOfApiEndpointsWithSensitiveDataExposed { get => this._numberOfApiEndpointsWithSensitiveDataExposed; set { {_numberOfApiEndpointsWithSensitiveDataExposed = value;} } } + + /// Internal Acessors for NumberOfExternalApiEndpoint + long? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal.NumberOfExternalApiEndpoint { get => this._numberOfExternalApiEndpoint; set { {_numberOfExternalApiEndpoint = value;} } } + + /// Internal Acessors for NumberOfInactiveApiEndpoint + long? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal.NumberOfInactiveApiEndpoint { get => this._numberOfInactiveApiEndpoint; set { {_numberOfInactiveApiEndpoint = value;} } } + + /// Internal Acessors for NumberOfUnauthenticatedApiEndpoint + long? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal.NumberOfUnauthenticatedApiEndpoint { get => this._numberOfUnauthenticatedApiEndpoint; set { {_numberOfUnauthenticatedApiEndpoint = value;} } } + + /// Internal Acessors for ProvisioningState + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal.ProvisioningState { get => this._provisioningState; set { {_provisioningState = value;} } } + + /// Internal Acessors for SensitivityLabel + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionPropertiesInternal.SensitivityLabel { get => this._sensitivityLabel; set { {_sensitivityLabel = value;} } } + + /// Backing field for property. + private long? _numberOfApiEndpoint; + + /// The number of API endpoints discovered in this API collection. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public long? NumberOfApiEndpoint { get => this._numberOfApiEndpoint; } + + /// + /// Backing field for property. + /// + private long? _numberOfApiEndpointsWithSensitiveDataExposed; + + /// + /// The number of API endpoints in this API collection which are exposing sensitive data in their requests and/or responses. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public long? NumberOfApiEndpointsWithSensitiveDataExposed { get => this._numberOfApiEndpointsWithSensitiveDataExposed; } + + /// Backing field for property. + private long? _numberOfExternalApiEndpoint; + + /// + /// The number of API endpoints in this API collection for which API traffic from the internet was observed. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public long? NumberOfExternalApiEndpoint { get => this._numberOfExternalApiEndpoint; } + + /// Backing field for property. + private long? _numberOfInactiveApiEndpoint; + + /// + /// The number of API endpoints in this API collection that have not received any API traffic in the last 30 days. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public long? NumberOfInactiveApiEndpoint { get => this._numberOfInactiveApiEndpoint; } + + /// Backing field for property. + private long? _numberOfUnauthenticatedApiEndpoint; + + /// The number of API endpoints in this API collection that are unauthenticated. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public long? NumberOfUnauthenticatedApiEndpoint { get => this._numberOfUnauthenticatedApiEndpoint; } + + /// Backing field for property. + private string _provisioningState; + + /// Gets the provisioning state of the API collection. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string ProvisioningState { get => this._provisioningState; } + + /// Backing field for property. + private string _sensitivityLabel; + + /// + /// The highest priority sensitivity label from Microsoft Purview in this API collection. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string SensitivityLabel { get => this._sensitivityLabel; } + + /// Creates an new instance. + public ApiCollectionProperties() + { + + } + } + /// Describes the properties of an API collection. + public partial interface IApiCollectionProperties : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// + /// The base URI for this API collection. All endpoints of this API collection extend this base URI. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The base URI for this API collection. All endpoints of this API collection extend this base URI.", + SerializedName = @"baseUrl", + PossibleTypes = new [] { typeof(string) })] + string BaseUrl { get; } + /// The resource Id of the resource from where this API collection was discovered. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The resource Id of the resource from where this API collection was discovered.", + SerializedName = @"discoveredVia", + PossibleTypes = new [] { typeof(string) })] + string DiscoveredVia { get; } + /// The display name of the API collection. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The display name of the API collection.", + SerializedName = @"displayName", + PossibleTypes = new [] { typeof(string) })] + string DisplayName { get; } + /// The number of API endpoints discovered in this API collection. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The number of API endpoints discovered in this API collection.", + SerializedName = @"numberOfApiEndpoints", + PossibleTypes = new [] { typeof(long) })] + long? NumberOfApiEndpoint { get; } + /// + /// The number of API endpoints in this API collection which are exposing sensitive data in their requests and/or responses. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The number of API endpoints in this API collection which are exposing sensitive data in their requests and/or responses.", + SerializedName = @"numberOfApiEndpointsWithSensitiveDataExposed", + PossibleTypes = new [] { typeof(long) })] + long? NumberOfApiEndpointsWithSensitiveDataExposed { get; } + /// + /// The number of API endpoints in this API collection for which API traffic from the internet was observed. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The number of API endpoints in this API collection for which API traffic from the internet was observed.", + SerializedName = @"numberOfExternalApiEndpoints", + PossibleTypes = new [] { typeof(long) })] + long? NumberOfExternalApiEndpoint { get; } + /// + /// The number of API endpoints in this API collection that have not received any API traffic in the last 30 days. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The number of API endpoints in this API collection that have not received any API traffic in the last 30 days.", + SerializedName = @"numberOfInactiveApiEndpoints", + PossibleTypes = new [] { typeof(long) })] + long? NumberOfInactiveApiEndpoint { get; } + /// The number of API endpoints in this API collection that are unauthenticated. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The number of API endpoints in this API collection that are unauthenticated.", + SerializedName = @"numberOfUnauthenticatedApiEndpoints", + PossibleTypes = new [] { typeof(long) })] + long? NumberOfUnauthenticatedApiEndpoint { get; } + /// Gets the provisioning state of the API collection. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets the provisioning state of the API collection.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Succeeded", "Failed", "Canceled", "InProgress")] + string ProvisioningState { get; } + /// + /// The highest priority sensitivity label from Microsoft Purview in this API collection. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The highest priority sensitivity label from Microsoft Purview in this API collection.", + SerializedName = @"sensitivityLabel", + PossibleTypes = new [] { typeof(string) })] + string SensitivityLabel { get; } + + } + /// Describes the properties of an API collection. + internal partial interface IApiCollectionPropertiesInternal + + { + /// + /// The base URI for this API collection. All endpoints of this API collection extend this base URI. + /// + string BaseUrl { get; set; } + /// The resource Id of the resource from where this API collection was discovered. + string DiscoveredVia { get; set; } + /// The display name of the API collection. + string DisplayName { get; set; } + /// The number of API endpoints discovered in this API collection. + long? NumberOfApiEndpoint { get; set; } + /// + /// The number of API endpoints in this API collection which are exposing sensitive data in their requests and/or responses. + /// + long? NumberOfApiEndpointsWithSensitiveDataExposed { get; set; } + /// + /// The number of API endpoints in this API collection for which API traffic from the internet was observed. + /// + long? NumberOfExternalApiEndpoint { get; set; } + /// + /// The number of API endpoints in this API collection that have not received any API traffic in the last 30 days. + /// + long? NumberOfInactiveApiEndpoint { get; set; } + /// The number of API endpoints in this API collection that are unauthenticated. + long? NumberOfUnauthenticatedApiEndpoint { get; set; } + /// Gets the provisioning state of the API collection. + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Succeeded", "Failed", "Canceled", "InProgress")] + string ProvisioningState { get; set; } + /// + /// The highest priority sensitivity label from Microsoft Purview in this API collection. + /// + string SensitivityLabel { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/ApiCollectionProperties.json.cs b/src/Security/Security.Autorest/generated/api/Models/ApiCollectionProperties.json.cs new file mode 100644 index 000000000000..e57c0d0bbd9b --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/ApiCollectionProperties.json.cs @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// Describes the properties of an API collection. + public partial class ApiCollectionProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal ApiCollectionProperties(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_provisioningState = If( json?.PropertyT("provisioningState"), out var __jsonProvisioningState) ? (string)__jsonProvisioningState : (string)_provisioningState;} + {_displayName = If( json?.PropertyT("displayName"), out var __jsonDisplayName) ? (string)__jsonDisplayName : (string)_displayName;} + {_discoveredVia = If( json?.PropertyT("discoveredVia"), out var __jsonDiscoveredVia) ? (string)__jsonDiscoveredVia : (string)_discoveredVia;} + {_baseUrl = If( json?.PropertyT("baseUrl"), out var __jsonBaseUrl) ? (string)__jsonBaseUrl : (string)_baseUrl;} + {_numberOfApiEndpoint = If( json?.PropertyT("numberOfApiEndpoints"), out var __jsonNumberOfApiEndpoints) ? (long?)__jsonNumberOfApiEndpoints : _numberOfApiEndpoint;} + {_numberOfInactiveApiEndpoint = If( json?.PropertyT("numberOfInactiveApiEndpoints"), out var __jsonNumberOfInactiveApiEndpoints) ? (long?)__jsonNumberOfInactiveApiEndpoints : _numberOfInactiveApiEndpoint;} + {_numberOfUnauthenticatedApiEndpoint = If( json?.PropertyT("numberOfUnauthenticatedApiEndpoints"), out var __jsonNumberOfUnauthenticatedApiEndpoints) ? (long?)__jsonNumberOfUnauthenticatedApiEndpoints : _numberOfUnauthenticatedApiEndpoint;} + {_numberOfExternalApiEndpoint = If( json?.PropertyT("numberOfExternalApiEndpoints"), out var __jsonNumberOfExternalApiEndpoints) ? (long?)__jsonNumberOfExternalApiEndpoints : _numberOfExternalApiEndpoint;} + {_numberOfApiEndpointsWithSensitiveDataExposed = If( json?.PropertyT("numberOfApiEndpointsWithSensitiveDataExposed"), out var __jsonNumberOfApiEndpointsWithSensitiveDataExposed) ? (long?)__jsonNumberOfApiEndpointsWithSensitiveDataExposed : _numberOfApiEndpointsWithSensitiveDataExposed;} + {_sensitivityLabel = If( json?.PropertyT("sensitivityLabel"), out var __jsonSensitivityLabel) ? (string)__jsonSensitivityLabel : (string)_sensitivityLabel;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new ApiCollectionProperties(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._provisioningState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._provisioningState.ToString()) : null, "provisioningState" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._displayName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._displayName.ToString()) : null, "displayName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._discoveredVia)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._discoveredVia.ToString()) : null, "discoveredVia" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._baseUrl)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._baseUrl.ToString()) : null, "baseUrl" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._numberOfApiEndpoint ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNumber((long)this._numberOfApiEndpoint) : null, "numberOfApiEndpoints" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._numberOfInactiveApiEndpoint ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNumber((long)this._numberOfInactiveApiEndpoint) : null, "numberOfInactiveApiEndpoints" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._numberOfUnauthenticatedApiEndpoint ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNumber((long)this._numberOfUnauthenticatedApiEndpoint) : null, "numberOfUnauthenticatedApiEndpoints" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._numberOfExternalApiEndpoint ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNumber((long)this._numberOfExternalApiEndpoint) : null, "numberOfExternalApiEndpoints" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._numberOfApiEndpointsWithSensitiveDataExposed ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNumber((long)this._numberOfApiEndpointsWithSensitiveDataExposed) : null, "numberOfApiEndpointsWithSensitiveDataExposed" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._sensitivityLabel)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._sensitivityLabel.ToString()) : null, "sensitivityLabel" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/Authorization.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/Authorization.PowerShell.cs new file mode 100644 index 000000000000..99a810aed013 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/Authorization.PowerShell.cs @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// Authorization payload. + [System.ComponentModel.TypeConverter(typeof(AuthorizationTypeConverter))] + public partial class Authorization + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal Authorization(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAuthorizationInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAuthorizationInternal)this).Code, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal Authorization(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAuthorizationInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAuthorizationInternal)this).Code, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAuthorization DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new Authorization(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAuthorization DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new Authorization(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAuthorization FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// Authorization payload. + [System.ComponentModel.TypeConverter(typeof(AuthorizationTypeConverter))] + public partial interface IAuthorization + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/Authorization.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/Authorization.TypeConverter.cs new file mode 100644 index 000000000000..7e99e5113636 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/Authorization.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AuthorizationTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAuthorization ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAuthorization).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return Authorization.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return Authorization.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return Authorization.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/Authorization.cs b/src/Security/Security.Autorest/generated/api/Models/Authorization.cs new file mode 100644 index 000000000000..8058bbad917a --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/Authorization.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// Authorization payload. + public partial class Authorization : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAuthorization, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAuthorizationInternal + { + + /// Backing field for property. + private string _code; + + /// + /// Gets or sets one-time OAuth code to exchange for refresh and access tokens. + /// + /// Only used during PUT/PATCH operations. The secret is cleared during GET. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string Code { get => this._code; set => this._code = value; } + + /// Creates an new instance. + public Authorization() + { + + } + } + /// Authorization payload. + public partial interface IAuthorization : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// + /// Gets or sets one-time OAuth code to exchange for refresh and access tokens. + /// + /// Only used during PUT/PATCH operations. The secret is cleared during GET. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Gets or sets one-time OAuth code to exchange for refresh and access tokens. + + Only used during PUT/PATCH operations. The secret is cleared during GET.", + SerializedName = @"code", + PossibleTypes = new [] { typeof(string) })] + string Code { get; set; } + + } + /// Authorization payload. + internal partial interface IAuthorizationInternal + + { + /// + /// Gets or sets one-time OAuth code to exchange for refresh and access tokens. + /// + /// Only used during PUT/PATCH operations. The secret is cleared during GET. + /// + string Code { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/Authorization.json.cs b/src/Security/Security.Autorest/generated/api/Models/Authorization.json.cs new file mode 100644 index 000000000000..22dc236a5f2b --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/Authorization.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// Authorization payload. + public partial class Authorization + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal Authorization(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_code = If( json?.PropertyT("code"), out var __jsonCode) ? (string)__jsonCode : (string)_code;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAuthorization. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAuthorization. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAuthorization FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new Authorization(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._code)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._code.ToString()) : null, "code" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AwsEnvironment.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/AwsEnvironment.PowerShell.cs new file mode 100644 index 000000000000..f57b704c7da5 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AwsEnvironment.PowerShell.cs @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The AWS connector environment data + [System.ComponentModel.TypeConverter(typeof(AwsEnvironmentTypeConverter))] + public partial class AwsEnvironment + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal AwsEnvironment(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("OrganizationalData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsEnvironmentInternal)this).OrganizationalData = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalData) content.GetValueForProperty("OrganizationalData",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsEnvironmentInternal)this).OrganizationalData, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AwsOrganizationalDataTypeConverter.ConvertFrom); + } + if (content.Contains("Region")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsEnvironmentInternal)this).Region = (System.Collections.Generic.List) content.GetValueForProperty("Region",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsEnvironmentInternal)this).Region, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("AccountName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsEnvironmentInternal)this).AccountName = (string) content.GetValueForProperty("AccountName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsEnvironmentInternal)this).AccountName, global::System.Convert.ToString); + } + if (content.Contains("ScanInterval")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsEnvironmentInternal)this).ScanInterval = (long?) content.GetValueForProperty("ScanInterval",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsEnvironmentInternal)this).ScanInterval, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("EnvironmentType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironmentInternal)this).EnvironmentType = (string) content.GetValueForProperty("EnvironmentType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironmentInternal)this).EnvironmentType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal AwsEnvironment(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("OrganizationalData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsEnvironmentInternal)this).OrganizationalData = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalData) content.GetValueForProperty("OrganizationalData",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsEnvironmentInternal)this).OrganizationalData, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AwsOrganizationalDataTypeConverter.ConvertFrom); + } + if (content.Contains("Region")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsEnvironmentInternal)this).Region = (System.Collections.Generic.List) content.GetValueForProperty("Region",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsEnvironmentInternal)this).Region, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("AccountName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsEnvironmentInternal)this).AccountName = (string) content.GetValueForProperty("AccountName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsEnvironmentInternal)this).AccountName, global::System.Convert.ToString); + } + if (content.Contains("ScanInterval")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsEnvironmentInternal)this).ScanInterval = (long?) content.GetValueForProperty("ScanInterval",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsEnvironmentInternal)this).ScanInterval, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("EnvironmentType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironmentInternal)this).EnvironmentType = (string) content.GetValueForProperty("EnvironmentType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironmentInternal)this).EnvironmentType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsEnvironment DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AwsEnvironment(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsEnvironment DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AwsEnvironment(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsEnvironment FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The AWS connector environment data + [System.ComponentModel.TypeConverter(typeof(AwsEnvironmentTypeConverter))] + public partial interface IAwsEnvironment + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AwsEnvironment.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/AwsEnvironment.TypeConverter.cs new file mode 100644 index 000000000000..d5bace986a4e --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AwsEnvironment.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AwsEnvironmentTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsEnvironment ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsEnvironment).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AwsEnvironment.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AwsEnvironment.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AwsEnvironment.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AwsEnvironment.cs b/src/Security/Security.Autorest/generated/api/Models/AwsEnvironment.cs new file mode 100644 index 000000000000..2e997b34068d --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AwsEnvironment.cs @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The AWS connector environment data + public partial class AwsEnvironment : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsEnvironment, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsEnvironmentInternal, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironment __securityConnectorEnvironment = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SecurityConnectorEnvironment(); + + /// Backing field for property. + private string _accountName; + + /// The AWS account name + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string AccountName { get => this._accountName; } + + /// The type of the environment data. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Constant] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string EnvironmentType { get => "AwsAccount"; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironmentInternal)__securityConnectorEnvironment).EnvironmentType = "AwsAccount"; } + + /// Internal Acessors for AccountName + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsEnvironmentInternal.AccountName { get => this._accountName; set { {_accountName = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalData _organizationalData; + + /// The AWS account's organizational data + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalData OrganizationalData { get => (this._organizationalData = this._organizationalData ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AwsOrganizationalData()); set => this._organizationalData = value; } + + /// Backing field for property. + private System.Collections.Generic.List _region; + + /// list of regions to scan + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public System.Collections.Generic.List Region { get => this._region; set => this._region = value; } + + /// Backing field for property. + private long? _scanInterval; + + /// Scan interval in hours (value should be between 1-hour to 24-hours) + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public long? ScanInterval { get => this._scanInterval; set => this._scanInterval = value; } + + /// Creates an new instance. + public AwsEnvironment() + { + this.__securityConnectorEnvironment.EnvironmentType = "AwsAccount"; + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__securityConnectorEnvironment), __securityConnectorEnvironment); + await eventListener.AssertObjectIsValid(nameof(__securityConnectorEnvironment), __securityConnectorEnvironment); + } + } + /// The AWS connector environment data + public partial interface IAwsEnvironment : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironment + { + /// The AWS account name + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The AWS account name", + SerializedName = @"accountName", + PossibleTypes = new [] { typeof(string) })] + string AccountName { get; } + /// The AWS account's organizational data + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The AWS account's organizational data", + SerializedName = @"organizationalData", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalData),typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalDataMaster),typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalDataMember) })] + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalData OrganizationalData { get; set; } + /// list of regions to scan + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"list of regions to scan", + SerializedName = @"regions", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List Region { get; set; } + /// Scan interval in hours (value should be between 1-hour to 24-hours) + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Scan interval in hours (value should be between 1-hour to 24-hours)", + SerializedName = @"scanInterval", + PossibleTypes = new [] { typeof(long) })] + long? ScanInterval { get; set; } + + } + /// The AWS connector environment data + internal partial interface IAwsEnvironmentInternal : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironmentInternal + { + /// The AWS account name + string AccountName { get; set; } + /// The AWS account's organizational data + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalData OrganizationalData { get; set; } + /// list of regions to scan + System.Collections.Generic.List Region { get; set; } + /// Scan interval in hours (value should be between 1-hour to 24-hours) + long? ScanInterval { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AwsEnvironment.json.cs b/src/Security/Security.Autorest/generated/api/Models/AwsEnvironment.json.cs new file mode 100644 index 000000000000..a6442af853d4 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AwsEnvironment.json.cs @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The AWS connector environment data + public partial class AwsEnvironment + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal AwsEnvironment(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __securityConnectorEnvironment = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SecurityConnectorEnvironment(json); + {_organizationalData = If( json?.PropertyT("organizationalData"), out var __jsonOrganizationalData) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AwsOrganizationalData.FromJson(__jsonOrganizationalData) : _organizationalData;} + {_region = If( json?.PropertyT("regions"), out var __jsonRegions) ? If( __jsonRegions as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : _region;} + {_accountName = If( json?.PropertyT("accountName"), out var __jsonAccountName) ? (string)__jsonAccountName : (string)_accountName;} + {_scanInterval = If( json?.PropertyT("scanInterval"), out var __jsonScanInterval) ? (long?)__jsonScanInterval : _scanInterval;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsEnvironment. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsEnvironment. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsEnvironment FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new AwsEnvironment(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __securityConnectorEnvironment?.ToJson(container, serializationMode); + AddIf( null != this._organizationalData ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._organizationalData.ToJson(null,serializationMode) : null, "organizationalData" ,container.Add ); + if (null != this._region) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.XNodeArray(); + foreach( var __x in this._region ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("regions",__w); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._accountName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._accountName.ToString()) : null, "accountName" ,container.Add ); + } + AddIf( null != this._scanInterval ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNumber((long)this._scanInterval) : null, "scanInterval" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AwsOrganizationalData.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/AwsOrganizationalData.PowerShell.cs new file mode 100644 index 000000000000..c41915da2d2d --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AwsOrganizationalData.PowerShell.cs @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The AWS organization data + [System.ComponentModel.TypeConverter(typeof(AwsOrganizationalDataTypeConverter))] + public partial class AwsOrganizationalData + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal AwsOrganizationalData(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("OrganizationMembershipType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalDataInternal)this).OrganizationMembershipType = (string) content.GetValueForProperty("OrganizationMembershipType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalDataInternal)this).OrganizationMembershipType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal AwsOrganizationalData(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("OrganizationMembershipType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalDataInternal)this).OrganizationMembershipType = (string) content.GetValueForProperty("OrganizationMembershipType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalDataInternal)this).OrganizationMembershipType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalData DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AwsOrganizationalData(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalData DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AwsOrganizationalData(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalData FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The AWS organization data + [System.ComponentModel.TypeConverter(typeof(AwsOrganizationalDataTypeConverter))] + public partial interface IAwsOrganizationalData + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AwsOrganizationalData.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/AwsOrganizationalData.TypeConverter.cs new file mode 100644 index 000000000000..74ad174dacda --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AwsOrganizationalData.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AwsOrganizationalDataTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalData ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalData).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AwsOrganizationalData.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AwsOrganizationalData.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AwsOrganizationalData.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AwsOrganizationalData.cs b/src/Security/Security.Autorest/generated/api/Models/AwsOrganizationalData.cs new file mode 100644 index 000000000000..97c4f7db6e24 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AwsOrganizationalData.cs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The AWS organization data + public partial class AwsOrganizationalData : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalData, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalDataInternal + { + + /// Backing field for property. + private string _organizationMembershipType; + + /// The multi cloud account's membership type in the organization + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string OrganizationMembershipType { get => this._organizationMembershipType; set => this._organizationMembershipType = value; } + + /// Creates an new instance. + public AwsOrganizationalData() + { + + } + } + /// The AWS organization data + public partial interface IAwsOrganizationalData : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// The multi cloud account's membership type in the organization + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The multi cloud account's membership type in the organization", + SerializedName = @"organizationMembershipType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Member", "Organization")] + string OrganizationMembershipType { get; set; } + + } + /// The AWS organization data + internal partial interface IAwsOrganizationalDataInternal + + { + /// The multi cloud account's membership type in the organization + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Member", "Organization")] + string OrganizationMembershipType { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AwsOrganizationalData.json.cs b/src/Security/Security.Autorest/generated/api/Models/AwsOrganizationalData.json.cs new file mode 100644 index 000000000000..8c86984709c7 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AwsOrganizationalData.json.cs @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The AWS organization data + public partial class AwsOrganizationalData + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal AwsOrganizationalData(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_organizationMembershipType = If( json?.PropertyT("organizationMembershipType"), out var __jsonOrganizationMembershipType) ? (string)__jsonOrganizationMembershipType : (string)_organizationMembershipType;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalData. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalData interface is polymorphic, and the + /// precise model class that will get deserialized is determined at runtime based on the payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalData. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalData FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("organizationMembershipType") ) + { + case "Organization": + { + return new AwsOrganizationalDataMaster(json); + } + case "Member": + { + return new AwsOrganizationalDataMember(json); + } + } + return new AwsOrganizationalData(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._organizationMembershipType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._organizationMembershipType.ToString()) : null, "organizationMembershipType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AwsOrganizationalDataMaster.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/AwsOrganizationalDataMaster.PowerShell.cs new file mode 100644 index 000000000000..8e84aff269f9 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AwsOrganizationalDataMaster.PowerShell.cs @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The AWS organization data for the master account + [System.ComponentModel.TypeConverter(typeof(AwsOrganizationalDataMasterTypeConverter))] + public partial class AwsOrganizationalDataMaster + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal AwsOrganizationalDataMaster(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("StacksetName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalDataMasterInternal)this).StacksetName = (string) content.GetValueForProperty("StacksetName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalDataMasterInternal)this).StacksetName, global::System.Convert.ToString); + } + if (content.Contains("ExcludedAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalDataMasterInternal)this).ExcludedAccountId = (System.Collections.Generic.List) content.GetValueForProperty("ExcludedAccountId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalDataMasterInternal)this).ExcludedAccountId, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("OrganizationMembershipType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalDataInternal)this).OrganizationMembershipType = (string) content.GetValueForProperty("OrganizationMembershipType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalDataInternal)this).OrganizationMembershipType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal AwsOrganizationalDataMaster(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("StacksetName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalDataMasterInternal)this).StacksetName = (string) content.GetValueForProperty("StacksetName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalDataMasterInternal)this).StacksetName, global::System.Convert.ToString); + } + if (content.Contains("ExcludedAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalDataMasterInternal)this).ExcludedAccountId = (System.Collections.Generic.List) content.GetValueForProperty("ExcludedAccountId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalDataMasterInternal)this).ExcludedAccountId, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("OrganizationMembershipType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalDataInternal)this).OrganizationMembershipType = (string) content.GetValueForProperty("OrganizationMembershipType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalDataInternal)this).OrganizationMembershipType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalDataMaster DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AwsOrganizationalDataMaster(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalDataMaster DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AwsOrganizationalDataMaster(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalDataMaster FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The AWS organization data for the master account + [System.ComponentModel.TypeConverter(typeof(AwsOrganizationalDataMasterTypeConverter))] + public partial interface IAwsOrganizationalDataMaster + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AwsOrganizationalDataMaster.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/AwsOrganizationalDataMaster.TypeConverter.cs new file mode 100644 index 000000000000..b427713d1716 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AwsOrganizationalDataMaster.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AwsOrganizationalDataMasterTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalDataMaster ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalDataMaster).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AwsOrganizationalDataMaster.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AwsOrganizationalDataMaster.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AwsOrganizationalDataMaster.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AwsOrganizationalDataMaster.cs b/src/Security/Security.Autorest/generated/api/Models/AwsOrganizationalDataMaster.cs new file mode 100644 index 000000000000..ded4e120eb0c --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AwsOrganizationalDataMaster.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The AWS organization data for the master account + public partial class AwsOrganizationalDataMaster : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalDataMaster, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalDataMasterInternal, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalData __awsOrganizationalData = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AwsOrganizationalData(); + + /// Backing field for property. + private System.Collections.Generic.List _excludedAccountId; + + /// + /// If the multi cloud account is of membership type organization, list of accounts excluded from offering + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public System.Collections.Generic.List ExcludedAccountId { get => this._excludedAccountId; set => this._excludedAccountId = value; } + + /// The multi cloud account's membership type in the organization + [Microsoft.Azure.PowerShell.Cmdlets.Security.Constant] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string OrganizationMembershipType { get => "Organization"; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalDataInternal)__awsOrganizationalData).OrganizationMembershipType = "Organization"; } + + /// Backing field for property. + private string _stacksetName; + + /// + /// If the multi cloud account is of membership type organization, this will be the name of the onboarding stackset + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string StacksetName { get => this._stacksetName; set => this._stacksetName = value; } + + /// Creates an new instance. + public AwsOrganizationalDataMaster() + { + this.__awsOrganizationalData.OrganizationMembershipType = "Organization"; + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__awsOrganizationalData), __awsOrganizationalData); + await eventListener.AssertObjectIsValid(nameof(__awsOrganizationalData), __awsOrganizationalData); + } + } + /// The AWS organization data for the master account + public partial interface IAwsOrganizationalDataMaster : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalData + { + /// + /// If the multi cloud account is of membership type organization, list of accounts excluded from offering + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"If the multi cloud account is of membership type organization, list of accounts excluded from offering", + SerializedName = @"excludedAccountIds", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List ExcludedAccountId { get; set; } + /// + /// If the multi cloud account is of membership type organization, this will be the name of the onboarding stackset + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"If the multi cloud account is of membership type organization, this will be the name of the onboarding stackset", + SerializedName = @"stacksetName", + PossibleTypes = new [] { typeof(string) })] + string StacksetName { get; set; } + + } + /// The AWS organization data for the master account + internal partial interface IAwsOrganizationalDataMasterInternal : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalDataInternal + { + /// + /// If the multi cloud account is of membership type organization, list of accounts excluded from offering + /// + System.Collections.Generic.List ExcludedAccountId { get; set; } + /// + /// If the multi cloud account is of membership type organization, this will be the name of the onboarding stackset + /// + string StacksetName { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AwsOrganizationalDataMaster.json.cs b/src/Security/Security.Autorest/generated/api/Models/AwsOrganizationalDataMaster.json.cs new file mode 100644 index 000000000000..be98be49b2ae --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AwsOrganizationalDataMaster.json.cs @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The AWS organization data for the master account + public partial class AwsOrganizationalDataMaster + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal AwsOrganizationalDataMaster(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __awsOrganizationalData = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AwsOrganizationalData(json); + {_stacksetName = If( json?.PropertyT("stacksetName"), out var __jsonStacksetName) ? (string)__jsonStacksetName : (string)_stacksetName;} + {_excludedAccountId = If( json?.PropertyT("excludedAccountIds"), out var __jsonExcludedAccountIds) ? If( __jsonExcludedAccountIds as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : _excludedAccountId;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalDataMaster. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalDataMaster. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalDataMaster FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new AwsOrganizationalDataMaster(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __awsOrganizationalData?.ToJson(container, serializationMode); + AddIf( null != (((object)this._stacksetName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._stacksetName.ToString()) : null, "stacksetName" ,container.Add ); + if (null != this._excludedAccountId) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.XNodeArray(); + foreach( var __x in this._excludedAccountId ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("excludedAccountIds",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AwsOrganizationalDataMember.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/AwsOrganizationalDataMember.PowerShell.cs new file mode 100644 index 000000000000..fa70cb3a0c52 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AwsOrganizationalDataMember.PowerShell.cs @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The AWS organization data for the member account + [System.ComponentModel.TypeConverter(typeof(AwsOrganizationalDataMemberTypeConverter))] + public partial class AwsOrganizationalDataMember + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal AwsOrganizationalDataMember(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ParentHierarchyId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalDataMemberInternal)this).ParentHierarchyId = (string) content.GetValueForProperty("ParentHierarchyId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalDataMemberInternal)this).ParentHierarchyId, global::System.Convert.ToString); + } + if (content.Contains("OrganizationMembershipType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalDataInternal)this).OrganizationMembershipType = (string) content.GetValueForProperty("OrganizationMembershipType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalDataInternal)this).OrganizationMembershipType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal AwsOrganizationalDataMember(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ParentHierarchyId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalDataMemberInternal)this).ParentHierarchyId = (string) content.GetValueForProperty("ParentHierarchyId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalDataMemberInternal)this).ParentHierarchyId, global::System.Convert.ToString); + } + if (content.Contains("OrganizationMembershipType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalDataInternal)this).OrganizationMembershipType = (string) content.GetValueForProperty("OrganizationMembershipType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalDataInternal)this).OrganizationMembershipType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalDataMember DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AwsOrganizationalDataMember(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalDataMember DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AwsOrganizationalDataMember(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalDataMember FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The AWS organization data for the member account + [System.ComponentModel.TypeConverter(typeof(AwsOrganizationalDataMemberTypeConverter))] + public partial interface IAwsOrganizationalDataMember + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AwsOrganizationalDataMember.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/AwsOrganizationalDataMember.TypeConverter.cs new file mode 100644 index 000000000000..c740ece683cd --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AwsOrganizationalDataMember.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AwsOrganizationalDataMemberTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalDataMember ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalDataMember).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AwsOrganizationalDataMember.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AwsOrganizationalDataMember.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AwsOrganizationalDataMember.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AwsOrganizationalDataMember.cs b/src/Security/Security.Autorest/generated/api/Models/AwsOrganizationalDataMember.cs new file mode 100644 index 000000000000..42c2e36cdc19 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AwsOrganizationalDataMember.cs @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The AWS organization data for the member account + public partial class AwsOrganizationalDataMember : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalDataMember, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalDataMemberInternal, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalData __awsOrganizationalData = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AwsOrganizationalData(); + + /// The multi cloud account's membership type in the organization + [Microsoft.Azure.PowerShell.Cmdlets.Security.Constant] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string OrganizationMembershipType { get => "Member"; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalDataInternal)__awsOrganizationalData).OrganizationMembershipType = "Member"; } + + /// Backing field for property. + private string _parentHierarchyId; + + /// + /// If the multi cloud account is not of membership type organization, this will be the ID of the account's parent + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string ParentHierarchyId { get => this._parentHierarchyId; set => this._parentHierarchyId = value; } + + /// Creates an new instance. + public AwsOrganizationalDataMember() + { + this.__awsOrganizationalData.OrganizationMembershipType = "Member"; + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__awsOrganizationalData), __awsOrganizationalData); + await eventListener.AssertObjectIsValid(nameof(__awsOrganizationalData), __awsOrganizationalData); + } + } + /// The AWS organization data for the member account + public partial interface IAwsOrganizationalDataMember : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalData + { + /// + /// If the multi cloud account is not of membership type organization, this will be the ID of the account's parent + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"If the multi cloud account is not of membership type organization, this will be the ID of the account's parent", + SerializedName = @"parentHierarchyId", + PossibleTypes = new [] { typeof(string) })] + string ParentHierarchyId { get; set; } + + } + /// The AWS organization data for the member account + internal partial interface IAwsOrganizationalDataMemberInternal : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalDataInternal + { + /// + /// If the multi cloud account is not of membership type organization, this will be the ID of the account's parent + /// + string ParentHierarchyId { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AwsOrganizationalDataMember.json.cs b/src/Security/Security.Autorest/generated/api/Models/AwsOrganizationalDataMember.json.cs new file mode 100644 index 000000000000..7ef434c9b8fd --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AwsOrganizationalDataMember.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The AWS organization data for the member account + public partial class AwsOrganizationalDataMember + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal AwsOrganizationalDataMember(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __awsOrganizationalData = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AwsOrganizationalData(json); + {_parentHierarchyId = If( json?.PropertyT("parentHierarchyId"), out var __jsonParentHierarchyId) ? (string)__jsonParentHierarchyId : (string)_parentHierarchyId;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalDataMember. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalDataMember. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalDataMember FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new AwsOrganizationalDataMember(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __awsOrganizationalData?.ToJson(container, serializationMode); + AddIf( null != (((object)this._parentHierarchyId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._parentHierarchyId.ToString()) : null, "parentHierarchyId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsOrg.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsOrg.PowerShell.cs new file mode 100644 index 000000000000..b232a2d322d8 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsOrg.PowerShell.cs @@ -0,0 +1,284 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// Azure DevOps Organization resource. + [System.ComponentModel.TypeConverter(typeof(AzureDevOpsOrgTypeConverter))] + public partial class AzureDevOpsOrg + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal AzureDevOpsOrg(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsOrgPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("OnboardingState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgInternal)this).OnboardingState = (string) content.GetValueForProperty("OnboardingState",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgInternal)this).OnboardingState, global::System.Convert.ToString); + } + if (content.Contains("ActionableRemediation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgInternal)this).ActionableRemediation = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediation) content.GetValueForProperty("ActionableRemediation",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgInternal)this).ActionableRemediation, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ActionableRemediationTypeConverter.ConvertFrom); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ProvisioningStatusMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgInternal)this).ProvisioningStatusMessage = (string) content.GetValueForProperty("ProvisioningStatusMessage",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgInternal)this).ProvisioningStatusMessage, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningStatusUpdateTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgInternal)this).ProvisioningStatusUpdateTimeUtc = (global::System.DateTime?) content.GetValueForProperty("ProvisioningStatusUpdateTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgInternal)this).ProvisioningStatusUpdateTimeUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgInternal)this).ProvisioningState, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal AzureDevOpsOrg(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsOrgPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("OnboardingState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgInternal)this).OnboardingState = (string) content.GetValueForProperty("OnboardingState",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgInternal)this).OnboardingState, global::System.Convert.ToString); + } + if (content.Contains("ActionableRemediation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgInternal)this).ActionableRemediation = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediation) content.GetValueForProperty("ActionableRemediation",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgInternal)this).ActionableRemediation, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ActionableRemediationTypeConverter.ConvertFrom); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ProvisioningStatusMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgInternal)this).ProvisioningStatusMessage = (string) content.GetValueForProperty("ProvisioningStatusMessage",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgInternal)this).ProvisioningStatusMessage, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningStatusUpdateTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgInternal)this).ProvisioningStatusUpdateTimeUtc = (global::System.DateTime?) content.GetValueForProperty("ProvisioningStatusUpdateTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgInternal)this).ProvisioningStatusUpdateTimeUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgInternal)this).ProvisioningState, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrg DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AzureDevOpsOrg(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrg DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AzureDevOpsOrg(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrg FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// Azure DevOps Organization resource. + [System.ComponentModel.TypeConverter(typeof(AzureDevOpsOrgTypeConverter))] + public partial interface IAzureDevOpsOrg + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsOrg.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsOrg.TypeConverter.cs new file mode 100644 index 000000000000..a94b8df6a3b0 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsOrg.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AzureDevOpsOrgTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrg ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrg).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AzureDevOpsOrg.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AzureDevOpsOrg.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AzureDevOpsOrg.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsOrg.cs b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsOrg.cs new file mode 100644 index 000000000000..142e6ad9eda6 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsOrg.cs @@ -0,0 +1,373 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// Azure DevOps Organization resource. + public partial class AzureDevOpsOrg : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrg, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgInternal, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IProxyResource __proxyResource = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ProxyResource(); + + /// Configuration payload for PR Annotations. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediation ActionableRemediation { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgPropertiesInternal)Property).ActionableRemediation; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgPropertiesInternal)Property).ActionableRemediation = value ?? null /* model class */; } + + /// + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Id; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgProperties Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsOrgProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProvisioningStatusMessage + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgInternal.ProvisioningStatusMessage { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgPropertiesInternal)Property).ProvisioningStatusMessage; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgPropertiesInternal)Property).ProvisioningStatusMessage = value; } + + /// Internal Acessors for ProvisioningStatusUpdateTimeUtc + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgInternal.ProvisioningStatusUpdateTimeUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgPropertiesInternal)Property).ProvisioningStatusUpdateTimeUtc; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgPropertiesInternal)Property).ProvisioningStatusUpdateTimeUtc = value; } + + /// Internal Acessors for SystemData + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemData Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgInternal.SystemData { get => (this._systemData = this._systemData ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SystemData()); set { {_systemData = value;} } } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Name = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Type = value; } + + /// The name of the resource + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Name; } + + /// + /// Details about resource onboarding status across all connectors. + /// + /// OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to + /// top-level resources. + /// Onboarded - this resource has already been onboarded by the specified connector. + /// NotOnboarded - this resource has not been onboarded to any connector. + /// NotApplicable - the onboarding state is not applicable to the current endpoint. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string OnboardingState { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgPropertiesInternal)Property).OnboardingState; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgPropertiesInternal)Property).OnboardingState = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgProperties _property; + + /// Azure DevOps Organization properties. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsOrgProperties()); set => this._property = value; } + + /// + /// The provisioning state of the resource. + /// + /// Pending - Provisioning pending. + /// Failed - Provisioning failed. + /// Succeeded - Successful provisioning. + /// Canceled - Provisioning canceled. + /// PendingDeletion - Deletion pending. + /// DeletionSuccess - Deletion successful. + /// DeletionFailure - Deletion failure. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgPropertiesInternal)Property).ProvisioningState; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgPropertiesInternal)Property).ProvisioningState = value ?? null; } + + /// Gets or sets resource status message. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string ProvisioningStatusMessage { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgPropertiesInternal)Property).ProvisioningStatusMessage; } + + /// Gets or sets time when resource was last checked. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public global::System.DateTime? ProvisioningStatusUpdateTimeUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgPropertiesInternal)Property).ProvisioningStatusUpdateTimeUtc; } + + /// Gets the resource group name + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string ResourceGroupName { get => (new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Success ? new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Groups["resourceGroupName"].Value : null); } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemData _systemData; + + /// Metadata pertaining to creation and last modification of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemData SystemData { get => (this._systemData = this._systemData ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SystemData()); } + + /// The timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).CreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).CreatedAt = value ?? default(global::System.DateTime); } + + /// The identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).CreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).CreatedBy = value ?? null; } + + /// The type of identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).CreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).CreatedByType = value ?? null; } + + /// The timestamp of resource last modification (UTC) + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).LastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).LastModifiedAt = value ?? default(global::System.DateTime); } + + /// The identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).LastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).LastModifiedBy = value ?? null; } + + /// The type of identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).LastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).LastModifiedByType = value ?? null; } + + /// + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Type; } + + /// Creates an new instance. + public AzureDevOpsOrg() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__proxyResource), __proxyResource); + await eventListener.AssertObjectIsValid(nameof(__proxyResource), __proxyResource); + } + } + /// Azure DevOps Organization resource. + public partial interface IAzureDevOpsOrg : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IProxyResource + { + /// Configuration payload for PR Annotations. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Configuration payload for PR Annotations.", + SerializedName = @"actionableRemediation", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediation) })] + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediation ActionableRemediation { get; set; } + /// + /// Details about resource onboarding status across all connectors. + /// + /// OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to + /// top-level resources. + /// Onboarded - this resource has already been onboarded by the specified connector. + /// NotOnboarded - this resource has not been onboarded to any connector. + /// NotApplicable - the onboarding state is not applicable to the current endpoint. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Details about resource onboarding status across all connectors. + + OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to top-level resources. + Onboarded - this resource has already been onboarded by the specified connector. + NotOnboarded - this resource has not been onboarded to any connector. + NotApplicable - the onboarding state is not applicable to the current endpoint.", + SerializedName = @"onboardingState", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("NotApplicable", "OnboardedByOtherConnector", "Onboarded", "NotOnboarded")] + string OnboardingState { get; set; } + /// + /// The provisioning state of the resource. + /// + /// Pending - Provisioning pending. + /// Failed - Provisioning failed. + /// Succeeded - Successful provisioning. + /// Canceled - Provisioning canceled. + /// PendingDeletion - Deletion pending. + /// DeletionSuccess - Deletion successful. + /// DeletionFailure - Deletion failure. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The provisioning state of the resource. + + Pending - Provisioning pending. + Failed - Provisioning failed. + Succeeded - Successful provisioning. + Canceled - Provisioning canceled. + PendingDeletion - Deletion pending. + DeletionSuccess - Deletion successful. + DeletionFailure - Deletion failure.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Succeeded", "Failed", "Canceled", "Pending", "PendingDeletion", "DeletionSuccess", "DeletionFailure")] + string ProvisioningState { get; set; } + /// Gets or sets resource status message. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets resource status message.", + SerializedName = @"provisioningStatusMessage", + PossibleTypes = new [] { typeof(string) })] + string ProvisioningStatusMessage { get; } + /// Gets or sets time when resource was last checked. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets time when resource was last checked.", + SerializedName = @"provisioningStatusUpdateTimeUtc", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? ProvisioningStatusUpdateTimeUtc { get; } + /// The timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The timestamp of resource creation (UTC).", + SerializedName = @"createdAt", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? SystemDataCreatedAt { get; } + /// The identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The identity that created the resource.", + SerializedName = @"createdBy", + PossibleTypes = new [] { typeof(string) })] + string SystemDataCreatedBy { get; } + /// The type of identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The type of identity that created the resource.", + SerializedName = @"createdByType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string SystemDataCreatedByType { get; } + /// The timestamp of resource last modification (UTC) + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The timestamp of resource last modification (UTC)", + SerializedName = @"lastModifiedAt", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? SystemDataLastModifiedAt { get; } + /// The identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The identity that last modified the resource.", + SerializedName = @"lastModifiedBy", + PossibleTypes = new [] { typeof(string) })] + string SystemDataLastModifiedBy { get; } + /// The type of identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The type of identity that last modified the resource.", + SerializedName = @"lastModifiedByType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string SystemDataLastModifiedByType { get; } + + } + /// Azure DevOps Organization resource. + internal partial interface IAzureDevOpsOrgInternal : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IProxyResourceInternal + { + /// Configuration payload for PR Annotations. + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediation ActionableRemediation { get; set; } + /// + /// Details about resource onboarding status across all connectors. + /// + /// OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to + /// top-level resources. + /// Onboarded - this resource has already been onboarded by the specified connector. + /// NotOnboarded - this resource has not been onboarded to any connector. + /// NotApplicable - the onboarding state is not applicable to the current endpoint. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("NotApplicable", "OnboardedByOtherConnector", "Onboarded", "NotOnboarded")] + string OnboardingState { get; set; } + /// Azure DevOps Organization properties. + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgProperties Property { get; set; } + /// + /// The provisioning state of the resource. + /// + /// Pending - Provisioning pending. + /// Failed - Provisioning failed. + /// Succeeded - Successful provisioning. + /// Canceled - Provisioning canceled. + /// PendingDeletion - Deletion pending. + /// DeletionSuccess - Deletion successful. + /// DeletionFailure - Deletion failure. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Succeeded", "Failed", "Canceled", "Pending", "PendingDeletion", "DeletionSuccess", "DeletionFailure")] + string ProvisioningState { get; set; } + /// Gets or sets resource status message. + string ProvisioningStatusMessage { get; set; } + /// Gets or sets time when resource was last checked. + global::System.DateTime? ProvisioningStatusUpdateTimeUtc { get; set; } + /// Metadata pertaining to creation and last modification of the resource. + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemData SystemData { get; set; } + /// The timestamp of resource creation (UTC). + global::System.DateTime? SystemDataCreatedAt { get; set; } + /// The identity that created the resource. + string SystemDataCreatedBy { get; set; } + /// The type of identity that created the resource. + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string SystemDataCreatedByType { get; set; } + /// The timestamp of resource last modification (UTC) + global::System.DateTime? SystemDataLastModifiedAt { get; set; } + /// The identity that last modified the resource. + string SystemDataLastModifiedBy { get; set; } + /// The type of identity that last modified the resource. + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string SystemDataLastModifiedByType { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsOrg.json.cs b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsOrg.json.cs new file mode 100644 index 000000000000..4e5c30eccf89 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsOrg.json.cs @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// Azure DevOps Organization resource. + public partial class AzureDevOpsOrg + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal AzureDevOpsOrg(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __proxyResource = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ProxyResource(json); + {_systemData = If( json?.PropertyT("systemData"), out var __jsonSystemData) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SystemData.FromJson(__jsonSystemData) : _systemData;} + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsOrgProperties.FromJson(__jsonProperties) : _property;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrg. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrg. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrg FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new AzureDevOpsOrg(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __proxyResource?.ToJson(container, serializationMode); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._systemData ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._systemData.ToJson(null,serializationMode) : null, "systemData" ,container.Add ); + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsOrgListResponse.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsOrgListResponse.PowerShell.cs new file mode 100644 index 000000000000..07cefa1ced6f --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsOrgListResponse.PowerShell.cs @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// List of RP resources which supports pagination. + [System.ComponentModel.TypeConverter(typeof(AzureDevOpsOrgListResponseTypeConverter))] + public partial class AzureDevOpsOrgListResponse + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal AzureDevOpsOrgListResponse(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgListResponseInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgListResponseInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsOrgTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgListResponseInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgListResponseInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal AzureDevOpsOrgListResponse(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgListResponseInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgListResponseInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsOrgTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgListResponseInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgListResponseInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgListResponse DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AzureDevOpsOrgListResponse(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgListResponse DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AzureDevOpsOrgListResponse(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgListResponse FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// List of RP resources which supports pagination. + [System.ComponentModel.TypeConverter(typeof(AzureDevOpsOrgListResponseTypeConverter))] + public partial interface IAzureDevOpsOrgListResponse + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsOrgListResponse.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsOrgListResponse.TypeConverter.cs new file mode 100644 index 000000000000..4ef716b41888 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsOrgListResponse.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AzureDevOpsOrgListResponseTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgListResponse ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgListResponse).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AzureDevOpsOrgListResponse.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AzureDevOpsOrgListResponse.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AzureDevOpsOrgListResponse.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsOrgListResponse.cs b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsOrgListResponse.cs new file mode 100644 index 000000000000..9edcd2c8d11a --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsOrgListResponse.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// List of RP resources which supports pagination. + public partial class AzureDevOpsOrgListResponse : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgListResponse, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgListResponseInternal + { + + /// Backing field for property. + private string _nextLink; + + /// Gets or sets next link to scroll over the results. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private System.Collections.Generic.List _value; + + /// Gets or sets list of resources. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public System.Collections.Generic.List Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public AzureDevOpsOrgListResponse() + { + + } + } + /// List of RP resources which supports pagination. + public partial interface IAzureDevOpsOrgListResponse : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// Gets or sets next link to scroll over the results. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Gets or sets next link to scroll over the results.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// Gets or sets list of resources. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Gets or sets list of resources.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrg) })] + System.Collections.Generic.List Value { get; set; } + + } + /// List of RP resources which supports pagination. + internal partial interface IAzureDevOpsOrgListResponseInternal + + { + /// Gets or sets next link to scroll over the results. + string NextLink { get; set; } + /// Gets or sets list of resources. + System.Collections.Generic.List Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsOrgListResponse.json.cs b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsOrgListResponse.json.cs new file mode 100644 index 000000000000..12ae45425757 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsOrgListResponse.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// List of RP resources which supports pagination. + public partial class AzureDevOpsOrgListResponse + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal AzureDevOpsOrgListResponse(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrg) (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsOrg.FromJson(__u) )) ))() : null : _value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)_nextLink;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgListResponse. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgListResponse. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgListResponse FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new AzureDevOpsOrgListResponse(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsOrgProperties.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsOrgProperties.PowerShell.cs new file mode 100644 index 000000000000..aff905da9ae8 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsOrgProperties.PowerShell.cs @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// Azure DevOps Organization properties. + [System.ComponentModel.TypeConverter(typeof(AzureDevOpsOrgPropertiesTypeConverter))] + public partial class AzureDevOpsOrgProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal AzureDevOpsOrgProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProvisioningStatusMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgPropertiesInternal)this).ProvisioningStatusMessage = (string) content.GetValueForProperty("ProvisioningStatusMessage",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgPropertiesInternal)this).ProvisioningStatusMessage, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningStatusUpdateTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgPropertiesInternal)this).ProvisioningStatusUpdateTimeUtc = (global::System.DateTime?) content.GetValueForProperty("ProvisioningStatusUpdateTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgPropertiesInternal)this).ProvisioningStatusUpdateTimeUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgPropertiesInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgPropertiesInternal)this).ProvisioningState, global::System.Convert.ToString); + } + if (content.Contains("OnboardingState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgPropertiesInternal)this).OnboardingState = (string) content.GetValueForProperty("OnboardingState",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgPropertiesInternal)this).OnboardingState, global::System.Convert.ToString); + } + if (content.Contains("ActionableRemediation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgPropertiesInternal)this).ActionableRemediation = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediation) content.GetValueForProperty("ActionableRemediation",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgPropertiesInternal)this).ActionableRemediation, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ActionableRemediationTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal AzureDevOpsOrgProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProvisioningStatusMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgPropertiesInternal)this).ProvisioningStatusMessage = (string) content.GetValueForProperty("ProvisioningStatusMessage",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgPropertiesInternal)this).ProvisioningStatusMessage, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningStatusUpdateTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgPropertiesInternal)this).ProvisioningStatusUpdateTimeUtc = (global::System.DateTime?) content.GetValueForProperty("ProvisioningStatusUpdateTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgPropertiesInternal)this).ProvisioningStatusUpdateTimeUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgPropertiesInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgPropertiesInternal)this).ProvisioningState, global::System.Convert.ToString); + } + if (content.Contains("OnboardingState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgPropertiesInternal)this).OnboardingState = (string) content.GetValueForProperty("OnboardingState",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgPropertiesInternal)this).OnboardingState, global::System.Convert.ToString); + } + if (content.Contains("ActionableRemediation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgPropertiesInternal)this).ActionableRemediation = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediation) content.GetValueForProperty("ActionableRemediation",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgPropertiesInternal)this).ActionableRemediation, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ActionableRemediationTypeConverter.ConvertFrom); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AzureDevOpsOrgProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AzureDevOpsOrgProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// Azure DevOps Organization properties. + [System.ComponentModel.TypeConverter(typeof(AzureDevOpsOrgPropertiesTypeConverter))] + public partial interface IAzureDevOpsOrgProperties + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsOrgProperties.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsOrgProperties.TypeConverter.cs new file mode 100644 index 000000000000..ab5ddbdf9fd3 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsOrgProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AzureDevOpsOrgPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AzureDevOpsOrgProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AzureDevOpsOrgProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AzureDevOpsOrgProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsOrgProperties.cs b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsOrgProperties.cs new file mode 100644 index 000000000000..6191d235cbf2 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsOrgProperties.cs @@ -0,0 +1,211 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// Azure DevOps Organization properties. + public partial class AzureDevOpsOrgProperties : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgProperties, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgPropertiesInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediation _actionableRemediation; + + /// Configuration payload for PR Annotations. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediation ActionableRemediation { get => (this._actionableRemediation = this._actionableRemediation ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ActionableRemediation()); set => this._actionableRemediation = value; } + + /// Internal Acessors for ProvisioningStatusMessage + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgPropertiesInternal.ProvisioningStatusMessage { get => this._provisioningStatusMessage; set { {_provisioningStatusMessage = value;} } } + + /// Internal Acessors for ProvisioningStatusUpdateTimeUtc + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgPropertiesInternal.ProvisioningStatusUpdateTimeUtc { get => this._provisioningStatusUpdateTimeUtc; set { {_provisioningStatusUpdateTimeUtc = value;} } } + + /// Backing field for property. + private string _onboardingState; + + /// + /// Details about resource onboarding status across all connectors. + /// + /// OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to + /// top-level resources. + /// Onboarded - this resource has already been onboarded by the specified connector. + /// NotOnboarded - this resource has not been onboarded to any connector. + /// NotApplicable - the onboarding state is not applicable to the current endpoint. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string OnboardingState { get => this._onboardingState; set => this._onboardingState = value; } + + /// Backing field for property. + private string _provisioningState; + + /// + /// The provisioning state of the resource. + /// + /// Pending - Provisioning pending. + /// Failed - Provisioning failed. + /// Succeeded - Successful provisioning. + /// Canceled - Provisioning canceled. + /// PendingDeletion - Deletion pending. + /// DeletionSuccess - Deletion successful. + /// DeletionFailure - Deletion failure. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string ProvisioningState { get => this._provisioningState; set => this._provisioningState = value; } + + /// Backing field for property. + private string _provisioningStatusMessage; + + /// Gets or sets resource status message. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string ProvisioningStatusMessage { get => this._provisioningStatusMessage; } + + /// Backing field for property. + private global::System.DateTime? _provisioningStatusUpdateTimeUtc; + + /// Gets or sets time when resource was last checked. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public global::System.DateTime? ProvisioningStatusUpdateTimeUtc { get => this._provisioningStatusUpdateTimeUtc; } + + /// Creates an new instance. + public AzureDevOpsOrgProperties() + { + + } + } + /// Azure DevOps Organization properties. + public partial interface IAzureDevOpsOrgProperties : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// Configuration payload for PR Annotations. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Configuration payload for PR Annotations.", + SerializedName = @"actionableRemediation", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediation) })] + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediation ActionableRemediation { get; set; } + /// + /// Details about resource onboarding status across all connectors. + /// + /// OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to + /// top-level resources. + /// Onboarded - this resource has already been onboarded by the specified connector. + /// NotOnboarded - this resource has not been onboarded to any connector. + /// NotApplicable - the onboarding state is not applicable to the current endpoint. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Details about resource onboarding status across all connectors. + + OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to top-level resources. + Onboarded - this resource has already been onboarded by the specified connector. + NotOnboarded - this resource has not been onboarded to any connector. + NotApplicable - the onboarding state is not applicable to the current endpoint.", + SerializedName = @"onboardingState", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("NotApplicable", "OnboardedByOtherConnector", "Onboarded", "NotOnboarded")] + string OnboardingState { get; set; } + /// + /// The provisioning state of the resource. + /// + /// Pending - Provisioning pending. + /// Failed - Provisioning failed. + /// Succeeded - Successful provisioning. + /// Canceled - Provisioning canceled. + /// PendingDeletion - Deletion pending. + /// DeletionSuccess - Deletion successful. + /// DeletionFailure - Deletion failure. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The provisioning state of the resource. + + Pending - Provisioning pending. + Failed - Provisioning failed. + Succeeded - Successful provisioning. + Canceled - Provisioning canceled. + PendingDeletion - Deletion pending. + DeletionSuccess - Deletion successful. + DeletionFailure - Deletion failure.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Succeeded", "Failed", "Canceled", "Pending", "PendingDeletion", "DeletionSuccess", "DeletionFailure")] + string ProvisioningState { get; set; } + /// Gets or sets resource status message. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets resource status message.", + SerializedName = @"provisioningStatusMessage", + PossibleTypes = new [] { typeof(string) })] + string ProvisioningStatusMessage { get; } + /// Gets or sets time when resource was last checked. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets time when resource was last checked.", + SerializedName = @"provisioningStatusUpdateTimeUtc", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? ProvisioningStatusUpdateTimeUtc { get; } + + } + /// Azure DevOps Organization properties. + internal partial interface IAzureDevOpsOrgPropertiesInternal + + { + /// Configuration payload for PR Annotations. + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediation ActionableRemediation { get; set; } + /// + /// Details about resource onboarding status across all connectors. + /// + /// OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to + /// top-level resources. + /// Onboarded - this resource has already been onboarded by the specified connector. + /// NotOnboarded - this resource has not been onboarded to any connector. + /// NotApplicable - the onboarding state is not applicable to the current endpoint. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("NotApplicable", "OnboardedByOtherConnector", "Onboarded", "NotOnboarded")] + string OnboardingState { get; set; } + /// + /// The provisioning state of the resource. + /// + /// Pending - Provisioning pending. + /// Failed - Provisioning failed. + /// Succeeded - Successful provisioning. + /// Canceled - Provisioning canceled. + /// PendingDeletion - Deletion pending. + /// DeletionSuccess - Deletion successful. + /// DeletionFailure - Deletion failure. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Succeeded", "Failed", "Canceled", "Pending", "PendingDeletion", "DeletionSuccess", "DeletionFailure")] + string ProvisioningState { get; set; } + /// Gets or sets resource status message. + string ProvisioningStatusMessage { get; set; } + /// Gets or sets time when resource was last checked. + global::System.DateTime? ProvisioningStatusUpdateTimeUtc { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsOrgProperties.json.cs b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsOrgProperties.json.cs new file mode 100644 index 000000000000..d1da47d572aa --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsOrgProperties.json.cs @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// Azure DevOps Organization properties. + public partial class AzureDevOpsOrgProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal AzureDevOpsOrgProperties(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_provisioningStatusMessage = If( json?.PropertyT("provisioningStatusMessage"), out var __jsonProvisioningStatusMessage) ? (string)__jsonProvisioningStatusMessage : (string)_provisioningStatusMessage;} + {_provisioningStatusUpdateTimeUtc = If( json?.PropertyT("provisioningStatusUpdateTimeUtc"), out var __jsonProvisioningStatusUpdateTimeUtc) ? global::System.DateTime.TryParse((string)__jsonProvisioningStatusUpdateTimeUtc, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonProvisioningStatusUpdateTimeUtcValue) ? __jsonProvisioningStatusUpdateTimeUtcValue : _provisioningStatusUpdateTimeUtc : _provisioningStatusUpdateTimeUtc;} + {_provisioningState = If( json?.PropertyT("provisioningState"), out var __jsonProvisioningState) ? (string)__jsonProvisioningState : (string)_provisioningState;} + {_onboardingState = If( json?.PropertyT("onboardingState"), out var __jsonOnboardingState) ? (string)__jsonOnboardingState : (string)_onboardingState;} + {_actionableRemediation = If( json?.PropertyT("actionableRemediation"), out var __jsonActionableRemediation) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ActionableRemediation.FromJson(__jsonActionableRemediation) : _actionableRemediation;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new AzureDevOpsOrgProperties(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._provisioningStatusMessage)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._provisioningStatusMessage.ToString()) : null, "provisioningStatusMessage" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._provisioningStatusUpdateTimeUtc ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._provisioningStatusUpdateTimeUtc?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "provisioningStatusUpdateTimeUtc" ,container.Add ); + } + AddIf( null != (((object)this._provisioningState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._provisioningState.ToString()) : null, "provisioningState" ,container.Add ); + AddIf( null != (((object)this._onboardingState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._onboardingState.ToString()) : null, "onboardingState" ,container.Add ); + AddIf( null != this._actionableRemediation ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._actionableRemediation.ToJson(null,serializationMode) : null, "actionableRemediation" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsOrganizationConfiguration.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsOrganizationConfiguration.PowerShell.cs new file mode 100644 index 000000000000..0bc0684bddf0 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsOrganizationConfiguration.PowerShell.cs @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// AzureDevOps Org Inventory Configuration. + [System.ComponentModel.TypeConverter(typeof(AzureDevOpsOrganizationConfigurationTypeConverter))] + public partial class AzureDevOpsOrganizationConfiguration + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal AzureDevOpsOrganizationConfiguration(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AutoDiscovery")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrganizationConfigurationInternal)this).AutoDiscovery = (string) content.GetValueForProperty("AutoDiscovery",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrganizationConfigurationInternal)this).AutoDiscovery, global::System.Convert.ToString); + } + if (content.Contains("ProjectConfig")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrganizationConfigurationInternal)this).ProjectConfig = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrganizationConfigurationProjectConfigs) content.GetValueForProperty("ProjectConfig",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrganizationConfigurationInternal)this).ProjectConfig, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsOrganizationConfigurationProjectConfigsTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal AzureDevOpsOrganizationConfiguration(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AutoDiscovery")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrganizationConfigurationInternal)this).AutoDiscovery = (string) content.GetValueForProperty("AutoDiscovery",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrganizationConfigurationInternal)this).AutoDiscovery, global::System.Convert.ToString); + } + if (content.Contains("ProjectConfig")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrganizationConfigurationInternal)this).ProjectConfig = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrganizationConfigurationProjectConfigs) content.GetValueForProperty("ProjectConfig",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrganizationConfigurationInternal)this).ProjectConfig, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsOrganizationConfigurationProjectConfigsTypeConverter.ConvertFrom); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrganizationConfiguration DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AzureDevOpsOrganizationConfiguration(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrganizationConfiguration DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AzureDevOpsOrganizationConfiguration(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrganizationConfiguration FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// AzureDevOps Org Inventory Configuration. + [System.ComponentModel.TypeConverter(typeof(AzureDevOpsOrganizationConfigurationTypeConverter))] + public partial interface IAzureDevOpsOrganizationConfiguration + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsOrganizationConfiguration.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsOrganizationConfiguration.TypeConverter.cs new file mode 100644 index 000000000000..d3f84d5ef641 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsOrganizationConfiguration.TypeConverter.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AzureDevOpsOrganizationConfigurationTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrganizationConfiguration ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrganizationConfiguration).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AzureDevOpsOrganizationConfiguration.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AzureDevOpsOrganizationConfiguration.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AzureDevOpsOrganizationConfiguration.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsOrganizationConfiguration.cs b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsOrganizationConfiguration.cs new file mode 100644 index 000000000000..600af938c475 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsOrganizationConfiguration.cs @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// AzureDevOps Org Inventory Configuration. + public partial class AzureDevOpsOrganizationConfiguration : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrganizationConfiguration, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrganizationConfigurationInternal + { + + /// Backing field for property. + private string _autoDiscovery; + + /// AutoDiscovery states. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string AutoDiscovery { get => this._autoDiscovery; set => this._autoDiscovery = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrganizationConfigurationProjectConfigs _projectConfig; + + /// + /// AzureDevOps Project Inventory Configuration. + /// Dictionary of AzureDevOps project name to desired project configuration. + /// If AutoDiscovery is Enabled, this field should be empty or null. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrganizationConfigurationProjectConfigs ProjectConfig { get => (this._projectConfig = this._projectConfig ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsOrganizationConfigurationProjectConfigs()); set => this._projectConfig = value; } + + /// Creates an new instance. + public AzureDevOpsOrganizationConfiguration() + { + + } + } + /// AzureDevOps Org Inventory Configuration. + public partial interface IAzureDevOpsOrganizationConfiguration : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// AutoDiscovery states. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"AutoDiscovery states.", + SerializedName = @"autoDiscovery", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Disabled", "Enabled", "NotApplicable")] + string AutoDiscovery { get; set; } + /// + /// AzureDevOps Project Inventory Configuration. + /// Dictionary of AzureDevOps project name to desired project configuration. + /// If AutoDiscovery is Enabled, this field should be empty or null. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"AzureDevOps Project Inventory Configuration. + Dictionary of AzureDevOps project name to desired project configuration. + If AutoDiscovery is Enabled, this field should be empty or null.", + SerializedName = @"projectConfigs", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrganizationConfigurationProjectConfigs) })] + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrganizationConfigurationProjectConfigs ProjectConfig { get; set; } + + } + /// AzureDevOps Org Inventory Configuration. + internal partial interface IAzureDevOpsOrganizationConfigurationInternal + + { + /// AutoDiscovery states. + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Disabled", "Enabled", "NotApplicable")] + string AutoDiscovery { get; set; } + /// + /// AzureDevOps Project Inventory Configuration. + /// Dictionary of AzureDevOps project name to desired project configuration. + /// If AutoDiscovery is Enabled, this field should be empty or null. + /// + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrganizationConfigurationProjectConfigs ProjectConfig { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsOrganizationConfiguration.json.cs b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsOrganizationConfiguration.json.cs new file mode 100644 index 000000000000..55f998e833a4 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsOrganizationConfiguration.json.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// AzureDevOps Org Inventory Configuration. + public partial class AzureDevOpsOrganizationConfiguration + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal AzureDevOpsOrganizationConfiguration(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_autoDiscovery = If( json?.PropertyT("autoDiscovery"), out var __jsonAutoDiscovery) ? (string)__jsonAutoDiscovery : (string)_autoDiscovery;} + {_projectConfig = If( json?.PropertyT("projectConfigs"), out var __jsonProjectConfigs) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsOrganizationConfigurationProjectConfigs.FromJson(__jsonProjectConfigs) : _projectConfig;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrganizationConfiguration. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrganizationConfiguration. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrganizationConfiguration FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new AzureDevOpsOrganizationConfiguration(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._autoDiscovery)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._autoDiscovery.ToString()) : null, "autoDiscovery" ,container.Add ); + AddIf( null != this._projectConfig ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._projectConfig.ToJson(null,serializationMode) : null, "projectConfigs" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsOrganizationConfigurationProjectConfigs.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsOrganizationConfigurationProjectConfigs.PowerShell.cs new file mode 100644 index 000000000000..846337276173 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsOrganizationConfigurationProjectConfigs.PowerShell.cs @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// AzureDevOps Project Inventory Configuration. + /// Dictionary of AzureDevOps project name to desired project configuration. + /// If AutoDiscovery is Enabled, this field should be empty or null. + /// + [System.ComponentModel.TypeConverter(typeof(AzureDevOpsOrganizationConfigurationProjectConfigsTypeConverter))] + public partial class AzureDevOpsOrganizationConfigurationProjectConfigs + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal AzureDevOpsOrganizationConfigurationProjectConfigs(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal AzureDevOpsOrganizationConfigurationProjectConfigs(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrganizationConfigurationProjectConfigs DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AzureDevOpsOrganizationConfigurationProjectConfigs(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrganizationConfigurationProjectConfigs DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AzureDevOpsOrganizationConfigurationProjectConfigs(content); + } + + /// + /// Creates a new instance of , deserializing the content + /// from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrganizationConfigurationProjectConfigs FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// AzureDevOps Project Inventory Configuration. + /// Dictionary of AzureDevOps project name to desired project configuration. + /// If AutoDiscovery is Enabled, this field should be empty or null. + [System.ComponentModel.TypeConverter(typeof(AzureDevOpsOrganizationConfigurationProjectConfigsTypeConverter))] + public partial interface IAzureDevOpsOrganizationConfigurationProjectConfigs + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsOrganizationConfigurationProjectConfigs.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsOrganizationConfigurationProjectConfigs.TypeConverter.cs new file mode 100644 index 000000000000..17f0c580311e --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsOrganizationConfigurationProjectConfigs.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AzureDevOpsOrganizationConfigurationProjectConfigsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a + /// type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrganizationConfigurationProjectConfigs ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrganizationConfigurationProjectConfigs).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AzureDevOpsOrganizationConfigurationProjectConfigs.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AzureDevOpsOrganizationConfigurationProjectConfigs.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AzureDevOpsOrganizationConfigurationProjectConfigs.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsOrganizationConfigurationProjectConfigs.cs b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsOrganizationConfigurationProjectConfigs.cs new file mode 100644 index 000000000000..7618a6f61806 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsOrganizationConfigurationProjectConfigs.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// + /// AzureDevOps Project Inventory Configuration. + /// Dictionary of AzureDevOps project name to desired project configuration. + /// If AutoDiscovery is Enabled, this field should be empty or null. + /// + public partial class AzureDevOpsOrganizationConfigurationProjectConfigs : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrganizationConfigurationProjectConfigs, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrganizationConfigurationProjectConfigsInternal + { + + /// + /// Creates an new instance. + /// + public AzureDevOpsOrganizationConfigurationProjectConfigs() + { + + } + } + /// AzureDevOps Project Inventory Configuration. + /// Dictionary of AzureDevOps project name to desired project configuration. + /// If AutoDiscovery is Enabled, this field should be empty or null. + public partial interface IAzureDevOpsOrganizationConfigurationProjectConfigs : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray + { + + } + /// AzureDevOps Project Inventory Configuration. + /// Dictionary of AzureDevOps project name to desired project configuration. + /// If AutoDiscovery is Enabled, this field should be empty or null. + internal partial interface IAzureDevOpsOrganizationConfigurationProjectConfigsInternal + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsOrganizationConfigurationProjectConfigs.dictionary.cs b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsOrganizationConfigurationProjectConfigs.dictionary.cs new file mode 100644 index 000000000000..ae4761279911 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsOrganizationConfigurationProjectConfigs.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + public partial class AzureDevOpsOrganizationConfigurationProjectConfigs : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectConfiguration this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectConfiguration value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectConfiguration value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsOrganizationConfigurationProjectConfigs source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsOrganizationConfigurationProjectConfigs.json.cs b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsOrganizationConfigurationProjectConfigs.json.cs new file mode 100644 index 000000000000..ce3c49b30858 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsOrganizationConfigurationProjectConfigs.json.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// + /// AzureDevOps Project Inventory Configuration. + /// Dictionary of AzureDevOps project name to desired project configuration. + /// If AutoDiscovery is Enabled, this field should be empty or null. + /// + public partial class AzureDevOpsOrganizationConfigurationProjectConfigs + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + /// + internal AzureDevOpsOrganizationConfigurationProjectConfigs(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray)this).AdditionalProperties, (j) => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsProjectConfiguration.FromJson(j) ,exclusions ); + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrganizationConfigurationProjectConfigs. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrganizationConfigurationProjectConfigs. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrganizationConfigurationProjectConfigs FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new AzureDevOpsOrganizationConfigurationProjectConfigs(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsProject.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsProject.PowerShell.cs new file mode 100644 index 000000000000..20d8f9decce0 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsProject.PowerShell.cs @@ -0,0 +1,300 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// Azure DevOps Project resource. + [System.ComponentModel.TypeConverter(typeof(AzureDevOpsProjectTypeConverter))] + public partial class AzureDevOpsProject + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal AzureDevOpsProject(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsProjectPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("OnboardingState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectInternal)this).OnboardingState = (string) content.GetValueForProperty("OnboardingState",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectInternal)this).OnboardingState, global::System.Convert.ToString); + } + if (content.Contains("ActionableRemediation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectInternal)this).ActionableRemediation = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediation) content.GetValueForProperty("ActionableRemediation",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectInternal)this).ActionableRemediation, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ActionableRemediationTypeConverter.ConvertFrom); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ProvisioningStatusMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectInternal)this).ProvisioningStatusMessage = (string) content.GetValueForProperty("ProvisioningStatusMessage",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectInternal)this).ProvisioningStatusMessage, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningStatusUpdateTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectInternal)this).ProvisioningStatusUpdateTimeUtc = (global::System.DateTime?) content.GetValueForProperty("ProvisioningStatusUpdateTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectInternal)this).ProvisioningStatusUpdateTimeUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectInternal)this).ProvisioningState, global::System.Convert.ToString); + } + if (content.Contains("ParentOrgName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectInternal)this).ParentOrgName = (string) content.GetValueForProperty("ParentOrgName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectInternal)this).ParentOrgName, global::System.Convert.ToString); + } + if (content.Contains("ProjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectInternal)this).ProjectId = (string) content.GetValueForProperty("ProjectId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectInternal)this).ProjectId, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal AzureDevOpsProject(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsProjectPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("OnboardingState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectInternal)this).OnboardingState = (string) content.GetValueForProperty("OnboardingState",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectInternal)this).OnboardingState, global::System.Convert.ToString); + } + if (content.Contains("ActionableRemediation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectInternal)this).ActionableRemediation = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediation) content.GetValueForProperty("ActionableRemediation",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectInternal)this).ActionableRemediation, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ActionableRemediationTypeConverter.ConvertFrom); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ProvisioningStatusMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectInternal)this).ProvisioningStatusMessage = (string) content.GetValueForProperty("ProvisioningStatusMessage",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectInternal)this).ProvisioningStatusMessage, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningStatusUpdateTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectInternal)this).ProvisioningStatusUpdateTimeUtc = (global::System.DateTime?) content.GetValueForProperty("ProvisioningStatusUpdateTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectInternal)this).ProvisioningStatusUpdateTimeUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectInternal)this).ProvisioningState, global::System.Convert.ToString); + } + if (content.Contains("ParentOrgName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectInternal)this).ParentOrgName = (string) content.GetValueForProperty("ParentOrgName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectInternal)this).ParentOrgName, global::System.Convert.ToString); + } + if (content.Contains("ProjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectInternal)this).ProjectId = (string) content.GetValueForProperty("ProjectId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectInternal)this).ProjectId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProject DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AzureDevOpsProject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProject DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AzureDevOpsProject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProject FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// Azure DevOps Project resource. + [System.ComponentModel.TypeConverter(typeof(AzureDevOpsProjectTypeConverter))] + public partial interface IAzureDevOpsProject + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsProject.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsProject.TypeConverter.cs new file mode 100644 index 000000000000..9cb60f6d1f19 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsProject.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AzureDevOpsProjectTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProject ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProject).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AzureDevOpsProject.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AzureDevOpsProject.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AzureDevOpsProject.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsProject.cs b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsProject.cs new file mode 100644 index 000000000000..1188b53ce56d --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsProject.cs @@ -0,0 +1,410 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// Azure DevOps Project resource. + public partial class AzureDevOpsProject : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProject, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectInternal, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IProxyResource __proxyResource = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ProxyResource(); + + /// Configuration payload for PR Annotations. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediation ActionableRemediation { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectPropertiesInternal)Property).ActionableRemediation; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectPropertiesInternal)Property).ActionableRemediation = value ?? null /* model class */; } + + /// + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Id; } + + /// Internal Acessors for ProjectId + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectInternal.ProjectId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectPropertiesInternal)Property).ProjectId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectPropertiesInternal)Property).ProjectId = value; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectProperties Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsProjectProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProvisioningStatusMessage + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectInternal.ProvisioningStatusMessage { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectPropertiesInternal)Property).ProvisioningStatusMessage; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectPropertiesInternal)Property).ProvisioningStatusMessage = value; } + + /// Internal Acessors for ProvisioningStatusUpdateTimeUtc + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectInternal.ProvisioningStatusUpdateTimeUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectPropertiesInternal)Property).ProvisioningStatusUpdateTimeUtc; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectPropertiesInternal)Property).ProvisioningStatusUpdateTimeUtc = value; } + + /// Internal Acessors for SystemData + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemData Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectInternal.SystemData { get => (this._systemData = this._systemData ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SystemData()); set { {_systemData = value;} } } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Name = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Type = value; } + + /// The name of the resource + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Name; } + + /// + /// Details about resource onboarding status across all connectors. + /// + /// OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to + /// top-level resources. + /// Onboarded - this resource has already been onboarded by the specified connector. + /// NotOnboarded - this resource has not been onboarded to any connector. + /// NotApplicable - the onboarding state is not applicable to the current endpoint. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string OnboardingState { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectPropertiesInternal)Property).OnboardingState; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectPropertiesInternal)Property).OnboardingState = value ?? null; } + + /// Gets or sets parent Azure DevOps Organization name. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string ParentOrgName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectPropertiesInternal)Property).ParentOrgName; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectPropertiesInternal)Property).ParentOrgName = value ?? null; } + + /// Gets or sets Azure DevOps Project id. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string ProjectId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectPropertiesInternal)Property).ProjectId; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectProperties _property; + + /// Azure DevOps Project properties. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsProjectProperties()); set => this._property = value; } + + /// + /// The provisioning state of the resource. + /// + /// Pending - Provisioning pending. + /// Failed - Provisioning failed. + /// Succeeded - Successful provisioning. + /// Canceled - Provisioning canceled. + /// PendingDeletion - Deletion pending. + /// DeletionSuccess - Deletion successful. + /// DeletionFailure - Deletion failure. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectPropertiesInternal)Property).ProvisioningState; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectPropertiesInternal)Property).ProvisioningState = value ?? null; } + + /// Gets or sets resource status message. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string ProvisioningStatusMessage { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectPropertiesInternal)Property).ProvisioningStatusMessage; } + + /// Gets or sets time when resource was last checked. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public global::System.DateTime? ProvisioningStatusUpdateTimeUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectPropertiesInternal)Property).ProvisioningStatusUpdateTimeUtc; } + + /// Gets the resource group name + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string ResourceGroupName { get => (new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Success ? new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Groups["resourceGroupName"].Value : null); } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemData _systemData; + + /// Metadata pertaining to creation and last modification of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemData SystemData { get => (this._systemData = this._systemData ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SystemData()); } + + /// The timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).CreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).CreatedAt = value ?? default(global::System.DateTime); } + + /// The identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).CreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).CreatedBy = value ?? null; } + + /// The type of identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).CreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).CreatedByType = value ?? null; } + + /// The timestamp of resource last modification (UTC) + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).LastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).LastModifiedAt = value ?? default(global::System.DateTime); } + + /// The identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).LastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).LastModifiedBy = value ?? null; } + + /// The type of identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).LastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).LastModifiedByType = value ?? null; } + + /// + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Type; } + + /// Creates an new instance. + public AzureDevOpsProject() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__proxyResource), __proxyResource); + await eventListener.AssertObjectIsValid(nameof(__proxyResource), __proxyResource); + } + } + /// Azure DevOps Project resource. + public partial interface IAzureDevOpsProject : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IProxyResource + { + /// Configuration payload for PR Annotations. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Configuration payload for PR Annotations.", + SerializedName = @"actionableRemediation", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediation) })] + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediation ActionableRemediation { get; set; } + /// + /// Details about resource onboarding status across all connectors. + /// + /// OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to + /// top-level resources. + /// Onboarded - this resource has already been onboarded by the specified connector. + /// NotOnboarded - this resource has not been onboarded to any connector. + /// NotApplicable - the onboarding state is not applicable to the current endpoint. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Details about resource onboarding status across all connectors. + + OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to top-level resources. + Onboarded - this resource has already been onboarded by the specified connector. + NotOnboarded - this resource has not been onboarded to any connector. + NotApplicable - the onboarding state is not applicable to the current endpoint.", + SerializedName = @"onboardingState", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("NotApplicable", "OnboardedByOtherConnector", "Onboarded", "NotOnboarded")] + string OnboardingState { get; set; } + /// Gets or sets parent Azure DevOps Organization name. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Gets or sets parent Azure DevOps Organization name.", + SerializedName = @"parentOrgName", + PossibleTypes = new [] { typeof(string) })] + string ParentOrgName { get; set; } + /// Gets or sets Azure DevOps Project id. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets Azure DevOps Project id.", + SerializedName = @"projectId", + PossibleTypes = new [] { typeof(string) })] + string ProjectId { get; } + /// + /// The provisioning state of the resource. + /// + /// Pending - Provisioning pending. + /// Failed - Provisioning failed. + /// Succeeded - Successful provisioning. + /// Canceled - Provisioning canceled. + /// PendingDeletion - Deletion pending. + /// DeletionSuccess - Deletion successful. + /// DeletionFailure - Deletion failure. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The provisioning state of the resource. + + Pending - Provisioning pending. + Failed - Provisioning failed. + Succeeded - Successful provisioning. + Canceled - Provisioning canceled. + PendingDeletion - Deletion pending. + DeletionSuccess - Deletion successful. + DeletionFailure - Deletion failure.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Succeeded", "Failed", "Canceled", "Pending", "PendingDeletion", "DeletionSuccess", "DeletionFailure")] + string ProvisioningState { get; set; } + /// Gets or sets resource status message. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets resource status message.", + SerializedName = @"provisioningStatusMessage", + PossibleTypes = new [] { typeof(string) })] + string ProvisioningStatusMessage { get; } + /// Gets or sets time when resource was last checked. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets time when resource was last checked.", + SerializedName = @"provisioningStatusUpdateTimeUtc", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? ProvisioningStatusUpdateTimeUtc { get; } + /// The timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The timestamp of resource creation (UTC).", + SerializedName = @"createdAt", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? SystemDataCreatedAt { get; } + /// The identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The identity that created the resource.", + SerializedName = @"createdBy", + PossibleTypes = new [] { typeof(string) })] + string SystemDataCreatedBy { get; } + /// The type of identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The type of identity that created the resource.", + SerializedName = @"createdByType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string SystemDataCreatedByType { get; } + /// The timestamp of resource last modification (UTC) + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The timestamp of resource last modification (UTC)", + SerializedName = @"lastModifiedAt", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? SystemDataLastModifiedAt { get; } + /// The identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The identity that last modified the resource.", + SerializedName = @"lastModifiedBy", + PossibleTypes = new [] { typeof(string) })] + string SystemDataLastModifiedBy { get; } + /// The type of identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The type of identity that last modified the resource.", + SerializedName = @"lastModifiedByType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string SystemDataLastModifiedByType { get; } + + } + /// Azure DevOps Project resource. + internal partial interface IAzureDevOpsProjectInternal : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IProxyResourceInternal + { + /// Configuration payload for PR Annotations. + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediation ActionableRemediation { get; set; } + /// + /// Details about resource onboarding status across all connectors. + /// + /// OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to + /// top-level resources. + /// Onboarded - this resource has already been onboarded by the specified connector. + /// NotOnboarded - this resource has not been onboarded to any connector. + /// NotApplicable - the onboarding state is not applicable to the current endpoint. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("NotApplicable", "OnboardedByOtherConnector", "Onboarded", "NotOnboarded")] + string OnboardingState { get; set; } + /// Gets or sets parent Azure DevOps Organization name. + string ParentOrgName { get; set; } + /// Gets or sets Azure DevOps Project id. + string ProjectId { get; set; } + /// Azure DevOps Project properties. + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectProperties Property { get; set; } + /// + /// The provisioning state of the resource. + /// + /// Pending - Provisioning pending. + /// Failed - Provisioning failed. + /// Succeeded - Successful provisioning. + /// Canceled - Provisioning canceled. + /// PendingDeletion - Deletion pending. + /// DeletionSuccess - Deletion successful. + /// DeletionFailure - Deletion failure. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Succeeded", "Failed", "Canceled", "Pending", "PendingDeletion", "DeletionSuccess", "DeletionFailure")] + string ProvisioningState { get; set; } + /// Gets or sets resource status message. + string ProvisioningStatusMessage { get; set; } + /// Gets or sets time when resource was last checked. + global::System.DateTime? ProvisioningStatusUpdateTimeUtc { get; set; } + /// Metadata pertaining to creation and last modification of the resource. + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemData SystemData { get; set; } + /// The timestamp of resource creation (UTC). + global::System.DateTime? SystemDataCreatedAt { get; set; } + /// The identity that created the resource. + string SystemDataCreatedBy { get; set; } + /// The type of identity that created the resource. + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string SystemDataCreatedByType { get; set; } + /// The timestamp of resource last modification (UTC) + global::System.DateTime? SystemDataLastModifiedAt { get; set; } + /// The identity that last modified the resource. + string SystemDataLastModifiedBy { get; set; } + /// The type of identity that last modified the resource. + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string SystemDataLastModifiedByType { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsProject.json.cs b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsProject.json.cs new file mode 100644 index 000000000000..b12fb9f3f784 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsProject.json.cs @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// Azure DevOps Project resource. + public partial class AzureDevOpsProject + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal AzureDevOpsProject(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __proxyResource = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ProxyResource(json); + {_systemData = If( json?.PropertyT("systemData"), out var __jsonSystemData) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SystemData.FromJson(__jsonSystemData) : _systemData;} + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsProjectProperties.FromJson(__jsonProperties) : _property;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProject. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProject. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProject FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new AzureDevOpsProject(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __proxyResource?.ToJson(container, serializationMode); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._systemData ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._systemData.ToJson(null,serializationMode) : null, "systemData" ,container.Add ); + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsProjectConfiguration.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsProjectConfiguration.PowerShell.cs new file mode 100644 index 000000000000..5a37ff2b2298 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsProjectConfiguration.PowerShell.cs @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// AzureDevOps Project Inventory Configuration. + [System.ComponentModel.TypeConverter(typeof(AzureDevOpsProjectConfigurationTypeConverter))] + public partial class AzureDevOpsProjectConfiguration + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal AzureDevOpsProjectConfiguration(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AutoDiscovery")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectConfigurationInternal)this).AutoDiscovery = (string) content.GetValueForProperty("AutoDiscovery",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectConfigurationInternal)this).AutoDiscovery, global::System.Convert.ToString); + } + if (content.Contains("RepositoryConfig")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectConfigurationInternal)this).RepositoryConfig = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectConfigurationRepositoryConfigs) content.GetValueForProperty("RepositoryConfig",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectConfigurationInternal)this).RepositoryConfig, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsProjectConfigurationRepositoryConfigsTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal AzureDevOpsProjectConfiguration(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AutoDiscovery")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectConfigurationInternal)this).AutoDiscovery = (string) content.GetValueForProperty("AutoDiscovery",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectConfigurationInternal)this).AutoDiscovery, global::System.Convert.ToString); + } + if (content.Contains("RepositoryConfig")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectConfigurationInternal)this).RepositoryConfig = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectConfigurationRepositoryConfigs) content.GetValueForProperty("RepositoryConfig",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectConfigurationInternal)this).RepositoryConfig, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsProjectConfigurationRepositoryConfigsTypeConverter.ConvertFrom); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectConfiguration DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AzureDevOpsProjectConfiguration(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectConfiguration DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AzureDevOpsProjectConfiguration(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectConfiguration FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// AzureDevOps Project Inventory Configuration. + [System.ComponentModel.TypeConverter(typeof(AzureDevOpsProjectConfigurationTypeConverter))] + public partial interface IAzureDevOpsProjectConfiguration + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsProjectConfiguration.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsProjectConfiguration.TypeConverter.cs new file mode 100644 index 000000000000..cc0ff0b13370 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsProjectConfiguration.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AzureDevOpsProjectConfigurationTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectConfiguration ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectConfiguration).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AzureDevOpsProjectConfiguration.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AzureDevOpsProjectConfiguration.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AzureDevOpsProjectConfiguration.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsProjectConfiguration.cs b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsProjectConfiguration.cs new file mode 100644 index 000000000000..366c5bc17638 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsProjectConfiguration.cs @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// AzureDevOps Project Inventory Configuration. + public partial class AzureDevOpsProjectConfiguration : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectConfiguration, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectConfigurationInternal + { + + /// Backing field for property. + private string _autoDiscovery; + + /// AutoDiscovery states. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string AutoDiscovery { get => this._autoDiscovery; set => this._autoDiscovery = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectConfigurationRepositoryConfigs _repositoryConfig; + + /// + /// AzureDevOps Repository Inventory Configuration. + /// Dictionary of AzureDevOps repository name to desired repository configuration. + /// If AutoDiscovery is Enabled, this field should be null or empty. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectConfigurationRepositoryConfigs RepositoryConfig { get => (this._repositoryConfig = this._repositoryConfig ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsProjectConfigurationRepositoryConfigs()); set => this._repositoryConfig = value; } + + /// Creates an new instance. + public AzureDevOpsProjectConfiguration() + { + + } + } + /// AzureDevOps Project Inventory Configuration. + public partial interface IAzureDevOpsProjectConfiguration : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// AutoDiscovery states. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"AutoDiscovery states.", + SerializedName = @"autoDiscovery", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Disabled", "Enabled", "NotApplicable")] + string AutoDiscovery { get; set; } + /// + /// AzureDevOps Repository Inventory Configuration. + /// Dictionary of AzureDevOps repository name to desired repository configuration. + /// If AutoDiscovery is Enabled, this field should be null or empty. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"AzureDevOps Repository Inventory Configuration. + Dictionary of AzureDevOps repository name to desired repository configuration. + If AutoDiscovery is Enabled, this field should be null or empty.", + SerializedName = @"repositoryConfigs", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectConfigurationRepositoryConfigs) })] + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectConfigurationRepositoryConfigs RepositoryConfig { get; set; } + + } + /// AzureDevOps Project Inventory Configuration. + internal partial interface IAzureDevOpsProjectConfigurationInternal + + { + /// AutoDiscovery states. + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Disabled", "Enabled", "NotApplicable")] + string AutoDiscovery { get; set; } + /// + /// AzureDevOps Repository Inventory Configuration. + /// Dictionary of AzureDevOps repository name to desired repository configuration. + /// If AutoDiscovery is Enabled, this field should be null or empty. + /// + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectConfigurationRepositoryConfigs RepositoryConfig { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsProjectConfiguration.json.cs b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsProjectConfiguration.json.cs new file mode 100644 index 000000000000..2ad58e53bfdc --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsProjectConfiguration.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// AzureDevOps Project Inventory Configuration. + public partial class AzureDevOpsProjectConfiguration + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal AzureDevOpsProjectConfiguration(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_autoDiscovery = If( json?.PropertyT("autoDiscovery"), out var __jsonAutoDiscovery) ? (string)__jsonAutoDiscovery : (string)_autoDiscovery;} + {_repositoryConfig = If( json?.PropertyT("repositoryConfigs"), out var __jsonRepositoryConfigs) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsProjectConfigurationRepositoryConfigs.FromJson(__jsonRepositoryConfigs) : _repositoryConfig;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectConfiguration. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectConfiguration. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectConfiguration FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new AzureDevOpsProjectConfiguration(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._autoDiscovery)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._autoDiscovery.ToString()) : null, "autoDiscovery" ,container.Add ); + AddIf( null != this._repositoryConfig ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._repositoryConfig.ToJson(null,serializationMode) : null, "repositoryConfigs" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsProjectConfigurationRepositoryConfigs.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsProjectConfigurationRepositoryConfigs.PowerShell.cs new file mode 100644 index 000000000000..c755f64b32cf --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsProjectConfigurationRepositoryConfigs.PowerShell.cs @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// AzureDevOps Repository Inventory Configuration. + /// Dictionary of AzureDevOps repository name to desired repository configuration. + /// If AutoDiscovery is Enabled, this field should be null or empty. + /// + [System.ComponentModel.TypeConverter(typeof(AzureDevOpsProjectConfigurationRepositoryConfigsTypeConverter))] + public partial class AzureDevOpsProjectConfigurationRepositoryConfigs + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal AzureDevOpsProjectConfigurationRepositoryConfigs(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal AzureDevOpsProjectConfigurationRepositoryConfigs(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectConfigurationRepositoryConfigs DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AzureDevOpsProjectConfigurationRepositoryConfigs(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectConfigurationRepositoryConfigs DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AzureDevOpsProjectConfigurationRepositoryConfigs(content); + } + + /// + /// Creates a new instance of , deserializing the content from + /// a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectConfigurationRepositoryConfigs FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// AzureDevOps Repository Inventory Configuration. + /// Dictionary of AzureDevOps repository name to desired repository configuration. + /// If AutoDiscovery is Enabled, this field should be null or empty. + [System.ComponentModel.TypeConverter(typeof(AzureDevOpsProjectConfigurationRepositoryConfigsTypeConverter))] + public partial interface IAzureDevOpsProjectConfigurationRepositoryConfigs + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsProjectConfigurationRepositoryConfigs.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsProjectConfigurationRepositoryConfigs.TypeConverter.cs new file mode 100644 index 000000000000..9b78a13b4bad --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsProjectConfigurationRepositoryConfigs.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AzureDevOpsProjectConfigurationRepositoryConfigsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, + /// otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectConfigurationRepositoryConfigs ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectConfigurationRepositoryConfigs).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AzureDevOpsProjectConfigurationRepositoryConfigs.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AzureDevOpsProjectConfigurationRepositoryConfigs.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AzureDevOpsProjectConfigurationRepositoryConfigs.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsProjectConfigurationRepositoryConfigs.cs b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsProjectConfigurationRepositoryConfigs.cs new file mode 100644 index 000000000000..2d24f865f898 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsProjectConfigurationRepositoryConfigs.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// + /// AzureDevOps Repository Inventory Configuration. + /// Dictionary of AzureDevOps repository name to desired repository configuration. + /// If AutoDiscovery is Enabled, this field should be null or empty. + /// + public partial class AzureDevOpsProjectConfigurationRepositoryConfigs : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectConfigurationRepositoryConfigs, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectConfigurationRepositoryConfigsInternal + { + + /// + /// Creates an new instance. + /// + public AzureDevOpsProjectConfigurationRepositoryConfigs() + { + + } + } + /// AzureDevOps Repository Inventory Configuration. + /// Dictionary of AzureDevOps repository name to desired repository configuration. + /// If AutoDiscovery is Enabled, this field should be null or empty. + public partial interface IAzureDevOpsProjectConfigurationRepositoryConfigs : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray + { + + } + /// AzureDevOps Repository Inventory Configuration. + /// Dictionary of AzureDevOps repository name to desired repository configuration. + /// If AutoDiscovery is Enabled, this field should be null or empty. + internal partial interface IAzureDevOpsProjectConfigurationRepositoryConfigsInternal + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsProjectConfigurationRepositoryConfigs.dictionary.cs b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsProjectConfigurationRepositoryConfigs.dictionary.cs new file mode 100644 index 000000000000..dcf81b5d34f1 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsProjectConfigurationRepositoryConfigs.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + public partial class AzureDevOpsProjectConfigurationRepositoryConfigs : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IBaseResourceConfiguration this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IBaseResourceConfiguration value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IBaseResourceConfiguration value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsProjectConfigurationRepositoryConfigs source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsProjectConfigurationRepositoryConfigs.json.cs b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsProjectConfigurationRepositoryConfigs.json.cs new file mode 100644 index 000000000000..0552c8078f17 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsProjectConfigurationRepositoryConfigs.json.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// + /// AzureDevOps Repository Inventory Configuration. + /// Dictionary of AzureDevOps repository name to desired repository configuration. + /// If AutoDiscovery is Enabled, this field should be null or empty. + /// + public partial class AzureDevOpsProjectConfigurationRepositoryConfigs + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + /// + internal AzureDevOpsProjectConfigurationRepositoryConfigs(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray)this).AdditionalProperties, (j) => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.BaseResourceConfiguration.FromJson(j) ,exclusions ); + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectConfigurationRepositoryConfigs. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectConfigurationRepositoryConfigs. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectConfigurationRepositoryConfigs FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new AzureDevOpsProjectConfigurationRepositoryConfigs(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsProjectListResponse.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsProjectListResponse.PowerShell.cs new file mode 100644 index 000000000000..97529b36f140 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsProjectListResponse.PowerShell.cs @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// List of RP resources which supports pagination. + [System.ComponentModel.TypeConverter(typeof(AzureDevOpsProjectListResponseTypeConverter))] + public partial class AzureDevOpsProjectListResponse + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal AzureDevOpsProjectListResponse(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectListResponseInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectListResponseInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsProjectTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectListResponseInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectListResponseInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal AzureDevOpsProjectListResponse(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectListResponseInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectListResponseInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsProjectTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectListResponseInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectListResponseInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectListResponse DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AzureDevOpsProjectListResponse(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectListResponse DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AzureDevOpsProjectListResponse(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectListResponse FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// List of RP resources which supports pagination. + [System.ComponentModel.TypeConverter(typeof(AzureDevOpsProjectListResponseTypeConverter))] + public partial interface IAzureDevOpsProjectListResponse + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsProjectListResponse.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsProjectListResponse.TypeConverter.cs new file mode 100644 index 000000000000..3b88fb65d647 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsProjectListResponse.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AzureDevOpsProjectListResponseTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectListResponse ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectListResponse).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AzureDevOpsProjectListResponse.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AzureDevOpsProjectListResponse.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AzureDevOpsProjectListResponse.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsProjectListResponse.cs b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsProjectListResponse.cs new file mode 100644 index 000000000000..56c33f8a8eed --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsProjectListResponse.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// List of RP resources which supports pagination. + public partial class AzureDevOpsProjectListResponse : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectListResponse, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectListResponseInternal + { + + /// Backing field for property. + private string _nextLink; + + /// Gets or sets next link to scroll over the results. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private System.Collections.Generic.List _value; + + /// Gets or sets list of resources. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public System.Collections.Generic.List Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public AzureDevOpsProjectListResponse() + { + + } + } + /// List of RP resources which supports pagination. + public partial interface IAzureDevOpsProjectListResponse : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// Gets or sets next link to scroll over the results. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Gets or sets next link to scroll over the results.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// Gets or sets list of resources. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Gets or sets list of resources.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProject) })] + System.Collections.Generic.List Value { get; set; } + + } + /// List of RP resources which supports pagination. + internal partial interface IAzureDevOpsProjectListResponseInternal + + { + /// Gets or sets next link to scroll over the results. + string NextLink { get; set; } + /// Gets or sets list of resources. + System.Collections.Generic.List Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsProjectListResponse.json.cs b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsProjectListResponse.json.cs new file mode 100644 index 000000000000..7746e9a32350 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsProjectListResponse.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// List of RP resources which supports pagination. + public partial class AzureDevOpsProjectListResponse + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal AzureDevOpsProjectListResponse(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProject) (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsProject.FromJson(__u) )) ))() : null : _value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)_nextLink;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectListResponse. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectListResponse. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectListResponse FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new AzureDevOpsProjectListResponse(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsProjectProperties.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsProjectProperties.PowerShell.cs new file mode 100644 index 000000000000..a752222c74ed --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsProjectProperties.PowerShell.cs @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// Azure DevOps Project properties. + [System.ComponentModel.TypeConverter(typeof(AzureDevOpsProjectPropertiesTypeConverter))] + public partial class AzureDevOpsProjectProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal AzureDevOpsProjectProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProvisioningStatusMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectPropertiesInternal)this).ProvisioningStatusMessage = (string) content.GetValueForProperty("ProvisioningStatusMessage",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectPropertiesInternal)this).ProvisioningStatusMessage, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningStatusUpdateTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectPropertiesInternal)this).ProvisioningStatusUpdateTimeUtc = (global::System.DateTime?) content.GetValueForProperty("ProvisioningStatusUpdateTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectPropertiesInternal)this).ProvisioningStatusUpdateTimeUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectPropertiesInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectPropertiesInternal)this).ProvisioningState, global::System.Convert.ToString); + } + if (content.Contains("ParentOrgName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectPropertiesInternal)this).ParentOrgName = (string) content.GetValueForProperty("ParentOrgName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectPropertiesInternal)this).ParentOrgName, global::System.Convert.ToString); + } + if (content.Contains("ProjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectPropertiesInternal)this).ProjectId = (string) content.GetValueForProperty("ProjectId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectPropertiesInternal)this).ProjectId, global::System.Convert.ToString); + } + if (content.Contains("OnboardingState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectPropertiesInternal)this).OnboardingState = (string) content.GetValueForProperty("OnboardingState",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectPropertiesInternal)this).OnboardingState, global::System.Convert.ToString); + } + if (content.Contains("ActionableRemediation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectPropertiesInternal)this).ActionableRemediation = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediation) content.GetValueForProperty("ActionableRemediation",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectPropertiesInternal)this).ActionableRemediation, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ActionableRemediationTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal AzureDevOpsProjectProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProvisioningStatusMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectPropertiesInternal)this).ProvisioningStatusMessage = (string) content.GetValueForProperty("ProvisioningStatusMessage",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectPropertiesInternal)this).ProvisioningStatusMessage, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningStatusUpdateTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectPropertiesInternal)this).ProvisioningStatusUpdateTimeUtc = (global::System.DateTime?) content.GetValueForProperty("ProvisioningStatusUpdateTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectPropertiesInternal)this).ProvisioningStatusUpdateTimeUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectPropertiesInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectPropertiesInternal)this).ProvisioningState, global::System.Convert.ToString); + } + if (content.Contains("ParentOrgName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectPropertiesInternal)this).ParentOrgName = (string) content.GetValueForProperty("ParentOrgName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectPropertiesInternal)this).ParentOrgName, global::System.Convert.ToString); + } + if (content.Contains("ProjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectPropertiesInternal)this).ProjectId = (string) content.GetValueForProperty("ProjectId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectPropertiesInternal)this).ProjectId, global::System.Convert.ToString); + } + if (content.Contains("OnboardingState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectPropertiesInternal)this).OnboardingState = (string) content.GetValueForProperty("OnboardingState",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectPropertiesInternal)this).OnboardingState, global::System.Convert.ToString); + } + if (content.Contains("ActionableRemediation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectPropertiesInternal)this).ActionableRemediation = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediation) content.GetValueForProperty("ActionableRemediation",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectPropertiesInternal)this).ActionableRemediation, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ActionableRemediationTypeConverter.ConvertFrom); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AzureDevOpsProjectProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AzureDevOpsProjectProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// Azure DevOps Project properties. + [System.ComponentModel.TypeConverter(typeof(AzureDevOpsProjectPropertiesTypeConverter))] + public partial interface IAzureDevOpsProjectProperties + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsProjectProperties.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsProjectProperties.TypeConverter.cs new file mode 100644 index 000000000000..8f128e94abf0 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsProjectProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AzureDevOpsProjectPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AzureDevOpsProjectProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AzureDevOpsProjectProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AzureDevOpsProjectProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsProjectProperties.cs b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsProjectProperties.cs new file mode 100644 index 000000000000..2b3e2cbb730d --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsProjectProperties.cs @@ -0,0 +1,254 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// Azure DevOps Project properties. + public partial class AzureDevOpsProjectProperties : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectProperties, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectPropertiesInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediation _actionableRemediation; + + /// Configuration payload for PR Annotations. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediation ActionableRemediation { get => (this._actionableRemediation = this._actionableRemediation ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ActionableRemediation()); set => this._actionableRemediation = value; } + + /// Internal Acessors for ProjectId + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectPropertiesInternal.ProjectId { get => this._projectId; set { {_projectId = value;} } } + + /// Internal Acessors for ProvisioningStatusMessage + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectPropertiesInternal.ProvisioningStatusMessage { get => this._provisioningStatusMessage; set { {_provisioningStatusMessage = value;} } } + + /// Internal Acessors for ProvisioningStatusUpdateTimeUtc + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectPropertiesInternal.ProvisioningStatusUpdateTimeUtc { get => this._provisioningStatusUpdateTimeUtc; set { {_provisioningStatusUpdateTimeUtc = value;} } } + + /// Backing field for property. + private string _onboardingState; + + /// + /// Details about resource onboarding status across all connectors. + /// + /// OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to + /// top-level resources. + /// Onboarded - this resource has already been onboarded by the specified connector. + /// NotOnboarded - this resource has not been onboarded to any connector. + /// NotApplicable - the onboarding state is not applicable to the current endpoint. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string OnboardingState { get => this._onboardingState; set => this._onboardingState = value; } + + /// Backing field for property. + private string _parentOrgName; + + /// Gets or sets parent Azure DevOps Organization name. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string ParentOrgName { get => this._parentOrgName; set => this._parentOrgName = value; } + + /// Backing field for property. + private string _projectId; + + /// Gets or sets Azure DevOps Project id. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string ProjectId { get => this._projectId; } + + /// Backing field for property. + private string _provisioningState; + + /// + /// The provisioning state of the resource. + /// + /// Pending - Provisioning pending. + /// Failed - Provisioning failed. + /// Succeeded - Successful provisioning. + /// Canceled - Provisioning canceled. + /// PendingDeletion - Deletion pending. + /// DeletionSuccess - Deletion successful. + /// DeletionFailure - Deletion failure. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string ProvisioningState { get => this._provisioningState; set => this._provisioningState = value; } + + /// Backing field for property. + private string _provisioningStatusMessage; + + /// Gets or sets resource status message. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string ProvisioningStatusMessage { get => this._provisioningStatusMessage; } + + /// Backing field for property. + private global::System.DateTime? _provisioningStatusUpdateTimeUtc; + + /// Gets or sets time when resource was last checked. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public global::System.DateTime? ProvisioningStatusUpdateTimeUtc { get => this._provisioningStatusUpdateTimeUtc; } + + /// Creates an new instance. + public AzureDevOpsProjectProperties() + { + + } + } + /// Azure DevOps Project properties. + public partial interface IAzureDevOpsProjectProperties : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// Configuration payload for PR Annotations. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Configuration payload for PR Annotations.", + SerializedName = @"actionableRemediation", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediation) })] + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediation ActionableRemediation { get; set; } + /// + /// Details about resource onboarding status across all connectors. + /// + /// OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to + /// top-level resources. + /// Onboarded - this resource has already been onboarded by the specified connector. + /// NotOnboarded - this resource has not been onboarded to any connector. + /// NotApplicable - the onboarding state is not applicable to the current endpoint. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Details about resource onboarding status across all connectors. + + OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to top-level resources. + Onboarded - this resource has already been onboarded by the specified connector. + NotOnboarded - this resource has not been onboarded to any connector. + NotApplicable - the onboarding state is not applicable to the current endpoint.", + SerializedName = @"onboardingState", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("NotApplicable", "OnboardedByOtherConnector", "Onboarded", "NotOnboarded")] + string OnboardingState { get; set; } + /// Gets or sets parent Azure DevOps Organization name. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Gets or sets parent Azure DevOps Organization name.", + SerializedName = @"parentOrgName", + PossibleTypes = new [] { typeof(string) })] + string ParentOrgName { get; set; } + /// Gets or sets Azure DevOps Project id. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets Azure DevOps Project id.", + SerializedName = @"projectId", + PossibleTypes = new [] { typeof(string) })] + string ProjectId { get; } + /// + /// The provisioning state of the resource. + /// + /// Pending - Provisioning pending. + /// Failed - Provisioning failed. + /// Succeeded - Successful provisioning. + /// Canceled - Provisioning canceled. + /// PendingDeletion - Deletion pending. + /// DeletionSuccess - Deletion successful. + /// DeletionFailure - Deletion failure. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The provisioning state of the resource. + + Pending - Provisioning pending. + Failed - Provisioning failed. + Succeeded - Successful provisioning. + Canceled - Provisioning canceled. + PendingDeletion - Deletion pending. + DeletionSuccess - Deletion successful. + DeletionFailure - Deletion failure.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Succeeded", "Failed", "Canceled", "Pending", "PendingDeletion", "DeletionSuccess", "DeletionFailure")] + string ProvisioningState { get; set; } + /// Gets or sets resource status message. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets resource status message.", + SerializedName = @"provisioningStatusMessage", + PossibleTypes = new [] { typeof(string) })] + string ProvisioningStatusMessage { get; } + /// Gets or sets time when resource was last checked. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets time when resource was last checked.", + SerializedName = @"provisioningStatusUpdateTimeUtc", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? ProvisioningStatusUpdateTimeUtc { get; } + + } + /// Azure DevOps Project properties. + internal partial interface IAzureDevOpsProjectPropertiesInternal + + { + /// Configuration payload for PR Annotations. + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediation ActionableRemediation { get; set; } + /// + /// Details about resource onboarding status across all connectors. + /// + /// OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to + /// top-level resources. + /// Onboarded - this resource has already been onboarded by the specified connector. + /// NotOnboarded - this resource has not been onboarded to any connector. + /// NotApplicable - the onboarding state is not applicable to the current endpoint. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("NotApplicable", "OnboardedByOtherConnector", "Onboarded", "NotOnboarded")] + string OnboardingState { get; set; } + /// Gets or sets parent Azure DevOps Organization name. + string ParentOrgName { get; set; } + /// Gets or sets Azure DevOps Project id. + string ProjectId { get; set; } + /// + /// The provisioning state of the resource. + /// + /// Pending - Provisioning pending. + /// Failed - Provisioning failed. + /// Succeeded - Successful provisioning. + /// Canceled - Provisioning canceled. + /// PendingDeletion - Deletion pending. + /// DeletionSuccess - Deletion successful. + /// DeletionFailure - Deletion failure. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Succeeded", "Failed", "Canceled", "Pending", "PendingDeletion", "DeletionSuccess", "DeletionFailure")] + string ProvisioningState { get; set; } + /// Gets or sets resource status message. + string ProvisioningStatusMessage { get; set; } + /// Gets or sets time when resource was last checked. + global::System.DateTime? ProvisioningStatusUpdateTimeUtc { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsProjectProperties.json.cs b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsProjectProperties.json.cs new file mode 100644 index 000000000000..fc30df50c7cc --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsProjectProperties.json.cs @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// Azure DevOps Project properties. + public partial class AzureDevOpsProjectProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal AzureDevOpsProjectProperties(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_provisioningStatusMessage = If( json?.PropertyT("provisioningStatusMessage"), out var __jsonProvisioningStatusMessage) ? (string)__jsonProvisioningStatusMessage : (string)_provisioningStatusMessage;} + {_provisioningStatusUpdateTimeUtc = If( json?.PropertyT("provisioningStatusUpdateTimeUtc"), out var __jsonProvisioningStatusUpdateTimeUtc) ? global::System.DateTime.TryParse((string)__jsonProvisioningStatusUpdateTimeUtc, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonProvisioningStatusUpdateTimeUtcValue) ? __jsonProvisioningStatusUpdateTimeUtcValue : _provisioningStatusUpdateTimeUtc : _provisioningStatusUpdateTimeUtc;} + {_provisioningState = If( json?.PropertyT("provisioningState"), out var __jsonProvisioningState) ? (string)__jsonProvisioningState : (string)_provisioningState;} + {_parentOrgName = If( json?.PropertyT("parentOrgName"), out var __jsonParentOrgName) ? (string)__jsonParentOrgName : (string)_parentOrgName;} + {_projectId = If( json?.PropertyT("projectId"), out var __jsonProjectId) ? (string)__jsonProjectId : (string)_projectId;} + {_onboardingState = If( json?.PropertyT("onboardingState"), out var __jsonOnboardingState) ? (string)__jsonOnboardingState : (string)_onboardingState;} + {_actionableRemediation = If( json?.PropertyT("actionableRemediation"), out var __jsonActionableRemediation) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ActionableRemediation.FromJson(__jsonActionableRemediation) : _actionableRemediation;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new AzureDevOpsProjectProperties(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._provisioningStatusMessage)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._provisioningStatusMessage.ToString()) : null, "provisioningStatusMessage" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._provisioningStatusUpdateTimeUtc ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._provisioningStatusUpdateTimeUtc?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "provisioningStatusUpdateTimeUtc" ,container.Add ); + } + AddIf( null != (((object)this._provisioningState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._provisioningState.ToString()) : null, "provisioningState" ,container.Add ); + AddIf( null != (((object)this._parentOrgName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._parentOrgName.ToString()) : null, "parentOrgName" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._projectId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._projectId.ToString()) : null, "projectId" ,container.Add ); + } + AddIf( null != (((object)this._onboardingState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._onboardingState.ToString()) : null, "onboardingState" ,container.Add ); + AddIf( null != this._actionableRemediation ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._actionableRemediation.ToJson(null,serializationMode) : null, "actionableRemediation" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsRepository.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsRepository.PowerShell.cs new file mode 100644 index 000000000000..d5c406c90508 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsRepository.PowerShell.cs @@ -0,0 +1,324 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// Azure DevOps Repository resource. + [System.ComponentModel.TypeConverter(typeof(AzureDevOpsRepositoryTypeConverter))] + public partial class AzureDevOpsRepository + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal AzureDevOpsRepository(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsRepositoryPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("OnboardingState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).OnboardingState = (string) content.GetValueForProperty("OnboardingState",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).OnboardingState, global::System.Convert.ToString); + } + if (content.Contains("ActionableRemediation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).ActionableRemediation = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediation) content.GetValueForProperty("ActionableRemediation",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).ActionableRemediation, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ActionableRemediationTypeConverter.ConvertFrom); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ProvisioningStatusMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).ProvisioningStatusMessage = (string) content.GetValueForProperty("ProvisioningStatusMessage",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).ProvisioningStatusMessage, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningStatusUpdateTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).ProvisioningStatusUpdateTimeUtc = (global::System.DateTime?) content.GetValueForProperty("ProvisioningStatusUpdateTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).ProvisioningStatusUpdateTimeUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).ProvisioningState, global::System.Convert.ToString); + } + if (content.Contains("ParentOrgName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).ParentOrgName = (string) content.GetValueForProperty("ParentOrgName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).ParentOrgName, global::System.Convert.ToString); + } + if (content.Contains("ParentProjectName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).ParentProjectName = (string) content.GetValueForProperty("ParentProjectName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).ParentProjectName, global::System.Convert.ToString); + } + if (content.Contains("RepoId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).RepoId = (string) content.GetValueForProperty("RepoId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).RepoId, global::System.Convert.ToString); + } + if (content.Contains("RepoUrl")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).RepoUrl = (string) content.GetValueForProperty("RepoUrl",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).RepoUrl, global::System.Convert.ToString); + } + if (content.Contains("Visibility")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).Visibility = (string) content.GetValueForProperty("Visibility",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).Visibility, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal AzureDevOpsRepository(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsRepositoryPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("OnboardingState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).OnboardingState = (string) content.GetValueForProperty("OnboardingState",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).OnboardingState, global::System.Convert.ToString); + } + if (content.Contains("ActionableRemediation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).ActionableRemediation = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediation) content.GetValueForProperty("ActionableRemediation",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).ActionableRemediation, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ActionableRemediationTypeConverter.ConvertFrom); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ProvisioningStatusMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).ProvisioningStatusMessage = (string) content.GetValueForProperty("ProvisioningStatusMessage",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).ProvisioningStatusMessage, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningStatusUpdateTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).ProvisioningStatusUpdateTimeUtc = (global::System.DateTime?) content.GetValueForProperty("ProvisioningStatusUpdateTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).ProvisioningStatusUpdateTimeUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).ProvisioningState, global::System.Convert.ToString); + } + if (content.Contains("ParentOrgName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).ParentOrgName = (string) content.GetValueForProperty("ParentOrgName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).ParentOrgName, global::System.Convert.ToString); + } + if (content.Contains("ParentProjectName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).ParentProjectName = (string) content.GetValueForProperty("ParentProjectName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).ParentProjectName, global::System.Convert.ToString); + } + if (content.Contains("RepoId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).RepoId = (string) content.GetValueForProperty("RepoId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).RepoId, global::System.Convert.ToString); + } + if (content.Contains("RepoUrl")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).RepoUrl = (string) content.GetValueForProperty("RepoUrl",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).RepoUrl, global::System.Convert.ToString); + } + if (content.Contains("Visibility")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).Visibility = (string) content.GetValueForProperty("Visibility",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal)this).Visibility, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepository DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AzureDevOpsRepository(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepository DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AzureDevOpsRepository(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepository FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// Azure DevOps Repository resource. + [System.ComponentModel.TypeConverter(typeof(AzureDevOpsRepositoryTypeConverter))] + public partial interface IAzureDevOpsRepository + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsRepository.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsRepository.TypeConverter.cs new file mode 100644 index 000000000000..7a107eab2c0a --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsRepository.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AzureDevOpsRepositoryTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepository ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepository).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AzureDevOpsRepository.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AzureDevOpsRepository.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AzureDevOpsRepository.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsRepository.cs b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsRepository.cs new file mode 100644 index 000000000000..5517ecdb9de0 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsRepository.cs @@ -0,0 +1,473 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// Azure DevOps Repository resource. + public partial class AzureDevOpsRepository : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepository, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IProxyResource __proxyResource = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ProxyResource(); + + /// Configuration payload for PR Annotations. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediation ActionableRemediation { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal)Property).ActionableRemediation; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal)Property).ActionableRemediation = value ?? null /* model class */; } + + /// + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Id; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryProperties Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsRepositoryProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProvisioningStatusMessage + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal.ProvisioningStatusMessage { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal)Property).ProvisioningStatusMessage; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal)Property).ProvisioningStatusMessage = value; } + + /// Internal Acessors for ProvisioningStatusUpdateTimeUtc + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal.ProvisioningStatusUpdateTimeUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal)Property).ProvisioningStatusUpdateTimeUtc; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal)Property).ProvisioningStatusUpdateTimeUtc = value; } + + /// Internal Acessors for RepoId + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal.RepoId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal)Property).RepoId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal)Property).RepoId = value; } + + /// Internal Acessors for RepoUrl + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal.RepoUrl { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal)Property).RepoUrl; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal)Property).RepoUrl = value; } + + /// Internal Acessors for SystemData + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemData Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal.SystemData { get => (this._systemData = this._systemData ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SystemData()); set { {_systemData = value;} } } + + /// Internal Acessors for Visibility + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryInternal.Visibility { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal)Property).Visibility; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal)Property).Visibility = value; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Name = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Type = value; } + + /// The name of the resource + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Name; } + + /// + /// Details about resource onboarding status across all connectors. + /// + /// OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to + /// top-level resources. + /// Onboarded - this resource has already been onboarded by the specified connector. + /// NotOnboarded - this resource has not been onboarded to any connector. + /// NotApplicable - the onboarding state is not applicable to the current endpoint. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string OnboardingState { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal)Property).OnboardingState; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal)Property).OnboardingState = value ?? null; } + + /// Gets or sets parent Azure DevOps Organization name. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string ParentOrgName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal)Property).ParentOrgName; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal)Property).ParentOrgName = value ?? null; } + + /// Gets or sets parent Azure DevOps Project name. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string ParentProjectName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal)Property).ParentProjectName; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal)Property).ParentProjectName = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryProperties _property; + + /// Azure DevOps Repository properties. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsRepositoryProperties()); set => this._property = value; } + + /// + /// The provisioning state of the resource. + /// + /// Pending - Provisioning pending. + /// Failed - Provisioning failed. + /// Succeeded - Successful provisioning. + /// Canceled - Provisioning canceled. + /// PendingDeletion - Deletion pending. + /// DeletionSuccess - Deletion successful. + /// DeletionFailure - Deletion failure. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal)Property).ProvisioningState; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal)Property).ProvisioningState = value ?? null; } + + /// Gets or sets resource status message. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string ProvisioningStatusMessage { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal)Property).ProvisioningStatusMessage; } + + /// Gets or sets time when resource was last checked. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public global::System.DateTime? ProvisioningStatusUpdateTimeUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal)Property).ProvisioningStatusUpdateTimeUtc; } + + /// Gets or sets Azure DevOps Repository id. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string RepoId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal)Property).RepoId; } + + /// Gets or sets Azure DevOps Repository url. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string RepoUrl { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal)Property).RepoUrl; } + + /// Gets the resource group name + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string ResourceGroupName { get => (new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Success ? new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Groups["resourceGroupName"].Value : null); } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemData _systemData; + + /// Metadata pertaining to creation and last modification of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemData SystemData { get => (this._systemData = this._systemData ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SystemData()); } + + /// The timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).CreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).CreatedAt = value ?? default(global::System.DateTime); } + + /// The identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).CreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).CreatedBy = value ?? null; } + + /// The type of identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).CreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).CreatedByType = value ?? null; } + + /// The timestamp of resource last modification (UTC) + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).LastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).LastModifiedAt = value ?? default(global::System.DateTime); } + + /// The identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).LastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).LastModifiedBy = value ?? null; } + + /// The type of identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).LastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).LastModifiedByType = value ?? null; } + + /// + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Type; } + + /// + /// Gets or sets Azure DevOps repository visibility, whether it is public or private etc. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string Visibility { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal)Property).Visibility; } + + /// Creates an new instance. + public AzureDevOpsRepository() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__proxyResource), __proxyResource); + await eventListener.AssertObjectIsValid(nameof(__proxyResource), __proxyResource); + } + } + /// Azure DevOps Repository resource. + public partial interface IAzureDevOpsRepository : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IProxyResource + { + /// Configuration payload for PR Annotations. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Configuration payload for PR Annotations.", + SerializedName = @"actionableRemediation", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediation) })] + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediation ActionableRemediation { get; set; } + /// + /// Details about resource onboarding status across all connectors. + /// + /// OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to + /// top-level resources. + /// Onboarded - this resource has already been onboarded by the specified connector. + /// NotOnboarded - this resource has not been onboarded to any connector. + /// NotApplicable - the onboarding state is not applicable to the current endpoint. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Details about resource onboarding status across all connectors. + + OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to top-level resources. + Onboarded - this resource has already been onboarded by the specified connector. + NotOnboarded - this resource has not been onboarded to any connector. + NotApplicable - the onboarding state is not applicable to the current endpoint.", + SerializedName = @"onboardingState", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("NotApplicable", "OnboardedByOtherConnector", "Onboarded", "NotOnboarded")] + string OnboardingState { get; set; } + /// Gets or sets parent Azure DevOps Organization name. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Gets or sets parent Azure DevOps Organization name.", + SerializedName = @"parentOrgName", + PossibleTypes = new [] { typeof(string) })] + string ParentOrgName { get; set; } + /// Gets or sets parent Azure DevOps Project name. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Gets or sets parent Azure DevOps Project name.", + SerializedName = @"parentProjectName", + PossibleTypes = new [] { typeof(string) })] + string ParentProjectName { get; set; } + /// + /// The provisioning state of the resource. + /// + /// Pending - Provisioning pending. + /// Failed - Provisioning failed. + /// Succeeded - Successful provisioning. + /// Canceled - Provisioning canceled. + /// PendingDeletion - Deletion pending. + /// DeletionSuccess - Deletion successful. + /// DeletionFailure - Deletion failure. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The provisioning state of the resource. + + Pending - Provisioning pending. + Failed - Provisioning failed. + Succeeded - Successful provisioning. + Canceled - Provisioning canceled. + PendingDeletion - Deletion pending. + DeletionSuccess - Deletion successful. + DeletionFailure - Deletion failure.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Succeeded", "Failed", "Canceled", "Pending", "PendingDeletion", "DeletionSuccess", "DeletionFailure")] + string ProvisioningState { get; set; } + /// Gets or sets resource status message. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets resource status message.", + SerializedName = @"provisioningStatusMessage", + PossibleTypes = new [] { typeof(string) })] + string ProvisioningStatusMessage { get; } + /// Gets or sets time when resource was last checked. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets time when resource was last checked.", + SerializedName = @"provisioningStatusUpdateTimeUtc", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? ProvisioningStatusUpdateTimeUtc { get; } + /// Gets or sets Azure DevOps Repository id. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets Azure DevOps Repository id.", + SerializedName = @"repoId", + PossibleTypes = new [] { typeof(string) })] + string RepoId { get; } + /// Gets or sets Azure DevOps Repository url. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets Azure DevOps Repository url.", + SerializedName = @"repoUrl", + PossibleTypes = new [] { typeof(string) })] + string RepoUrl { get; } + /// The timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The timestamp of resource creation (UTC).", + SerializedName = @"createdAt", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? SystemDataCreatedAt { get; } + /// The identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The identity that created the resource.", + SerializedName = @"createdBy", + PossibleTypes = new [] { typeof(string) })] + string SystemDataCreatedBy { get; } + /// The type of identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The type of identity that created the resource.", + SerializedName = @"createdByType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string SystemDataCreatedByType { get; } + /// The timestamp of resource last modification (UTC) + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The timestamp of resource last modification (UTC)", + SerializedName = @"lastModifiedAt", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? SystemDataLastModifiedAt { get; } + /// The identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The identity that last modified the resource.", + SerializedName = @"lastModifiedBy", + PossibleTypes = new [] { typeof(string) })] + string SystemDataLastModifiedBy { get; } + /// The type of identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The type of identity that last modified the resource.", + SerializedName = @"lastModifiedByType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string SystemDataLastModifiedByType { get; } + /// + /// Gets or sets Azure DevOps repository visibility, whether it is public or private etc. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets Azure DevOps repository visibility, whether it is public or private etc.", + SerializedName = @"visibility", + PossibleTypes = new [] { typeof(string) })] + string Visibility { get; } + + } + /// Azure DevOps Repository resource. + internal partial interface IAzureDevOpsRepositoryInternal : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IProxyResourceInternal + { + /// Configuration payload for PR Annotations. + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediation ActionableRemediation { get; set; } + /// + /// Details about resource onboarding status across all connectors. + /// + /// OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to + /// top-level resources. + /// Onboarded - this resource has already been onboarded by the specified connector. + /// NotOnboarded - this resource has not been onboarded to any connector. + /// NotApplicable - the onboarding state is not applicable to the current endpoint. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("NotApplicable", "OnboardedByOtherConnector", "Onboarded", "NotOnboarded")] + string OnboardingState { get; set; } + /// Gets or sets parent Azure DevOps Organization name. + string ParentOrgName { get; set; } + /// Gets or sets parent Azure DevOps Project name. + string ParentProjectName { get; set; } + /// Azure DevOps Repository properties. + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryProperties Property { get; set; } + /// + /// The provisioning state of the resource. + /// + /// Pending - Provisioning pending. + /// Failed - Provisioning failed. + /// Succeeded - Successful provisioning. + /// Canceled - Provisioning canceled. + /// PendingDeletion - Deletion pending. + /// DeletionSuccess - Deletion successful. + /// DeletionFailure - Deletion failure. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Succeeded", "Failed", "Canceled", "Pending", "PendingDeletion", "DeletionSuccess", "DeletionFailure")] + string ProvisioningState { get; set; } + /// Gets or sets resource status message. + string ProvisioningStatusMessage { get; set; } + /// Gets or sets time when resource was last checked. + global::System.DateTime? ProvisioningStatusUpdateTimeUtc { get; set; } + /// Gets or sets Azure DevOps Repository id. + string RepoId { get; set; } + /// Gets or sets Azure DevOps Repository url. + string RepoUrl { get; set; } + /// Metadata pertaining to creation and last modification of the resource. + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemData SystemData { get; set; } + /// The timestamp of resource creation (UTC). + global::System.DateTime? SystemDataCreatedAt { get; set; } + /// The identity that created the resource. + string SystemDataCreatedBy { get; set; } + /// The type of identity that created the resource. + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string SystemDataCreatedByType { get; set; } + /// The timestamp of resource last modification (UTC) + global::System.DateTime? SystemDataLastModifiedAt { get; set; } + /// The identity that last modified the resource. + string SystemDataLastModifiedBy { get; set; } + /// The type of identity that last modified the resource. + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string SystemDataLastModifiedByType { get; set; } + /// + /// Gets or sets Azure DevOps repository visibility, whether it is public or private etc. + /// + string Visibility { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsRepository.json.cs b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsRepository.json.cs new file mode 100644 index 000000000000..b2d7e9b6bbe3 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsRepository.json.cs @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// Azure DevOps Repository resource. + public partial class AzureDevOpsRepository + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal AzureDevOpsRepository(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __proxyResource = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ProxyResource(json); + {_systemData = If( json?.PropertyT("systemData"), out var __jsonSystemData) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SystemData.FromJson(__jsonSystemData) : _systemData;} + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsRepositoryProperties.FromJson(__jsonProperties) : _property;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepository. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepository. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepository FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new AzureDevOpsRepository(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __proxyResource?.ToJson(container, serializationMode); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._systemData ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._systemData.ToJson(null,serializationMode) : null, "systemData" ,container.Add ); + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsRepositoryListResponse.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsRepositoryListResponse.PowerShell.cs new file mode 100644 index 000000000000..e266e2c1e136 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsRepositoryListResponse.PowerShell.cs @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// List of RP resources which supports pagination. + [System.ComponentModel.TypeConverter(typeof(AzureDevOpsRepositoryListResponseTypeConverter))] + public partial class AzureDevOpsRepositoryListResponse + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal AzureDevOpsRepositoryListResponse(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryListResponseInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryListResponseInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsRepositoryTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryListResponseInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryListResponseInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal AzureDevOpsRepositoryListResponse(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryListResponseInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryListResponseInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsRepositoryTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryListResponseInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryListResponseInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryListResponse DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AzureDevOpsRepositoryListResponse(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryListResponse DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AzureDevOpsRepositoryListResponse(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryListResponse FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// List of RP resources which supports pagination. + [System.ComponentModel.TypeConverter(typeof(AzureDevOpsRepositoryListResponseTypeConverter))] + public partial interface IAzureDevOpsRepositoryListResponse + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsRepositoryListResponse.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsRepositoryListResponse.TypeConverter.cs new file mode 100644 index 000000000000..b4c87ec764ab --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsRepositoryListResponse.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AzureDevOpsRepositoryListResponseTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryListResponse ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryListResponse).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AzureDevOpsRepositoryListResponse.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AzureDevOpsRepositoryListResponse.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AzureDevOpsRepositoryListResponse.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsRepositoryListResponse.cs b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsRepositoryListResponse.cs new file mode 100644 index 000000000000..a084ae0673e9 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsRepositoryListResponse.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// List of RP resources which supports pagination. + public partial class AzureDevOpsRepositoryListResponse : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryListResponse, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryListResponseInternal + { + + /// Backing field for property. + private string _nextLink; + + /// Gets or sets next link to scroll over the results. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private System.Collections.Generic.List _value; + + /// Gets or sets list of resources. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public System.Collections.Generic.List Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public AzureDevOpsRepositoryListResponse() + { + + } + } + /// List of RP resources which supports pagination. + public partial interface IAzureDevOpsRepositoryListResponse : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// Gets or sets next link to scroll over the results. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Gets or sets next link to scroll over the results.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// Gets or sets list of resources. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Gets or sets list of resources.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepository) })] + System.Collections.Generic.List Value { get; set; } + + } + /// List of RP resources which supports pagination. + internal partial interface IAzureDevOpsRepositoryListResponseInternal + + { + /// Gets or sets next link to scroll over the results. + string NextLink { get; set; } + /// Gets or sets list of resources. + System.Collections.Generic.List Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsRepositoryListResponse.json.cs b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsRepositoryListResponse.json.cs new file mode 100644 index 000000000000..7c8e234b3390 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsRepositoryListResponse.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// List of RP resources which supports pagination. + public partial class AzureDevOpsRepositoryListResponse + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal AzureDevOpsRepositoryListResponse(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepository) (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsRepository.FromJson(__u) )) ))() : null : _value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)_nextLink;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryListResponse. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryListResponse. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryListResponse FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new AzureDevOpsRepositoryListResponse(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsRepositoryProperties.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsRepositoryProperties.PowerShell.cs new file mode 100644 index 000000000000..9181b023e364 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsRepositoryProperties.PowerShell.cs @@ -0,0 +1,236 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// Azure DevOps Repository properties. + [System.ComponentModel.TypeConverter(typeof(AzureDevOpsRepositoryPropertiesTypeConverter))] + public partial class AzureDevOpsRepositoryProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal AzureDevOpsRepositoryProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProvisioningStatusMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal)this).ProvisioningStatusMessage = (string) content.GetValueForProperty("ProvisioningStatusMessage",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal)this).ProvisioningStatusMessage, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningStatusUpdateTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal)this).ProvisioningStatusUpdateTimeUtc = (global::System.DateTime?) content.GetValueForProperty("ProvisioningStatusUpdateTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal)this).ProvisioningStatusUpdateTimeUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal)this).ProvisioningState, global::System.Convert.ToString); + } + if (content.Contains("ParentOrgName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal)this).ParentOrgName = (string) content.GetValueForProperty("ParentOrgName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal)this).ParentOrgName, global::System.Convert.ToString); + } + if (content.Contains("ParentProjectName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal)this).ParentProjectName = (string) content.GetValueForProperty("ParentProjectName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal)this).ParentProjectName, global::System.Convert.ToString); + } + if (content.Contains("RepoId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal)this).RepoId = (string) content.GetValueForProperty("RepoId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal)this).RepoId, global::System.Convert.ToString); + } + if (content.Contains("RepoUrl")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal)this).RepoUrl = (string) content.GetValueForProperty("RepoUrl",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal)this).RepoUrl, global::System.Convert.ToString); + } + if (content.Contains("Visibility")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal)this).Visibility = (string) content.GetValueForProperty("Visibility",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal)this).Visibility, global::System.Convert.ToString); + } + if (content.Contains("OnboardingState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal)this).OnboardingState = (string) content.GetValueForProperty("OnboardingState",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal)this).OnboardingState, global::System.Convert.ToString); + } + if (content.Contains("ActionableRemediation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal)this).ActionableRemediation = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediation) content.GetValueForProperty("ActionableRemediation",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal)this).ActionableRemediation, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ActionableRemediationTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal AzureDevOpsRepositoryProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProvisioningStatusMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal)this).ProvisioningStatusMessage = (string) content.GetValueForProperty("ProvisioningStatusMessage",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal)this).ProvisioningStatusMessage, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningStatusUpdateTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal)this).ProvisioningStatusUpdateTimeUtc = (global::System.DateTime?) content.GetValueForProperty("ProvisioningStatusUpdateTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal)this).ProvisioningStatusUpdateTimeUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal)this).ProvisioningState, global::System.Convert.ToString); + } + if (content.Contains("ParentOrgName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal)this).ParentOrgName = (string) content.GetValueForProperty("ParentOrgName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal)this).ParentOrgName, global::System.Convert.ToString); + } + if (content.Contains("ParentProjectName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal)this).ParentProjectName = (string) content.GetValueForProperty("ParentProjectName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal)this).ParentProjectName, global::System.Convert.ToString); + } + if (content.Contains("RepoId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal)this).RepoId = (string) content.GetValueForProperty("RepoId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal)this).RepoId, global::System.Convert.ToString); + } + if (content.Contains("RepoUrl")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal)this).RepoUrl = (string) content.GetValueForProperty("RepoUrl",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal)this).RepoUrl, global::System.Convert.ToString); + } + if (content.Contains("Visibility")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal)this).Visibility = (string) content.GetValueForProperty("Visibility",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal)this).Visibility, global::System.Convert.ToString); + } + if (content.Contains("OnboardingState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal)this).OnboardingState = (string) content.GetValueForProperty("OnboardingState",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal)this).OnboardingState, global::System.Convert.ToString); + } + if (content.Contains("ActionableRemediation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal)this).ActionableRemediation = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediation) content.GetValueForProperty("ActionableRemediation",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal)this).ActionableRemediation, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ActionableRemediationTypeConverter.ConvertFrom); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AzureDevOpsRepositoryProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AzureDevOpsRepositoryProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// Azure DevOps Repository properties. + [System.ComponentModel.TypeConverter(typeof(AzureDevOpsRepositoryPropertiesTypeConverter))] + public partial interface IAzureDevOpsRepositoryProperties + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsRepositoryProperties.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsRepositoryProperties.TypeConverter.cs new file mode 100644 index 000000000000..8e4ecf68ce45 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsRepositoryProperties.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AzureDevOpsRepositoryPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AzureDevOpsRepositoryProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AzureDevOpsRepositoryProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AzureDevOpsRepositoryProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsRepositoryProperties.cs b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsRepositoryProperties.cs new file mode 100644 index 000000000000..1713c0f4f8bd --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsRepositoryProperties.cs @@ -0,0 +1,326 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// Azure DevOps Repository properties. + public partial class AzureDevOpsRepositoryProperties : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryProperties, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediation _actionableRemediation; + + /// Configuration payload for PR Annotations. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediation ActionableRemediation { get => (this._actionableRemediation = this._actionableRemediation ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ActionableRemediation()); set => this._actionableRemediation = value; } + + /// Internal Acessors for ProvisioningStatusMessage + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal.ProvisioningStatusMessage { get => this._provisioningStatusMessage; set { {_provisioningStatusMessage = value;} } } + + /// Internal Acessors for ProvisioningStatusUpdateTimeUtc + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal.ProvisioningStatusUpdateTimeUtc { get => this._provisioningStatusUpdateTimeUtc; set { {_provisioningStatusUpdateTimeUtc = value;} } } + + /// Internal Acessors for RepoId + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal.RepoId { get => this._repoId; set { {_repoId = value;} } } + + /// Internal Acessors for RepoUrl + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal.RepoUrl { get => this._repoUrl; set { {_repoUrl = value;} } } + + /// Internal Acessors for Visibility + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryPropertiesInternal.Visibility { get => this._visibility; set { {_visibility = value;} } } + + /// Backing field for property. + private string _onboardingState; + + /// + /// Details about resource onboarding status across all connectors. + /// + /// OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to + /// top-level resources. + /// Onboarded - this resource has already been onboarded by the specified connector. + /// NotOnboarded - this resource has not been onboarded to any connector. + /// NotApplicable - the onboarding state is not applicable to the current endpoint. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string OnboardingState { get => this._onboardingState; set => this._onboardingState = value; } + + /// Backing field for property. + private string _parentOrgName; + + /// Gets or sets parent Azure DevOps Organization name. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string ParentOrgName { get => this._parentOrgName; set => this._parentOrgName = value; } + + /// Backing field for property. + private string _parentProjectName; + + /// Gets or sets parent Azure DevOps Project name. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string ParentProjectName { get => this._parentProjectName; set => this._parentProjectName = value; } + + /// Backing field for property. + private string _provisioningState; + + /// + /// The provisioning state of the resource. + /// + /// Pending - Provisioning pending. + /// Failed - Provisioning failed. + /// Succeeded - Successful provisioning. + /// Canceled - Provisioning canceled. + /// PendingDeletion - Deletion pending. + /// DeletionSuccess - Deletion successful. + /// DeletionFailure - Deletion failure. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string ProvisioningState { get => this._provisioningState; set => this._provisioningState = value; } + + /// Backing field for property. + private string _provisioningStatusMessage; + + /// Gets or sets resource status message. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string ProvisioningStatusMessage { get => this._provisioningStatusMessage; } + + /// Backing field for property. + private global::System.DateTime? _provisioningStatusUpdateTimeUtc; + + /// Gets or sets time when resource was last checked. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public global::System.DateTime? ProvisioningStatusUpdateTimeUtc { get => this._provisioningStatusUpdateTimeUtc; } + + /// Backing field for property. + private string _repoId; + + /// Gets or sets Azure DevOps Repository id. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string RepoId { get => this._repoId; } + + /// Backing field for property. + private string _repoUrl; + + /// Gets or sets Azure DevOps Repository url. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string RepoUrl { get => this._repoUrl; } + + /// Backing field for property. + private string _visibility; + + /// + /// Gets or sets Azure DevOps repository visibility, whether it is public or private etc. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string Visibility { get => this._visibility; } + + /// Creates an new instance. + public AzureDevOpsRepositoryProperties() + { + + } + } + /// Azure DevOps Repository properties. + public partial interface IAzureDevOpsRepositoryProperties : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// Configuration payload for PR Annotations. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Configuration payload for PR Annotations.", + SerializedName = @"actionableRemediation", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediation) })] + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediation ActionableRemediation { get; set; } + /// + /// Details about resource onboarding status across all connectors. + /// + /// OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to + /// top-level resources. + /// Onboarded - this resource has already been onboarded by the specified connector. + /// NotOnboarded - this resource has not been onboarded to any connector. + /// NotApplicable - the onboarding state is not applicable to the current endpoint. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Details about resource onboarding status across all connectors. + + OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to top-level resources. + Onboarded - this resource has already been onboarded by the specified connector. + NotOnboarded - this resource has not been onboarded to any connector. + NotApplicable - the onboarding state is not applicable to the current endpoint.", + SerializedName = @"onboardingState", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("NotApplicable", "OnboardedByOtherConnector", "Onboarded", "NotOnboarded")] + string OnboardingState { get; set; } + /// Gets or sets parent Azure DevOps Organization name. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Gets or sets parent Azure DevOps Organization name.", + SerializedName = @"parentOrgName", + PossibleTypes = new [] { typeof(string) })] + string ParentOrgName { get; set; } + /// Gets or sets parent Azure DevOps Project name. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Gets or sets parent Azure DevOps Project name.", + SerializedName = @"parentProjectName", + PossibleTypes = new [] { typeof(string) })] + string ParentProjectName { get; set; } + /// + /// The provisioning state of the resource. + /// + /// Pending - Provisioning pending. + /// Failed - Provisioning failed. + /// Succeeded - Successful provisioning. + /// Canceled - Provisioning canceled. + /// PendingDeletion - Deletion pending. + /// DeletionSuccess - Deletion successful. + /// DeletionFailure - Deletion failure. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The provisioning state of the resource. + + Pending - Provisioning pending. + Failed - Provisioning failed. + Succeeded - Successful provisioning. + Canceled - Provisioning canceled. + PendingDeletion - Deletion pending. + DeletionSuccess - Deletion successful. + DeletionFailure - Deletion failure.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Succeeded", "Failed", "Canceled", "Pending", "PendingDeletion", "DeletionSuccess", "DeletionFailure")] + string ProvisioningState { get; set; } + /// Gets or sets resource status message. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets resource status message.", + SerializedName = @"provisioningStatusMessage", + PossibleTypes = new [] { typeof(string) })] + string ProvisioningStatusMessage { get; } + /// Gets or sets time when resource was last checked. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets time when resource was last checked.", + SerializedName = @"provisioningStatusUpdateTimeUtc", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? ProvisioningStatusUpdateTimeUtc { get; } + /// Gets or sets Azure DevOps Repository id. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets Azure DevOps Repository id.", + SerializedName = @"repoId", + PossibleTypes = new [] { typeof(string) })] + string RepoId { get; } + /// Gets or sets Azure DevOps Repository url. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets Azure DevOps Repository url.", + SerializedName = @"repoUrl", + PossibleTypes = new [] { typeof(string) })] + string RepoUrl { get; } + /// + /// Gets or sets Azure DevOps repository visibility, whether it is public or private etc. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets Azure DevOps repository visibility, whether it is public or private etc.", + SerializedName = @"visibility", + PossibleTypes = new [] { typeof(string) })] + string Visibility { get; } + + } + /// Azure DevOps Repository properties. + internal partial interface IAzureDevOpsRepositoryPropertiesInternal + + { + /// Configuration payload for PR Annotations. + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediation ActionableRemediation { get; set; } + /// + /// Details about resource onboarding status across all connectors. + /// + /// OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to + /// top-level resources. + /// Onboarded - this resource has already been onboarded by the specified connector. + /// NotOnboarded - this resource has not been onboarded to any connector. + /// NotApplicable - the onboarding state is not applicable to the current endpoint. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("NotApplicable", "OnboardedByOtherConnector", "Onboarded", "NotOnboarded")] + string OnboardingState { get; set; } + /// Gets or sets parent Azure DevOps Organization name. + string ParentOrgName { get; set; } + /// Gets or sets parent Azure DevOps Project name. + string ParentProjectName { get; set; } + /// + /// The provisioning state of the resource. + /// + /// Pending - Provisioning pending. + /// Failed - Provisioning failed. + /// Succeeded - Successful provisioning. + /// Canceled - Provisioning canceled. + /// PendingDeletion - Deletion pending. + /// DeletionSuccess - Deletion successful. + /// DeletionFailure - Deletion failure. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Succeeded", "Failed", "Canceled", "Pending", "PendingDeletion", "DeletionSuccess", "DeletionFailure")] + string ProvisioningState { get; set; } + /// Gets or sets resource status message. + string ProvisioningStatusMessage { get; set; } + /// Gets or sets time when resource was last checked. + global::System.DateTime? ProvisioningStatusUpdateTimeUtc { get; set; } + /// Gets or sets Azure DevOps Repository id. + string RepoId { get; set; } + /// Gets or sets Azure DevOps Repository url. + string RepoUrl { get; set; } + /// + /// Gets or sets Azure DevOps repository visibility, whether it is public or private etc. + /// + string Visibility { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsRepositoryProperties.json.cs b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsRepositoryProperties.json.cs new file mode 100644 index 000000000000..bcc595f82f8f --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsRepositoryProperties.json.cs @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// Azure DevOps Repository properties. + public partial class AzureDevOpsRepositoryProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal AzureDevOpsRepositoryProperties(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_provisioningStatusMessage = If( json?.PropertyT("provisioningStatusMessage"), out var __jsonProvisioningStatusMessage) ? (string)__jsonProvisioningStatusMessage : (string)_provisioningStatusMessage;} + {_provisioningStatusUpdateTimeUtc = If( json?.PropertyT("provisioningStatusUpdateTimeUtc"), out var __jsonProvisioningStatusUpdateTimeUtc) ? global::System.DateTime.TryParse((string)__jsonProvisioningStatusUpdateTimeUtc, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonProvisioningStatusUpdateTimeUtcValue) ? __jsonProvisioningStatusUpdateTimeUtcValue : _provisioningStatusUpdateTimeUtc : _provisioningStatusUpdateTimeUtc;} + {_provisioningState = If( json?.PropertyT("provisioningState"), out var __jsonProvisioningState) ? (string)__jsonProvisioningState : (string)_provisioningState;} + {_parentOrgName = If( json?.PropertyT("parentOrgName"), out var __jsonParentOrgName) ? (string)__jsonParentOrgName : (string)_parentOrgName;} + {_parentProjectName = If( json?.PropertyT("parentProjectName"), out var __jsonParentProjectName) ? (string)__jsonParentProjectName : (string)_parentProjectName;} + {_repoId = If( json?.PropertyT("repoId"), out var __jsonRepoId) ? (string)__jsonRepoId : (string)_repoId;} + {_repoUrl = If( json?.PropertyT("repoUrl"), out var __jsonRepoUrl) ? (string)__jsonRepoUrl : (string)_repoUrl;} + {_visibility = If( json?.PropertyT("visibility"), out var __jsonVisibility) ? (string)__jsonVisibility : (string)_visibility;} + {_onboardingState = If( json?.PropertyT("onboardingState"), out var __jsonOnboardingState) ? (string)__jsonOnboardingState : (string)_onboardingState;} + {_actionableRemediation = If( json?.PropertyT("actionableRemediation"), out var __jsonActionableRemediation) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ActionableRemediation.FromJson(__jsonActionableRemediation) : _actionableRemediation;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new AzureDevOpsRepositoryProperties(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._provisioningStatusMessage)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._provisioningStatusMessage.ToString()) : null, "provisioningStatusMessage" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._provisioningStatusUpdateTimeUtc ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._provisioningStatusUpdateTimeUtc?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "provisioningStatusUpdateTimeUtc" ,container.Add ); + } + AddIf( null != (((object)this._provisioningState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._provisioningState.ToString()) : null, "provisioningState" ,container.Add ); + AddIf( null != (((object)this._parentOrgName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._parentOrgName.ToString()) : null, "parentOrgName" ,container.Add ); + AddIf( null != (((object)this._parentProjectName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._parentProjectName.ToString()) : null, "parentProjectName" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._repoId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._repoId.ToString()) : null, "repoId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._repoUrl)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._repoUrl.ToString()) : null, "repoUrl" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._visibility)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._visibility.ToString()) : null, "visibility" ,container.Add ); + } + AddIf( null != (((object)this._onboardingState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._onboardingState.ToString()) : null, "onboardingState" ,container.Add ); + AddIf( null != this._actionableRemediation ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._actionableRemediation.ToJson(null,serializationMode) : null, "actionableRemediation" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsScopeEnvironment.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsScopeEnvironment.PowerShell.cs new file mode 100644 index 000000000000..4f8c89d1d8ff --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsScopeEnvironment.PowerShell.cs @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The AzureDevOps scope connector's environment data + [System.ComponentModel.TypeConverter(typeof(AzureDevOpsScopeEnvironmentTypeConverter))] + public partial class AzureDevOpsScopeEnvironment + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal AzureDevOpsScopeEnvironment(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("EnvironmentType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironmentInternal)this).EnvironmentType = (string) content.GetValueForProperty("EnvironmentType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironmentInternal)this).EnvironmentType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal AzureDevOpsScopeEnvironment(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("EnvironmentType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironmentInternal)this).EnvironmentType = (string) content.GetValueForProperty("EnvironmentType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironmentInternal)this).EnvironmentType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsScopeEnvironment DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AzureDevOpsScopeEnvironment(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsScopeEnvironment DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AzureDevOpsScopeEnvironment(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsScopeEnvironment FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The AzureDevOps scope connector's environment data + [System.ComponentModel.TypeConverter(typeof(AzureDevOpsScopeEnvironmentTypeConverter))] + public partial interface IAzureDevOpsScopeEnvironment + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsScopeEnvironment.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsScopeEnvironment.TypeConverter.cs new file mode 100644 index 000000000000..1012826d681a --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsScopeEnvironment.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AzureDevOpsScopeEnvironmentTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsScopeEnvironment ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsScopeEnvironment).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AzureDevOpsScopeEnvironment.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AzureDevOpsScopeEnvironment.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AzureDevOpsScopeEnvironment.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsScopeEnvironment.cs b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsScopeEnvironment.cs new file mode 100644 index 000000000000..893959599a14 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsScopeEnvironment.cs @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The AzureDevOps scope connector's environment data + public partial class AzureDevOpsScopeEnvironment : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsScopeEnvironment, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsScopeEnvironmentInternal, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironment __securityConnectorEnvironment = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SecurityConnectorEnvironment(); + + /// The type of the environment data. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Constant] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string EnvironmentType { get => "AzureDevOpsScope"; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironmentInternal)__securityConnectorEnvironment).EnvironmentType = "AzureDevOpsScope"; } + + /// Creates an new instance. + public AzureDevOpsScopeEnvironment() + { + this.__securityConnectorEnvironment.EnvironmentType = "AzureDevOpsScope"; + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__securityConnectorEnvironment), __securityConnectorEnvironment); + await eventListener.AssertObjectIsValid(nameof(__securityConnectorEnvironment), __securityConnectorEnvironment); + } + } + /// The AzureDevOps scope connector's environment data + public partial interface IAzureDevOpsScopeEnvironment : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironment + { + + } + /// The AzureDevOps scope connector's environment data + internal partial interface IAzureDevOpsScopeEnvironmentInternal : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironmentInternal + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsScopeEnvironment.json.cs b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsScopeEnvironment.json.cs new file mode 100644 index 000000000000..389025baab5f --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AzureDevOpsScopeEnvironment.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The AzureDevOps scope connector's environment data + public partial class AzureDevOpsScopeEnvironment + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal AzureDevOpsScopeEnvironment(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __securityConnectorEnvironment = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SecurityConnectorEnvironment(json); + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsScopeEnvironment. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsScopeEnvironment. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsScopeEnvironment FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new AzureDevOpsScopeEnvironment(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __securityConnectorEnvironment?.ToJson(container, serializationMode); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AzureTrackedResourceLocation.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/AzureTrackedResourceLocation.PowerShell.cs new file mode 100644 index 000000000000..4697ab2046eb --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AzureTrackedResourceLocation.PowerShell.cs @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// Describes an Azure resource with location + [System.ComponentModel.TypeConverter(typeof(AzureTrackedResourceLocationTypeConverter))] + public partial class AzureTrackedResourceLocation + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal AzureTrackedResourceLocation(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureTrackedResourceLocationInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureTrackedResourceLocationInternal)this).Location, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal AzureTrackedResourceLocation(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureTrackedResourceLocationInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureTrackedResourceLocationInternal)this).Location, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureTrackedResourceLocation DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AzureTrackedResourceLocation(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureTrackedResourceLocation DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AzureTrackedResourceLocation(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureTrackedResourceLocation FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// Describes an Azure resource with location + [System.ComponentModel.TypeConverter(typeof(AzureTrackedResourceLocationTypeConverter))] + public partial interface IAzureTrackedResourceLocation + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AzureTrackedResourceLocation.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/AzureTrackedResourceLocation.TypeConverter.cs new file mode 100644 index 000000000000..444b24bb4521 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AzureTrackedResourceLocation.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AzureTrackedResourceLocationTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureTrackedResourceLocation ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureTrackedResourceLocation).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AzureTrackedResourceLocation.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AzureTrackedResourceLocation.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AzureTrackedResourceLocation.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AzureTrackedResourceLocation.cs b/src/Security/Security.Autorest/generated/api/Models/AzureTrackedResourceLocation.cs new file mode 100644 index 000000000000..30b0d518f156 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AzureTrackedResourceLocation.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// Describes an Azure resource with location + public partial class AzureTrackedResourceLocation : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureTrackedResourceLocation, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureTrackedResourceLocationInternal + { + + /// Backing field for property. + private string _location; + + /// Location where the resource is stored + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string Location { get => this._location; set => this._location = value; } + + /// Creates an new instance. + public AzureTrackedResourceLocation() + { + + } + } + /// Describes an Azure resource with location + public partial interface IAzureTrackedResourceLocation : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// Location where the resource is stored + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Location where the resource is stored", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + string Location { get; set; } + + } + /// Describes an Azure resource with location + internal partial interface IAzureTrackedResourceLocationInternal + + { + /// Location where the resource is stored + string Location { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/AzureTrackedResourceLocation.json.cs b/src/Security/Security.Autorest/generated/api/Models/AzureTrackedResourceLocation.json.cs new file mode 100644 index 000000000000..2ffa3ccdfe43 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/AzureTrackedResourceLocation.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// Describes an Azure resource with location + public partial class AzureTrackedResourceLocation + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal AzureTrackedResourceLocation(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_location = If( json?.PropertyT("location"), out var __jsonLocation) ? (string)__jsonLocation : (string)_location;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureTrackedResourceLocation. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureTrackedResourceLocation. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureTrackedResourceLocation FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new AzureTrackedResourceLocation(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._location)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._location.ToString()) : null, "location" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/BaseResourceConfiguration.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/BaseResourceConfiguration.PowerShell.cs new file mode 100644 index 000000000000..e9210da94d5c --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/BaseResourceConfiguration.PowerShell.cs @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// Base Resource Inventory configuration changes. + [System.ComponentModel.TypeConverter(typeof(BaseResourceConfigurationTypeConverter))] + public partial class BaseResourceConfiguration + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal BaseResourceConfiguration(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DesiredOnboardingState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IBaseResourceConfigurationInternal)this).DesiredOnboardingState = (string) content.GetValueForProperty("DesiredOnboardingState",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IBaseResourceConfigurationInternal)this).DesiredOnboardingState, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal BaseResourceConfiguration(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DesiredOnboardingState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IBaseResourceConfigurationInternal)this).DesiredOnboardingState = (string) content.GetValueForProperty("DesiredOnboardingState",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IBaseResourceConfigurationInternal)this).DesiredOnboardingState, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IBaseResourceConfiguration DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new BaseResourceConfiguration(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IBaseResourceConfiguration DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new BaseResourceConfiguration(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IBaseResourceConfiguration FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// Base Resource Inventory configuration changes. + [System.ComponentModel.TypeConverter(typeof(BaseResourceConfigurationTypeConverter))] + public partial interface IBaseResourceConfiguration + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/BaseResourceConfiguration.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/BaseResourceConfiguration.TypeConverter.cs new file mode 100644 index 000000000000..48239dea2722 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/BaseResourceConfiguration.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class BaseResourceConfigurationTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IBaseResourceConfiguration ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IBaseResourceConfiguration).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return BaseResourceConfiguration.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return BaseResourceConfiguration.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return BaseResourceConfiguration.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/BaseResourceConfiguration.cs b/src/Security/Security.Autorest/generated/api/Models/BaseResourceConfiguration.cs new file mode 100644 index 000000000000..a32d97d38d2b --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/BaseResourceConfiguration.cs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// Base Resource Inventory configuration changes. + public partial class BaseResourceConfiguration : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IBaseResourceConfiguration, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IBaseResourceConfigurationInternal + { + + /// Backing field for property. + private string _desiredOnboardingState; + + /// Onboarding states. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string DesiredOnboardingState { get => this._desiredOnboardingState; set => this._desiredOnboardingState = value; } + + /// Creates an new instance. + public BaseResourceConfiguration() + { + + } + } + /// Base Resource Inventory configuration changes. + public partial interface IBaseResourceConfiguration : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// Onboarding states. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Onboarding states.", + SerializedName = @"desiredOnboardingState", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Disabled", "Enabled")] + string DesiredOnboardingState { get; set; } + + } + /// Base Resource Inventory configuration changes. + internal partial interface IBaseResourceConfigurationInternal + + { + /// Onboarding states. + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Disabled", "Enabled")] + string DesiredOnboardingState { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/BaseResourceConfiguration.json.cs b/src/Security/Security.Autorest/generated/api/Models/BaseResourceConfiguration.json.cs new file mode 100644 index 000000000000..8bede57688dc --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/BaseResourceConfiguration.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// Base Resource Inventory configuration changes. + public partial class BaseResourceConfiguration + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal BaseResourceConfiguration(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_desiredOnboardingState = If( json?.PropertyT("desiredOnboardingState"), out var __jsonDesiredOnboardingState) ? (string)__jsonDesiredOnboardingState : (string)_desiredOnboardingState;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IBaseResourceConfiguration. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IBaseResourceConfiguration. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IBaseResourceConfiguration FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new BaseResourceConfiguration(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._desiredOnboardingState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._desiredOnboardingState.ToString()) : null, "desiredOnboardingState" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/CategoryConfiguration.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/CategoryConfiguration.PowerShell.cs new file mode 100644 index 000000000000..fa55a3f6f1aa --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/CategoryConfiguration.PowerShell.cs @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// Severity level per category configuration for PR Annotations. + [System.ComponentModel.TypeConverter(typeof(CategoryConfigurationTypeConverter))] + public partial class CategoryConfiguration + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal CategoryConfiguration(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("MinimumSeverityLevel")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICategoryConfigurationInternal)this).MinimumSeverityLevel = (string) content.GetValueForProperty("MinimumSeverityLevel",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICategoryConfigurationInternal)this).MinimumSeverityLevel, global::System.Convert.ToString); + } + if (content.Contains("Category")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICategoryConfigurationInternal)this).Category = (string) content.GetValueForProperty("Category",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICategoryConfigurationInternal)this).Category, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal CategoryConfiguration(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("MinimumSeverityLevel")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICategoryConfigurationInternal)this).MinimumSeverityLevel = (string) content.GetValueForProperty("MinimumSeverityLevel",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICategoryConfigurationInternal)this).MinimumSeverityLevel, global::System.Convert.ToString); + } + if (content.Contains("Category")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICategoryConfigurationInternal)this).Category = (string) content.GetValueForProperty("Category",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICategoryConfigurationInternal)this).Category, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICategoryConfiguration DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new CategoryConfiguration(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICategoryConfiguration DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new CategoryConfiguration(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICategoryConfiguration FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// Severity level per category configuration for PR Annotations. + [System.ComponentModel.TypeConverter(typeof(CategoryConfigurationTypeConverter))] + public partial interface ICategoryConfiguration + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/CategoryConfiguration.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/CategoryConfiguration.TypeConverter.cs new file mode 100644 index 000000000000..889f17d4b7cd --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/CategoryConfiguration.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class CategoryConfigurationTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICategoryConfiguration ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICategoryConfiguration).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return CategoryConfiguration.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return CategoryConfiguration.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return CategoryConfiguration.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/CategoryConfiguration.cs b/src/Security/Security.Autorest/generated/api/Models/CategoryConfiguration.cs new file mode 100644 index 000000000000..e6eff68a4f85 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/CategoryConfiguration.cs @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// Severity level per category configuration for PR Annotations. + public partial class CategoryConfiguration : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICategoryConfiguration, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICategoryConfigurationInternal + { + + /// Backing field for property. + private string _category; + + /// + /// Rule categories. + /// Code - code scanning results. + /// Artifact scanning results. + /// Dependencies scanning results. + /// IaC results. + /// Secrets scanning results. + /// Container scanning results. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string Category { get => this._category; set => this._category = value; } + + /// Backing field for property. + private string _minimumSeverityLevel; + + /// Gets or sets minimum severity level for a given category. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string MinimumSeverityLevel { get => this._minimumSeverityLevel; set => this._minimumSeverityLevel = value; } + + /// Creates an new instance. + public CategoryConfiguration() + { + + } + } + /// Severity level per category configuration for PR Annotations. + public partial interface ICategoryConfiguration : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// + /// Rule categories. + /// Code - code scanning results. + /// Artifact scanning results. + /// Dependencies scanning results. + /// IaC results. + /// Secrets scanning results. + /// Container scanning results. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Rule categories. + Code - code scanning results. + Artifact scanning results. + Dependencies scanning results. + IaC results. + Secrets scanning results. + Container scanning results.", + SerializedName = @"category", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Code", "Artifacts", "Dependencies", "Secrets", "IaC", "Containers")] + string Category { get; set; } + /// Gets or sets minimum severity level for a given category. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Gets or sets minimum severity level for a given category.", + SerializedName = @"minimumSeverityLevel", + PossibleTypes = new [] { typeof(string) })] + string MinimumSeverityLevel { get; set; } + + } + /// Severity level per category configuration for PR Annotations. + internal partial interface ICategoryConfigurationInternal + + { + /// + /// Rule categories. + /// Code - code scanning results. + /// Artifact scanning results. + /// Dependencies scanning results. + /// IaC results. + /// Secrets scanning results. + /// Container scanning results. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Code", "Artifacts", "Dependencies", "Secrets", "IaC", "Containers")] + string Category { get; set; } + /// Gets or sets minimum severity level for a given category. + string MinimumSeverityLevel { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/CategoryConfiguration.json.cs b/src/Security/Security.Autorest/generated/api/Models/CategoryConfiguration.json.cs new file mode 100644 index 000000000000..68ca44b7758b --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/CategoryConfiguration.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// Severity level per category configuration for PR Annotations. + public partial class CategoryConfiguration + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal CategoryConfiguration(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_minimumSeverityLevel = If( json?.PropertyT("minimumSeverityLevel"), out var __jsonMinimumSeverityLevel) ? (string)__jsonMinimumSeverityLevel : (string)_minimumSeverityLevel;} + {_category = If( json?.PropertyT("category"), out var __jsonCategory) ? (string)__jsonCategory : (string)_category;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICategoryConfiguration. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICategoryConfiguration. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICategoryConfiguration FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new CategoryConfiguration(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._minimumSeverityLevel)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._minimumSeverityLevel.ToString()) : null, "minimumSeverityLevel" ,container.Add ); + AddIf( null != (((object)this._category)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._category.ToString()) : null, "category" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/CloudError.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/CloudError.PowerShell.cs new file mode 100644 index 000000000000..c64a24a72613 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/CloudError.PowerShell.cs @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows + /// the OData error response format.). + /// + [System.ComponentModel.TypeConverter(typeof(CloudErrorTypeConverter))] + public partial class CloudError + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal CloudError(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorBody) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CloudErrorBodyTypeConverter.ConvertFrom); + } + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorInternal)this).Target, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CloudErrorBodyTypeConverter.ConvertFrom)); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorAdditionalInfoTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal CloudError(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorBody) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CloudErrorBodyTypeConverter.ConvertFrom); + } + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorInternal)this).Target, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CloudErrorBodyTypeConverter.ConvertFrom)); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorAdditionalInfoTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudError DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new CloudError(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudError DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new CloudError(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudError FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows + /// the OData error response format.). + [System.ComponentModel.TypeConverter(typeof(CloudErrorTypeConverter))] + public partial interface ICloudError + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/CloudError.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/CloudError.TypeConverter.cs new file mode 100644 index 000000000000..34cce96ad8c0 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/CloudError.TypeConverter.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class CloudErrorTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudError ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudError).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return CloudError.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return CloudError.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return CloudError.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/CloudError.cs b/src/Security/Security.Autorest/generated/api/Models/CloudError.cs new file mode 100644 index 000000000000..ca226cc54240 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/CloudError.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// + /// Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows + /// the OData error response format.). + /// + public partial class CloudError : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudError, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorInternal + { + + /// The error additional info. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public System.Collections.Generic.List AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorBodyInternal)Error).AdditionalInfo; } + + /// The error code. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorBodyInternal)Error).Code; } + + /// The error details. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public System.Collections.Generic.List Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorBodyInternal)Error).Detail; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorBody _error; + + /// The error object. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorBody Error { get => (this._error = this._error ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CloudErrorBody()); set => this._error = value; } + + /// The error message. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorBodyInternal)Error).Message; } + + /// Internal Acessors for AdditionalInfo + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorInternal.AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorBodyInternal)Error).AdditionalInfo; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorBodyInternal)Error).AdditionalInfo = value; } + + /// Internal Acessors for Code + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorInternal.Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorBodyInternal)Error).Code; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorBodyInternal)Error).Code = value; } + + /// Internal Acessors for Detail + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorInternal.Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorBodyInternal)Error).Detail; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorBodyInternal)Error).Detail = value; } + + /// Internal Acessors for Error + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorBody Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorInternal.Error { get => (this._error = this._error ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CloudErrorBody()); set { {_error = value;} } } + + /// Internal Acessors for Message + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorInternal.Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorBodyInternal)Error).Message; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorBodyInternal)Error).Message = value; } + + /// Internal Acessors for Target + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorInternal.Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorBodyInternal)Error).Target; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorBodyInternal)Error).Target = value; } + + /// The error target. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorBodyInternal)Error).Target; } + + /// Creates an new instance. + public CloudError() + { + + } + } + /// Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows + /// the OData error response format.). + public partial interface ICloudError : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// The error additional info. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The error additional info.", + SerializedName = @"additionalInfo", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorAdditionalInfo) })] + System.Collections.Generic.List AdditionalInfo { get; } + /// The error code. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The error code.", + SerializedName = @"code", + PossibleTypes = new [] { typeof(string) })] + string Code { get; } + /// The error details. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The error details.", + SerializedName = @"details", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorBody) })] + System.Collections.Generic.List Detail { get; } + /// The error message. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The error message.", + SerializedName = @"message", + PossibleTypes = new [] { typeof(string) })] + string Message { get; } + /// The error target. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The error target.", + SerializedName = @"target", + PossibleTypes = new [] { typeof(string) })] + string Target { get; } + + } + /// Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows + /// the OData error response format.). + internal partial interface ICloudErrorInternal + + { + /// The error additional info. + System.Collections.Generic.List AdditionalInfo { get; set; } + /// The error code. + string Code { get; set; } + /// The error details. + System.Collections.Generic.List Detail { get; set; } + /// The error object. + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorBody Error { get; set; } + /// The error message. + string Message { get; set; } + /// The error target. + string Target { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/CloudError.json.cs b/src/Security/Security.Autorest/generated/api/Models/CloudError.json.cs new file mode 100644 index 000000000000..9e0271e5daf9 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/CloudError.json.cs @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// + /// Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows + /// the OData error response format.). + /// + public partial class CloudError + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal CloudError(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_error = If( json?.PropertyT("error"), out var __jsonError) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CloudErrorBody.FromJson(__jsonError) : _error;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudError. + /// + /// a to deserialize from. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudError. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudError FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new CloudError(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._error ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._error.ToJson(null,serializationMode) : null, "error" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/CloudErrorBody.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/CloudErrorBody.PowerShell.cs new file mode 100644 index 000000000000..406e942e99b9 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/CloudErrorBody.PowerShell.cs @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The error detail. + [System.ComponentModel.TypeConverter(typeof(CloudErrorBodyTypeConverter))] + public partial class CloudErrorBody + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal CloudErrorBody(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorBodyInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorBodyInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorBodyInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorBodyInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorBodyInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorBodyInternal)this).Target, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorBodyInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorBodyInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CloudErrorBodyTypeConverter.ConvertFrom)); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorBodyInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorBodyInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorAdditionalInfoTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal CloudErrorBody(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorBodyInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorBodyInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorBodyInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorBodyInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorBodyInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorBodyInternal)this).Target, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorBodyInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorBodyInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CloudErrorBodyTypeConverter.ConvertFrom)); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorBodyInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorBodyInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorAdditionalInfoTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorBody DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new CloudErrorBody(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorBody DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new CloudErrorBody(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorBody FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The error detail. + [System.ComponentModel.TypeConverter(typeof(CloudErrorBodyTypeConverter))] + public partial interface ICloudErrorBody + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/CloudErrorBody.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/CloudErrorBody.TypeConverter.cs new file mode 100644 index 000000000000..bbebdf4aad81 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/CloudErrorBody.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class CloudErrorBodyTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorBody ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorBody).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return CloudErrorBody.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return CloudErrorBody.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return CloudErrorBody.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/CloudErrorBody.cs b/src/Security/Security.Autorest/generated/api/Models/CloudErrorBody.cs new file mode 100644 index 000000000000..aaf1758fbf89 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/CloudErrorBody.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The error detail. + public partial class CloudErrorBody : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorBody, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorBodyInternal + { + + /// Backing field for property. + private System.Collections.Generic.List _additionalInfo; + + /// The error additional info. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public System.Collections.Generic.List AdditionalInfo { get => this._additionalInfo; } + + /// Backing field for property. + private string _code; + + /// The error code. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string Code { get => this._code; } + + /// Backing field for property. + private System.Collections.Generic.List _detail; + + /// The error details. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public System.Collections.Generic.List Detail { get => this._detail; } + + /// Backing field for property. + private string _message; + + /// The error message. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string Message { get => this._message; } + + /// Internal Acessors for AdditionalInfo + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorBodyInternal.AdditionalInfo { get => this._additionalInfo; set { {_additionalInfo = value;} } } + + /// Internal Acessors for Code + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorBodyInternal.Code { get => this._code; set { {_code = value;} } } + + /// Internal Acessors for Detail + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorBodyInternal.Detail { get => this._detail; set { {_detail = value;} } } + + /// Internal Acessors for Message + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorBodyInternal.Message { get => this._message; set { {_message = value;} } } + + /// Internal Acessors for Target + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorBodyInternal.Target { get => this._target; set { {_target = value;} } } + + /// Backing field for property. + private string _target; + + /// The error target. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string Target { get => this._target; } + + /// Creates an new instance. + public CloudErrorBody() + { + + } + } + /// The error detail. + public partial interface ICloudErrorBody : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// The error additional info. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The error additional info.", + SerializedName = @"additionalInfo", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorAdditionalInfo) })] + System.Collections.Generic.List AdditionalInfo { get; } + /// The error code. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The error code.", + SerializedName = @"code", + PossibleTypes = new [] { typeof(string) })] + string Code { get; } + /// The error details. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The error details.", + SerializedName = @"details", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorBody) })] + System.Collections.Generic.List Detail { get; } + /// The error message. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The error message.", + SerializedName = @"message", + PossibleTypes = new [] { typeof(string) })] + string Message { get; } + /// The error target. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The error target.", + SerializedName = @"target", + PossibleTypes = new [] { typeof(string) })] + string Target { get; } + + } + /// The error detail. + internal partial interface ICloudErrorBodyInternal + + { + /// The error additional info. + System.Collections.Generic.List AdditionalInfo { get; set; } + /// The error code. + string Code { get; set; } + /// The error details. + System.Collections.Generic.List Detail { get; set; } + /// The error message. + string Message { get; set; } + /// The error target. + string Target { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/CloudErrorBody.json.cs b/src/Security/Security.Autorest/generated/api/Models/CloudErrorBody.json.cs new file mode 100644 index 000000000000..ad0e94ec831f --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/CloudErrorBody.json.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The error detail. + public partial class CloudErrorBody + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal CloudErrorBody(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_code = If( json?.PropertyT("code"), out var __jsonCode) ? (string)__jsonCode : (string)_code;} + {_message = If( json?.PropertyT("message"), out var __jsonMessage) ? (string)__jsonMessage : (string)_message;} + {_target = If( json?.PropertyT("target"), out var __jsonTarget) ? (string)__jsonTarget : (string)_target;} + {_detail = If( json?.PropertyT("details"), out var __jsonDetails) ? If( __jsonDetails as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorBody) (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CloudErrorBody.FromJson(__u) )) ))() : null : _detail;} + {_additionalInfo = If( json?.PropertyT("additionalInfo"), out var __jsonAdditionalInfo) ? If( __jsonAdditionalInfo as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonArray, out var __q) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__q, (__p)=>(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorAdditionalInfo) (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorAdditionalInfo.FromJson(__p) )) ))() : null : _additionalInfo;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorBody. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorBody. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudErrorBody FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new CloudErrorBody(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._code)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._code.ToString()) : null, "code" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._message)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._message.ToString()) : null, "message" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._target)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._target.ToString()) : null, "target" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + if (null != this._detail) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.XNodeArray(); + foreach( var __x in this._detail ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("details",__w); + } + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + if (null != this._additionalInfo) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.XNodeArray(); + foreach( var __s in this._additionalInfo ) + { + AddIf(__s?.ToJson(null, serializationMode) ,__r.Add); + } + container.Add("additionalInfo",__r); + } + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/CloudOffering.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/CloudOffering.PowerShell.cs new file mode 100644 index 000000000000..fa8039d074df --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/CloudOffering.PowerShell.cs @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The security offering details + [System.ComponentModel.TypeConverter(typeof(CloudOfferingTypeConverter))] + public partial class CloudOffering + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal CloudOffering(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("OfferingType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType = (string) content.GetValueForProperty("OfferingType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType, global::System.Convert.ToString); + } + if (content.Contains("Description")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal CloudOffering(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("OfferingType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType = (string) content.GetValueForProperty("OfferingType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType, global::System.Convert.ToString); + } + if (content.Contains("Description")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOffering DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new CloudOffering(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOffering DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new CloudOffering(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOffering FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The security offering details + [System.ComponentModel.TypeConverter(typeof(CloudOfferingTypeConverter))] + public partial interface ICloudOffering + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/CloudOffering.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/CloudOffering.TypeConverter.cs new file mode 100644 index 000000000000..77e0b1e91203 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/CloudOffering.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class CloudOfferingTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOffering ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOffering).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return CloudOffering.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return CloudOffering.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return CloudOffering.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/CloudOffering.cs b/src/Security/Security.Autorest/generated/api/Models/CloudOffering.cs new file mode 100644 index 000000000000..2aa554cdc357 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/CloudOffering.cs @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The security offering details + public partial class CloudOffering : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOffering, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal + { + + /// Backing field for property. + private string _description; + + /// The offering description. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string Description { get => this._description; } + + /// Internal Acessors for Description + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal.Description { get => this._description; set { {_description = value;} } } + + /// Backing field for property. + private string _offeringType; + + /// The type of the security offering. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string OfferingType { get => this._offeringType; set => this._offeringType = value; } + + /// Creates an new instance. + public CloudOffering() + { + + } + } + /// The security offering details + public partial interface ICloudOffering : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// The offering description. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The offering description.", + SerializedName = @"description", + PossibleTypes = new [] { typeof(string) })] + string Description { get; } + /// The type of the security offering. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The type of the security offering.", + SerializedName = @"offeringType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("CspmMonitorAws", "DefenderForContainersAws", "DefenderForServersAws", "DefenderForDatabasesAws", "InformationProtectionAws", "CspmMonitorGcp", "CspmMonitorGithub", "CspmMonitorAzureDevOps", "DefenderForServersGcp", "DefenderForContainersGcp", "DefenderForDatabasesGcp", "DefenderCspmAws", "DefenderCspmGcp", "DefenderForDevOpsGithub", "DefenderForDevOpsAzureDevOps", "CspmMonitorGitLab", "DefenderForDevOpsGitLab")] + string OfferingType { get; set; } + + } + /// The security offering details + internal partial interface ICloudOfferingInternal + + { + /// The offering description. + string Description { get; set; } + /// The type of the security offering. + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("CspmMonitorAws", "DefenderForContainersAws", "DefenderForServersAws", "DefenderForDatabasesAws", "InformationProtectionAws", "CspmMonitorGcp", "CspmMonitorGithub", "CspmMonitorAzureDevOps", "DefenderForServersGcp", "DefenderForContainersGcp", "DefenderForDatabasesGcp", "DefenderCspmAws", "DefenderCspmGcp", "DefenderForDevOpsGithub", "DefenderForDevOpsAzureDevOps", "CspmMonitorGitLab", "DefenderForDevOpsGitLab")] + string OfferingType { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/CloudOffering.json.cs b/src/Security/Security.Autorest/generated/api/Models/CloudOffering.json.cs new file mode 100644 index 000000000000..6d2ef8b2faac --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/CloudOffering.json.cs @@ -0,0 +1,192 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The security offering details + public partial class CloudOffering + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal CloudOffering(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_offeringType = If( json?.PropertyT("offeringType"), out var __jsonOfferingType) ? (string)__jsonOfferingType : (string)_offeringType;} + {_description = If( json?.PropertyT("description"), out var __jsonDescription) ? (string)__jsonDescription : (string)_description;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOffering. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOffering interface is polymorphic, and the precise + /// model class that will get deserialized is determined at runtime based on the payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOffering. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOffering FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("offeringType") ) + { + case "CspmMonitorAws": + { + return new CspmMonitorAwsOffering(json); + } + case "DefenderForContainersAws": + { + return new DefenderForContainersAwsOffering(json); + } + case "DefenderForServersAws": + { + return new DefenderForServersAwsOffering(json); + } + case "DefenderForDatabasesAws": + { + return new DefenderForDatabasesAwsOffering(json); + } + case "InformationProtectionAws": + { + return new InformationProtectionAwsOffering(json); + } + case "CspmMonitorGcp": + { + return new CspmMonitorGcpOffering(json); + } + case "DefenderForServersGcp": + { + return new DefenderForServersGcpOffering(json); + } + case "DefenderForDatabasesGcp": + { + return new DefenderForDatabasesGcpOffering(json); + } + case "DefenderForContainersGcp": + { + return new DefenderForContainersGcpOffering(json); + } + case "CspmMonitorGithub": + { + return new CspmMonitorGithubOffering(json); + } + case "CspmMonitorAzureDevOps": + { + return new CspmMonitorAzureDevOpsOffering(json); + } + case "DefenderCspmAws": + { + return new DefenderCspmAwsOffering(json); + } + case "DefenderCspmGcp": + { + return new DefenderCspmGcpOffering(json); + } + case "DefenderForDevOpsGithub": + { + return new DefenderForDevOpsGithubOffering(json); + } + case "DefenderForDevOpsAzureDevOps": + { + return new DefenderForDevOpsAzureDevOpsOffering(json); + } + case "CspmMonitorGitLab": + { + return new CspmMonitorGitLabOffering(json); + } + case "DefenderForDevOpsGitLab": + { + return new DefenderForDevOpsGitLabOffering(json); + } + } + return new CloudOffering(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._offeringType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._offeringType.ToString()) : null, "offeringType" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._description)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._description.ToString()) : null, "description" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/CspmMonitorAwsOffering.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/CspmMonitorAwsOffering.PowerShell.cs new file mode 100644 index 000000000000..7ffd24b1dbb5 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/CspmMonitorAwsOffering.PowerShell.cs @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The CSPM monitoring for AWS offering + [System.ComponentModel.TypeConverter(typeof(CspmMonitorAwsOfferingTypeConverter))] + public partial class CspmMonitorAwsOffering + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal CspmMonitorAwsOffering(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("NativeCloudConnection")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorAwsOfferingInternal)this).NativeCloudConnection = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorAwsOfferingNativeCloudConnection) content.GetValueForProperty("NativeCloudConnection",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorAwsOfferingInternal)this).NativeCloudConnection, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CspmMonitorAwsOfferingNativeCloudConnectionTypeConverter.ConvertFrom); + } + if (content.Contains("OfferingType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType = (string) content.GetValueForProperty("OfferingType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType, global::System.Convert.ToString); + } + if (content.Contains("Description")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description, global::System.Convert.ToString); + } + if (content.Contains("NativeCloudConnectionCloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorAwsOfferingInternal)this).NativeCloudConnectionCloudRoleArn = (string) content.GetValueForProperty("NativeCloudConnectionCloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorAwsOfferingInternal)this).NativeCloudConnectionCloudRoleArn, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal CspmMonitorAwsOffering(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("NativeCloudConnection")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorAwsOfferingInternal)this).NativeCloudConnection = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorAwsOfferingNativeCloudConnection) content.GetValueForProperty("NativeCloudConnection",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorAwsOfferingInternal)this).NativeCloudConnection, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CspmMonitorAwsOfferingNativeCloudConnectionTypeConverter.ConvertFrom); + } + if (content.Contains("OfferingType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType = (string) content.GetValueForProperty("OfferingType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType, global::System.Convert.ToString); + } + if (content.Contains("Description")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description, global::System.Convert.ToString); + } + if (content.Contains("NativeCloudConnectionCloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorAwsOfferingInternal)this).NativeCloudConnectionCloudRoleArn = (string) content.GetValueForProperty("NativeCloudConnectionCloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorAwsOfferingInternal)this).NativeCloudConnectionCloudRoleArn, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorAwsOffering DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new CspmMonitorAwsOffering(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorAwsOffering DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new CspmMonitorAwsOffering(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorAwsOffering FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The CSPM monitoring for AWS offering + [System.ComponentModel.TypeConverter(typeof(CspmMonitorAwsOfferingTypeConverter))] + public partial interface ICspmMonitorAwsOffering + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/CspmMonitorAwsOffering.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/CspmMonitorAwsOffering.TypeConverter.cs new file mode 100644 index 000000000000..ef0a6af7121f --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/CspmMonitorAwsOffering.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class CspmMonitorAwsOfferingTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorAwsOffering ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorAwsOffering).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return CspmMonitorAwsOffering.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return CspmMonitorAwsOffering.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return CspmMonitorAwsOffering.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/CspmMonitorAwsOffering.cs b/src/Security/Security.Autorest/generated/api/Models/CspmMonitorAwsOffering.cs new file mode 100644 index 000000000000..53efab8f2a21 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/CspmMonitorAwsOffering.cs @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The CSPM monitoring for AWS offering + public partial class CspmMonitorAwsOffering : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorAwsOffering, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorAwsOfferingInternal, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOffering __cloudOffering = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CloudOffering(); + + /// The offering description. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string Description { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)__cloudOffering).Description; } + + /// Internal Acessors for Description + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal.Description { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)__cloudOffering).Description; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)__cloudOffering).Description = value; } + + /// Internal Acessors for NativeCloudConnection + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorAwsOfferingNativeCloudConnection Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorAwsOfferingInternal.NativeCloudConnection { get => (this._nativeCloudConnection = this._nativeCloudConnection ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CspmMonitorAwsOfferingNativeCloudConnection()); set { {_nativeCloudConnection = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorAwsOfferingNativeCloudConnection _nativeCloudConnection; + + /// The native cloud connection configuration + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorAwsOfferingNativeCloudConnection NativeCloudConnection { get => (this._nativeCloudConnection = this._nativeCloudConnection ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CspmMonitorAwsOfferingNativeCloudConnection()); set => this._nativeCloudConnection = value; } + + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string NativeCloudConnectionCloudRoleArn { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorAwsOfferingNativeCloudConnectionInternal)NativeCloudConnection).CloudRoleArn; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorAwsOfferingNativeCloudConnectionInternal)NativeCloudConnection).CloudRoleArn = value ?? null; } + + /// The type of the security offering. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Constant] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string OfferingType { get => "CspmMonitorAws"; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)__cloudOffering).OfferingType = "CspmMonitorAws"; } + + /// Creates an new instance. + public CspmMonitorAwsOffering() + { + this.__cloudOffering.OfferingType = "CspmMonitorAws"; + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__cloudOffering), __cloudOffering); + await eventListener.AssertObjectIsValid(nameof(__cloudOffering), __cloudOffering); + } + } + /// The CSPM monitoring for AWS offering + public partial interface ICspmMonitorAwsOffering : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOffering + { + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The cloud role ARN in AWS for this feature", + SerializedName = @"cloudRoleArn", + PossibleTypes = new [] { typeof(string) })] + string NativeCloudConnectionCloudRoleArn { get; set; } + + } + /// The CSPM monitoring for AWS offering + internal partial interface ICspmMonitorAwsOfferingInternal : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal + { + /// The native cloud connection configuration + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorAwsOfferingNativeCloudConnection NativeCloudConnection { get; set; } + /// The cloud role ARN in AWS for this feature + string NativeCloudConnectionCloudRoleArn { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/CspmMonitorAwsOffering.json.cs b/src/Security/Security.Autorest/generated/api/Models/CspmMonitorAwsOffering.json.cs new file mode 100644 index 000000000000..a2c482b66db9 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/CspmMonitorAwsOffering.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The CSPM monitoring for AWS offering + public partial class CspmMonitorAwsOffering + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal CspmMonitorAwsOffering(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __cloudOffering = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CloudOffering(json); + {_nativeCloudConnection = If( json?.PropertyT("nativeCloudConnection"), out var __jsonNativeCloudConnection) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CspmMonitorAwsOfferingNativeCloudConnection.FromJson(__jsonNativeCloudConnection) : _nativeCloudConnection;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorAwsOffering. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorAwsOffering. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorAwsOffering FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new CspmMonitorAwsOffering(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __cloudOffering?.ToJson(container, serializationMode); + AddIf( null != this._nativeCloudConnection ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._nativeCloudConnection.ToJson(null,serializationMode) : null, "nativeCloudConnection" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/CspmMonitorAwsOfferingNativeCloudConnection.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/CspmMonitorAwsOfferingNativeCloudConnection.PowerShell.cs new file mode 100644 index 000000000000..fb70aa024c73 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/CspmMonitorAwsOfferingNativeCloudConnection.PowerShell.cs @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The native cloud connection configuration + [System.ComponentModel.TypeConverter(typeof(CspmMonitorAwsOfferingNativeCloudConnectionTypeConverter))] + public partial class CspmMonitorAwsOfferingNativeCloudConnection + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal CspmMonitorAwsOfferingNativeCloudConnection(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorAwsOfferingNativeCloudConnectionInternal)this).CloudRoleArn = (string) content.GetValueForProperty("CloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorAwsOfferingNativeCloudConnectionInternal)this).CloudRoleArn, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal CspmMonitorAwsOfferingNativeCloudConnection(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorAwsOfferingNativeCloudConnectionInternal)this).CloudRoleArn = (string) content.GetValueForProperty("CloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorAwsOfferingNativeCloudConnectionInternal)this).CloudRoleArn, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorAwsOfferingNativeCloudConnection DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new CspmMonitorAwsOfferingNativeCloudConnection(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorAwsOfferingNativeCloudConnection DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new CspmMonitorAwsOfferingNativeCloudConnection(content); + } + + /// + /// Creates a new instance of , deserializing the content from a + /// json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorAwsOfferingNativeCloudConnection FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The native cloud connection configuration + [System.ComponentModel.TypeConverter(typeof(CspmMonitorAwsOfferingNativeCloudConnectionTypeConverter))] + public partial interface ICspmMonitorAwsOfferingNativeCloudConnection + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/CspmMonitorAwsOfferingNativeCloudConnection.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/CspmMonitorAwsOfferingNativeCloudConnection.TypeConverter.cs new file mode 100644 index 000000000000..9a4f2c60ed0b --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/CspmMonitorAwsOfferingNativeCloudConnection.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class CspmMonitorAwsOfferingNativeCloudConnectionTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorAwsOfferingNativeCloudConnection ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorAwsOfferingNativeCloudConnection).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return CspmMonitorAwsOfferingNativeCloudConnection.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return CspmMonitorAwsOfferingNativeCloudConnection.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return CspmMonitorAwsOfferingNativeCloudConnection.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/CspmMonitorAwsOfferingNativeCloudConnection.cs b/src/Security/Security.Autorest/generated/api/Models/CspmMonitorAwsOfferingNativeCloudConnection.cs new file mode 100644 index 000000000000..dc006ff0d08f --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/CspmMonitorAwsOfferingNativeCloudConnection.cs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The native cloud connection configuration + public partial class CspmMonitorAwsOfferingNativeCloudConnection : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorAwsOfferingNativeCloudConnection, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorAwsOfferingNativeCloudConnectionInternal + { + + /// Backing field for property. + private string _cloudRoleArn; + + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string CloudRoleArn { get => this._cloudRoleArn; set => this._cloudRoleArn = value; } + + /// + /// Creates an new instance. + /// + public CspmMonitorAwsOfferingNativeCloudConnection() + { + + } + } + /// The native cloud connection configuration + public partial interface ICspmMonitorAwsOfferingNativeCloudConnection : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The cloud role ARN in AWS for this feature", + SerializedName = @"cloudRoleArn", + PossibleTypes = new [] { typeof(string) })] + string CloudRoleArn { get; set; } + + } + /// The native cloud connection configuration + internal partial interface ICspmMonitorAwsOfferingNativeCloudConnectionInternal + + { + /// The cloud role ARN in AWS for this feature + string CloudRoleArn { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/CspmMonitorAwsOfferingNativeCloudConnection.json.cs b/src/Security/Security.Autorest/generated/api/Models/CspmMonitorAwsOfferingNativeCloudConnection.json.cs new file mode 100644 index 000000000000..431cf02f5314 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/CspmMonitorAwsOfferingNativeCloudConnection.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The native cloud connection configuration + public partial class CspmMonitorAwsOfferingNativeCloudConnection + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal CspmMonitorAwsOfferingNativeCloudConnection(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_cloudRoleArn = If( json?.PropertyT("cloudRoleArn"), out var __jsonCloudRoleArn) ? (string)__jsonCloudRoleArn : (string)_cloudRoleArn;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorAwsOfferingNativeCloudConnection. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorAwsOfferingNativeCloudConnection. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorAwsOfferingNativeCloudConnection FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new CspmMonitorAwsOfferingNativeCloudConnection(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._cloudRoleArn)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._cloudRoleArn.ToString()) : null, "cloudRoleArn" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/CspmMonitorAzureDevOpsOffering.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/CspmMonitorAzureDevOpsOffering.PowerShell.cs new file mode 100644 index 000000000000..a6642cc844ca --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/CspmMonitorAzureDevOpsOffering.PowerShell.cs @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The CSPM monitoring for AzureDevOps offering + [System.ComponentModel.TypeConverter(typeof(CspmMonitorAzureDevOpsOfferingTypeConverter))] + public partial class CspmMonitorAzureDevOpsOffering + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal CspmMonitorAzureDevOpsOffering(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("OfferingType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType = (string) content.GetValueForProperty("OfferingType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType, global::System.Convert.ToString); + } + if (content.Contains("Description")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal CspmMonitorAzureDevOpsOffering(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("OfferingType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType = (string) content.GetValueForProperty("OfferingType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType, global::System.Convert.ToString); + } + if (content.Contains("Description")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorAzureDevOpsOffering DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new CspmMonitorAzureDevOpsOffering(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorAzureDevOpsOffering DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new CspmMonitorAzureDevOpsOffering(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorAzureDevOpsOffering FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The CSPM monitoring for AzureDevOps offering + [System.ComponentModel.TypeConverter(typeof(CspmMonitorAzureDevOpsOfferingTypeConverter))] + public partial interface ICspmMonitorAzureDevOpsOffering + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/CspmMonitorAzureDevOpsOffering.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/CspmMonitorAzureDevOpsOffering.TypeConverter.cs new file mode 100644 index 000000000000..6d452866d500 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/CspmMonitorAzureDevOpsOffering.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class CspmMonitorAzureDevOpsOfferingTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorAzureDevOpsOffering ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorAzureDevOpsOffering).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return CspmMonitorAzureDevOpsOffering.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return CspmMonitorAzureDevOpsOffering.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return CspmMonitorAzureDevOpsOffering.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/CspmMonitorAzureDevOpsOffering.cs b/src/Security/Security.Autorest/generated/api/Models/CspmMonitorAzureDevOpsOffering.cs new file mode 100644 index 000000000000..bda86286e8d7 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/CspmMonitorAzureDevOpsOffering.cs @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The CSPM monitoring for AzureDevOps offering + public partial class CspmMonitorAzureDevOpsOffering : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorAzureDevOpsOffering, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorAzureDevOpsOfferingInternal, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOffering __cloudOffering = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CloudOffering(); + + /// The offering description. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string Description { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)__cloudOffering).Description; } + + /// Internal Acessors for Description + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal.Description { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)__cloudOffering).Description; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)__cloudOffering).Description = value; } + + /// The type of the security offering. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Constant] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string OfferingType { get => "CspmMonitorAzureDevOps"; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)__cloudOffering).OfferingType = "CspmMonitorAzureDevOps"; } + + /// Creates an new instance. + public CspmMonitorAzureDevOpsOffering() + { + this.__cloudOffering.OfferingType = "CspmMonitorAzureDevOps"; + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__cloudOffering), __cloudOffering); + await eventListener.AssertObjectIsValid(nameof(__cloudOffering), __cloudOffering); + } + } + /// The CSPM monitoring for AzureDevOps offering + public partial interface ICspmMonitorAzureDevOpsOffering : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOffering + { + + } + /// The CSPM monitoring for AzureDevOps offering + internal partial interface ICspmMonitorAzureDevOpsOfferingInternal : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/CspmMonitorAzureDevOpsOffering.json.cs b/src/Security/Security.Autorest/generated/api/Models/CspmMonitorAzureDevOpsOffering.json.cs new file mode 100644 index 000000000000..01420819cf46 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/CspmMonitorAzureDevOpsOffering.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The CSPM monitoring for AzureDevOps offering + public partial class CspmMonitorAzureDevOpsOffering + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal CspmMonitorAzureDevOpsOffering(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __cloudOffering = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CloudOffering(json); + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorAzureDevOpsOffering. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorAzureDevOpsOffering. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorAzureDevOpsOffering FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new CspmMonitorAzureDevOpsOffering(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __cloudOffering?.ToJson(container, serializationMode); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/CspmMonitorGcpOffering.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/CspmMonitorGcpOffering.PowerShell.cs new file mode 100644 index 000000000000..748d9dee8226 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/CspmMonitorGcpOffering.PowerShell.cs @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The CSPM monitoring for GCP offering + [System.ComponentModel.TypeConverter(typeof(CspmMonitorGcpOfferingTypeConverter))] + public partial class CspmMonitorGcpOffering + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal CspmMonitorGcpOffering(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("NativeCloudConnection")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGcpOfferingInternal)this).NativeCloudConnection = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGcpOfferingNativeCloudConnection) content.GetValueForProperty("NativeCloudConnection",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGcpOfferingInternal)this).NativeCloudConnection, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CspmMonitorGcpOfferingNativeCloudConnectionTypeConverter.ConvertFrom); + } + if (content.Contains("OfferingType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType = (string) content.GetValueForProperty("OfferingType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType, global::System.Convert.ToString); + } + if (content.Contains("Description")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description, global::System.Convert.ToString); + } + if (content.Contains("NativeCloudConnectionWorkloadIdentityProviderId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGcpOfferingInternal)this).NativeCloudConnectionWorkloadIdentityProviderId = (string) content.GetValueForProperty("NativeCloudConnectionWorkloadIdentityProviderId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGcpOfferingInternal)this).NativeCloudConnectionWorkloadIdentityProviderId, global::System.Convert.ToString); + } + if (content.Contains("NativeCloudConnectionServiceAccountEmailAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGcpOfferingInternal)this).NativeCloudConnectionServiceAccountEmailAddress = (string) content.GetValueForProperty("NativeCloudConnectionServiceAccountEmailAddress",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGcpOfferingInternal)this).NativeCloudConnectionServiceAccountEmailAddress, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal CspmMonitorGcpOffering(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("NativeCloudConnection")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGcpOfferingInternal)this).NativeCloudConnection = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGcpOfferingNativeCloudConnection) content.GetValueForProperty("NativeCloudConnection",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGcpOfferingInternal)this).NativeCloudConnection, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CspmMonitorGcpOfferingNativeCloudConnectionTypeConverter.ConvertFrom); + } + if (content.Contains("OfferingType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType = (string) content.GetValueForProperty("OfferingType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType, global::System.Convert.ToString); + } + if (content.Contains("Description")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description, global::System.Convert.ToString); + } + if (content.Contains("NativeCloudConnectionWorkloadIdentityProviderId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGcpOfferingInternal)this).NativeCloudConnectionWorkloadIdentityProviderId = (string) content.GetValueForProperty("NativeCloudConnectionWorkloadIdentityProviderId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGcpOfferingInternal)this).NativeCloudConnectionWorkloadIdentityProviderId, global::System.Convert.ToString); + } + if (content.Contains("NativeCloudConnectionServiceAccountEmailAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGcpOfferingInternal)this).NativeCloudConnectionServiceAccountEmailAddress = (string) content.GetValueForProperty("NativeCloudConnectionServiceAccountEmailAddress",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGcpOfferingInternal)this).NativeCloudConnectionServiceAccountEmailAddress, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGcpOffering DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new CspmMonitorGcpOffering(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGcpOffering DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new CspmMonitorGcpOffering(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGcpOffering FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The CSPM monitoring for GCP offering + [System.ComponentModel.TypeConverter(typeof(CspmMonitorGcpOfferingTypeConverter))] + public partial interface ICspmMonitorGcpOffering + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/CspmMonitorGcpOffering.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/CspmMonitorGcpOffering.TypeConverter.cs new file mode 100644 index 000000000000..fd790bf007c2 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/CspmMonitorGcpOffering.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class CspmMonitorGcpOfferingTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGcpOffering ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGcpOffering).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return CspmMonitorGcpOffering.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return CspmMonitorGcpOffering.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return CspmMonitorGcpOffering.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/CspmMonitorGcpOffering.cs b/src/Security/Security.Autorest/generated/api/Models/CspmMonitorGcpOffering.cs new file mode 100644 index 000000000000..9e055a61ea6c --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/CspmMonitorGcpOffering.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The CSPM monitoring for GCP offering + public partial class CspmMonitorGcpOffering : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGcpOffering, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGcpOfferingInternal, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOffering __cloudOffering = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CloudOffering(); + + /// The offering description. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string Description { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)__cloudOffering).Description; } + + /// Internal Acessors for Description + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal.Description { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)__cloudOffering).Description; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)__cloudOffering).Description = value; } + + /// Internal Acessors for NativeCloudConnection + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGcpOfferingNativeCloudConnection Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGcpOfferingInternal.NativeCloudConnection { get => (this._nativeCloudConnection = this._nativeCloudConnection ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CspmMonitorGcpOfferingNativeCloudConnection()); set { {_nativeCloudConnection = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGcpOfferingNativeCloudConnection _nativeCloudConnection; + + /// The native cloud connection configuration + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGcpOfferingNativeCloudConnection NativeCloudConnection { get => (this._nativeCloudConnection = this._nativeCloudConnection ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CspmMonitorGcpOfferingNativeCloudConnection()); set => this._nativeCloudConnection = value; } + + /// The service account email address in GCP for this offering + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string NativeCloudConnectionServiceAccountEmailAddress { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGcpOfferingNativeCloudConnectionInternal)NativeCloudConnection).ServiceAccountEmailAddress; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGcpOfferingNativeCloudConnectionInternal)NativeCloudConnection).ServiceAccountEmailAddress = value ?? null; } + + /// The GCP workload identity provider id for the offering + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string NativeCloudConnectionWorkloadIdentityProviderId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGcpOfferingNativeCloudConnectionInternal)NativeCloudConnection).WorkloadIdentityProviderId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGcpOfferingNativeCloudConnectionInternal)NativeCloudConnection).WorkloadIdentityProviderId = value ?? null; } + + /// The type of the security offering. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Constant] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string OfferingType { get => "CspmMonitorGcp"; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)__cloudOffering).OfferingType = "CspmMonitorGcp"; } + + /// Creates an new instance. + public CspmMonitorGcpOffering() + { + this.__cloudOffering.OfferingType = "CspmMonitorGcp"; + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__cloudOffering), __cloudOffering); + await eventListener.AssertObjectIsValid(nameof(__cloudOffering), __cloudOffering); + } + } + /// The CSPM monitoring for GCP offering + public partial interface ICspmMonitorGcpOffering : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOffering + { + /// The service account email address in GCP for this offering + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The service account email address in GCP for this offering", + SerializedName = @"serviceAccountEmailAddress", + PossibleTypes = new [] { typeof(string) })] + string NativeCloudConnectionServiceAccountEmailAddress { get; set; } + /// The GCP workload identity provider id for the offering + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The GCP workload identity provider id for the offering", + SerializedName = @"workloadIdentityProviderId", + PossibleTypes = new [] { typeof(string) })] + string NativeCloudConnectionWorkloadIdentityProviderId { get; set; } + + } + /// The CSPM monitoring for GCP offering + internal partial interface ICspmMonitorGcpOfferingInternal : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal + { + /// The native cloud connection configuration + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGcpOfferingNativeCloudConnection NativeCloudConnection { get; set; } + /// The service account email address in GCP for this offering + string NativeCloudConnectionServiceAccountEmailAddress { get; set; } + /// The GCP workload identity provider id for the offering + string NativeCloudConnectionWorkloadIdentityProviderId { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/CspmMonitorGcpOffering.json.cs b/src/Security/Security.Autorest/generated/api/Models/CspmMonitorGcpOffering.json.cs new file mode 100644 index 000000000000..a99f6e5f928f --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/CspmMonitorGcpOffering.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The CSPM monitoring for GCP offering + public partial class CspmMonitorGcpOffering + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal CspmMonitorGcpOffering(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __cloudOffering = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CloudOffering(json); + {_nativeCloudConnection = If( json?.PropertyT("nativeCloudConnection"), out var __jsonNativeCloudConnection) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CspmMonitorGcpOfferingNativeCloudConnection.FromJson(__jsonNativeCloudConnection) : _nativeCloudConnection;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGcpOffering. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGcpOffering. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGcpOffering FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new CspmMonitorGcpOffering(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __cloudOffering?.ToJson(container, serializationMode); + AddIf( null != this._nativeCloudConnection ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._nativeCloudConnection.ToJson(null,serializationMode) : null, "nativeCloudConnection" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/CspmMonitorGcpOfferingNativeCloudConnection.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/CspmMonitorGcpOfferingNativeCloudConnection.PowerShell.cs new file mode 100644 index 000000000000..43c75b955d46 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/CspmMonitorGcpOfferingNativeCloudConnection.PowerShell.cs @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The native cloud connection configuration + [System.ComponentModel.TypeConverter(typeof(CspmMonitorGcpOfferingNativeCloudConnectionTypeConverter))] + public partial class CspmMonitorGcpOfferingNativeCloudConnection + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal CspmMonitorGcpOfferingNativeCloudConnection(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("WorkloadIdentityProviderId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGcpOfferingNativeCloudConnectionInternal)this).WorkloadIdentityProviderId = (string) content.GetValueForProperty("WorkloadIdentityProviderId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGcpOfferingNativeCloudConnectionInternal)this).WorkloadIdentityProviderId, global::System.Convert.ToString); + } + if (content.Contains("ServiceAccountEmailAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGcpOfferingNativeCloudConnectionInternal)this).ServiceAccountEmailAddress = (string) content.GetValueForProperty("ServiceAccountEmailAddress",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGcpOfferingNativeCloudConnectionInternal)this).ServiceAccountEmailAddress, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal CspmMonitorGcpOfferingNativeCloudConnection(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("WorkloadIdentityProviderId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGcpOfferingNativeCloudConnectionInternal)this).WorkloadIdentityProviderId = (string) content.GetValueForProperty("WorkloadIdentityProviderId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGcpOfferingNativeCloudConnectionInternal)this).WorkloadIdentityProviderId, global::System.Convert.ToString); + } + if (content.Contains("ServiceAccountEmailAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGcpOfferingNativeCloudConnectionInternal)this).ServiceAccountEmailAddress = (string) content.GetValueForProperty("ServiceAccountEmailAddress",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGcpOfferingNativeCloudConnectionInternal)this).ServiceAccountEmailAddress, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGcpOfferingNativeCloudConnection DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new CspmMonitorGcpOfferingNativeCloudConnection(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGcpOfferingNativeCloudConnection DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new CspmMonitorGcpOfferingNativeCloudConnection(content); + } + + /// + /// Creates a new instance of , deserializing the content from a + /// json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGcpOfferingNativeCloudConnection FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The native cloud connection configuration + [System.ComponentModel.TypeConverter(typeof(CspmMonitorGcpOfferingNativeCloudConnectionTypeConverter))] + public partial interface ICspmMonitorGcpOfferingNativeCloudConnection + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/CspmMonitorGcpOfferingNativeCloudConnection.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/CspmMonitorGcpOfferingNativeCloudConnection.TypeConverter.cs new file mode 100644 index 000000000000..82a0f1562c46 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/CspmMonitorGcpOfferingNativeCloudConnection.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class CspmMonitorGcpOfferingNativeCloudConnectionTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGcpOfferingNativeCloudConnection ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGcpOfferingNativeCloudConnection).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return CspmMonitorGcpOfferingNativeCloudConnection.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return CspmMonitorGcpOfferingNativeCloudConnection.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return CspmMonitorGcpOfferingNativeCloudConnection.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/CspmMonitorGcpOfferingNativeCloudConnection.cs b/src/Security/Security.Autorest/generated/api/Models/CspmMonitorGcpOfferingNativeCloudConnection.cs new file mode 100644 index 000000000000..df4e420fed17 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/CspmMonitorGcpOfferingNativeCloudConnection.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The native cloud connection configuration + public partial class CspmMonitorGcpOfferingNativeCloudConnection : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGcpOfferingNativeCloudConnection, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGcpOfferingNativeCloudConnectionInternal + { + + /// Backing field for property. + private string _serviceAccountEmailAddress; + + /// The service account email address in GCP for this offering + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string ServiceAccountEmailAddress { get => this._serviceAccountEmailAddress; set => this._serviceAccountEmailAddress = value; } + + /// Backing field for property. + private string _workloadIdentityProviderId; + + /// The GCP workload identity provider id for the offering + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string WorkloadIdentityProviderId { get => this._workloadIdentityProviderId; set => this._workloadIdentityProviderId = value; } + + /// + /// Creates an new instance. + /// + public CspmMonitorGcpOfferingNativeCloudConnection() + { + + } + } + /// The native cloud connection configuration + public partial interface ICspmMonitorGcpOfferingNativeCloudConnection : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// The service account email address in GCP for this offering + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The service account email address in GCP for this offering", + SerializedName = @"serviceAccountEmailAddress", + PossibleTypes = new [] { typeof(string) })] + string ServiceAccountEmailAddress { get; set; } + /// The GCP workload identity provider id for the offering + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The GCP workload identity provider id for the offering", + SerializedName = @"workloadIdentityProviderId", + PossibleTypes = new [] { typeof(string) })] + string WorkloadIdentityProviderId { get; set; } + + } + /// The native cloud connection configuration + internal partial interface ICspmMonitorGcpOfferingNativeCloudConnectionInternal + + { + /// The service account email address in GCP for this offering + string ServiceAccountEmailAddress { get; set; } + /// The GCP workload identity provider id for the offering + string WorkloadIdentityProviderId { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/CspmMonitorGcpOfferingNativeCloudConnection.json.cs b/src/Security/Security.Autorest/generated/api/Models/CspmMonitorGcpOfferingNativeCloudConnection.json.cs new file mode 100644 index 000000000000..1c8033bfd6f8 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/CspmMonitorGcpOfferingNativeCloudConnection.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The native cloud connection configuration + public partial class CspmMonitorGcpOfferingNativeCloudConnection + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal CspmMonitorGcpOfferingNativeCloudConnection(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_workloadIdentityProviderId = If( json?.PropertyT("workloadIdentityProviderId"), out var __jsonWorkloadIdentityProviderId) ? (string)__jsonWorkloadIdentityProviderId : (string)_workloadIdentityProviderId;} + {_serviceAccountEmailAddress = If( json?.PropertyT("serviceAccountEmailAddress"), out var __jsonServiceAccountEmailAddress) ? (string)__jsonServiceAccountEmailAddress : (string)_serviceAccountEmailAddress;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGcpOfferingNativeCloudConnection. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGcpOfferingNativeCloudConnection. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGcpOfferingNativeCloudConnection FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new CspmMonitorGcpOfferingNativeCloudConnection(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._workloadIdentityProviderId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._workloadIdentityProviderId.ToString()) : null, "workloadIdentityProviderId" ,container.Add ); + AddIf( null != (((object)this._serviceAccountEmailAddress)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._serviceAccountEmailAddress.ToString()) : null, "serviceAccountEmailAddress" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/CspmMonitorGitLabOffering.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/CspmMonitorGitLabOffering.PowerShell.cs new file mode 100644 index 000000000000..91533233868c --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/CspmMonitorGitLabOffering.PowerShell.cs @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The CSPM (Cloud security posture management) monitoring for gitlab offering + [System.ComponentModel.TypeConverter(typeof(CspmMonitorGitLabOfferingTypeConverter))] + public partial class CspmMonitorGitLabOffering + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal CspmMonitorGitLabOffering(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("OfferingType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType = (string) content.GetValueForProperty("OfferingType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType, global::System.Convert.ToString); + } + if (content.Contains("Description")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal CspmMonitorGitLabOffering(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("OfferingType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType = (string) content.GetValueForProperty("OfferingType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType, global::System.Convert.ToString); + } + if (content.Contains("Description")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGitLabOffering DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new CspmMonitorGitLabOffering(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGitLabOffering DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new CspmMonitorGitLabOffering(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGitLabOffering FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The CSPM (Cloud security posture management) monitoring for gitlab offering + [System.ComponentModel.TypeConverter(typeof(CspmMonitorGitLabOfferingTypeConverter))] + public partial interface ICspmMonitorGitLabOffering + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/CspmMonitorGitLabOffering.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/CspmMonitorGitLabOffering.TypeConverter.cs new file mode 100644 index 000000000000..fec5c1ba2bc5 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/CspmMonitorGitLabOffering.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class CspmMonitorGitLabOfferingTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGitLabOffering ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGitLabOffering).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return CspmMonitorGitLabOffering.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return CspmMonitorGitLabOffering.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return CspmMonitorGitLabOffering.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/CspmMonitorGitLabOffering.cs b/src/Security/Security.Autorest/generated/api/Models/CspmMonitorGitLabOffering.cs new file mode 100644 index 000000000000..d0bc09d34a7f --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/CspmMonitorGitLabOffering.cs @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The CSPM (Cloud security posture management) monitoring for gitlab offering + public partial class CspmMonitorGitLabOffering : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGitLabOffering, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGitLabOfferingInternal, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOffering __cloudOffering = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CloudOffering(); + + /// The offering description. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string Description { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)__cloudOffering).Description; } + + /// Internal Acessors for Description + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal.Description { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)__cloudOffering).Description; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)__cloudOffering).Description = value; } + + /// The type of the security offering. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Constant] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string OfferingType { get => "CspmMonitorGitLab"; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)__cloudOffering).OfferingType = "CspmMonitorGitLab"; } + + /// Creates an new instance. + public CspmMonitorGitLabOffering() + { + this.__cloudOffering.OfferingType = "CspmMonitorGitLab"; + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__cloudOffering), __cloudOffering); + await eventListener.AssertObjectIsValid(nameof(__cloudOffering), __cloudOffering); + } + } + /// The CSPM (Cloud security posture management) monitoring for gitlab offering + public partial interface ICspmMonitorGitLabOffering : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOffering + { + + } + /// The CSPM (Cloud security posture management) monitoring for gitlab offering + internal partial interface ICspmMonitorGitLabOfferingInternal : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/CspmMonitorGitLabOffering.json.cs b/src/Security/Security.Autorest/generated/api/Models/CspmMonitorGitLabOffering.json.cs new file mode 100644 index 000000000000..8bd3a8cfc862 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/CspmMonitorGitLabOffering.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The CSPM (Cloud security posture management) monitoring for gitlab offering + public partial class CspmMonitorGitLabOffering + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal CspmMonitorGitLabOffering(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __cloudOffering = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CloudOffering(json); + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGitLabOffering. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGitLabOffering. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGitLabOffering FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new CspmMonitorGitLabOffering(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __cloudOffering?.ToJson(container, serializationMode); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/CspmMonitorGithubOffering.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/CspmMonitorGithubOffering.PowerShell.cs new file mode 100644 index 000000000000..90b6823511cc --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/CspmMonitorGithubOffering.PowerShell.cs @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The CSPM monitoring for github offering + [System.ComponentModel.TypeConverter(typeof(CspmMonitorGithubOfferingTypeConverter))] + public partial class CspmMonitorGithubOffering + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal CspmMonitorGithubOffering(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("OfferingType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType = (string) content.GetValueForProperty("OfferingType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType, global::System.Convert.ToString); + } + if (content.Contains("Description")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal CspmMonitorGithubOffering(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("OfferingType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType = (string) content.GetValueForProperty("OfferingType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType, global::System.Convert.ToString); + } + if (content.Contains("Description")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGithubOffering DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new CspmMonitorGithubOffering(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGithubOffering DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new CspmMonitorGithubOffering(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGithubOffering FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The CSPM monitoring for github offering + [System.ComponentModel.TypeConverter(typeof(CspmMonitorGithubOfferingTypeConverter))] + public partial interface ICspmMonitorGithubOffering + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/CspmMonitorGithubOffering.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/CspmMonitorGithubOffering.TypeConverter.cs new file mode 100644 index 000000000000..6fd599ba1f13 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/CspmMonitorGithubOffering.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class CspmMonitorGithubOfferingTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGithubOffering ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGithubOffering).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return CspmMonitorGithubOffering.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return CspmMonitorGithubOffering.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return CspmMonitorGithubOffering.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/CspmMonitorGithubOffering.cs b/src/Security/Security.Autorest/generated/api/Models/CspmMonitorGithubOffering.cs new file mode 100644 index 000000000000..cd1a011cc9f8 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/CspmMonitorGithubOffering.cs @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The CSPM monitoring for github offering + public partial class CspmMonitorGithubOffering : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGithubOffering, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGithubOfferingInternal, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOffering __cloudOffering = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CloudOffering(); + + /// The offering description. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string Description { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)__cloudOffering).Description; } + + /// Internal Acessors for Description + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal.Description { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)__cloudOffering).Description; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)__cloudOffering).Description = value; } + + /// The type of the security offering. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Constant] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string OfferingType { get => "CspmMonitorGithub"; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)__cloudOffering).OfferingType = "CspmMonitorGithub"; } + + /// Creates an new instance. + public CspmMonitorGithubOffering() + { + this.__cloudOffering.OfferingType = "CspmMonitorGithub"; + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__cloudOffering), __cloudOffering); + await eventListener.AssertObjectIsValid(nameof(__cloudOffering), __cloudOffering); + } + } + /// The CSPM monitoring for github offering + public partial interface ICspmMonitorGithubOffering : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOffering + { + + } + /// The CSPM monitoring for github offering + internal partial interface ICspmMonitorGithubOfferingInternal : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/CspmMonitorGithubOffering.json.cs b/src/Security/Security.Autorest/generated/api/Models/CspmMonitorGithubOffering.json.cs new file mode 100644 index 000000000000..2eac79932245 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/CspmMonitorGithubOffering.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The CSPM monitoring for github offering + public partial class CspmMonitorGithubOffering + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal CspmMonitorGithubOffering(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __cloudOffering = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CloudOffering(json); + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGithubOffering. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGithubOffering. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICspmMonitorGithubOffering FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new CspmMonitorGithubOffering(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __cloudOffering?.ToJson(container, serializationMode); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOffering.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOffering.PowerShell.cs new file mode 100644 index 000000000000..077065d92dce --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOffering.PowerShell.cs @@ -0,0 +1,364 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The CSPM P1 for AWS offering + [System.ComponentModel.TypeConverter(typeof(DefenderCspmAwsOfferingTypeConverter))] + public partial class DefenderCspmAwsOffering + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DefenderCspmAwsOffering(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("VMScanner")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).VMScanner = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScanners) content.GetValueForProperty("VMScanner",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).VMScanner, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingVMScannersTypeConverter.ConvertFrom); + } + if (content.Contains("DataSensitivityDiscovery")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).DataSensitivityDiscovery = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingDataSensitivityDiscovery) content.GetValueForProperty("DataSensitivityDiscovery",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).DataSensitivityDiscovery, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingDataSensitivityDiscoveryTypeConverter.ConvertFrom); + } + if (content.Contains("DatabasesDspm")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).DatabasesDspm = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingDatabasesDspm) content.GetValueForProperty("DatabasesDspm",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).DatabasesDspm, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingDatabasesDspmTypeConverter.ConvertFrom); + } + if (content.Contains("Ciem")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).Ciem = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiem) content.GetValueForProperty("Ciem",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).Ciem, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingCiemTypeConverter.ConvertFrom); + } + if (content.Contains("MdcContainersImageAssessment")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).MdcContainersImageAssessment = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingMdcContainersImageAssessment) content.GetValueForProperty("MdcContainersImageAssessment",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).MdcContainersImageAssessment, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingMdcContainersImageAssessmentTypeConverter.ConvertFrom); + } + if (content.Contains("MdcContainersAgentlessDiscoveryK8S")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).MdcContainersAgentlessDiscoveryK8S = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S) content.GetValueForProperty("MdcContainersAgentlessDiscoveryK8S",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).MdcContainersAgentlessDiscoveryK8S, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8STypeConverter.ConvertFrom); + } + if (content.Contains("OfferingType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType = (string) content.GetValueForProperty("OfferingType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType, global::System.Convert.ToString); + } + if (content.Contains("Description")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description, global::System.Convert.ToString); + } + if (content.Contains("VMScannerConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).VMScannerConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfiguration) content.GetValueForProperty("VMScannerConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).VMScannerConfiguration, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingVMScannersConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("VMScannerEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).VMScannerEnabled = (bool?) content.GetValueForProperty("VMScannerEnabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).VMScannerEnabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ConfigurationScanningMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).ConfigurationScanningMode = (string) content.GetValueForProperty("ConfigurationScanningMode",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).ConfigurationScanningMode, global::System.Convert.ToString); + } + if (content.Contains("DataSensitivityDiscoveryEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).DataSensitivityDiscoveryEnabled = (bool?) content.GetValueForProperty("DataSensitivityDiscoveryEnabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).DataSensitivityDiscoveryEnabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("DataSensitivityDiscoveryCloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).DataSensitivityDiscoveryCloudRoleArn = (string) content.GetValueForProperty("DataSensitivityDiscoveryCloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).DataSensitivityDiscoveryCloudRoleArn, global::System.Convert.ToString); + } + if (content.Contains("DatabaseDspmEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).DatabaseDspmEnabled = (bool?) content.GetValueForProperty("DatabaseDspmEnabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).DatabaseDspmEnabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("DatabaseDspmCloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).DatabaseDspmCloudRoleArn = (string) content.GetValueForProperty("DatabaseDspmCloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).DatabaseDspmCloudRoleArn, global::System.Convert.ToString); + } + if (content.Contains("CiemDiscovery")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).CiemDiscovery = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemDiscovery) content.GetValueForProperty("CiemDiscovery",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).CiemDiscovery, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingCiemDiscoveryTypeConverter.ConvertFrom); + } + if (content.Contains("CiemOidc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).CiemOidc = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemOidc) content.GetValueForProperty("CiemOidc",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).CiemOidc, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingCiemOidcTypeConverter.ConvertFrom); + } + if (content.Contains("MdcContainerImageAssessmentEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).MdcContainerImageAssessmentEnabled = (bool?) content.GetValueForProperty("MdcContainerImageAssessmentEnabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).MdcContainerImageAssessmentEnabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("MdcContainerImageAssessmentCloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).MdcContainerImageAssessmentCloudRoleArn = (string) content.GetValueForProperty("MdcContainerImageAssessmentCloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).MdcContainerImageAssessmentCloudRoleArn, global::System.Convert.ToString); + } + if (content.Contains("MdcContainerAgentlessDiscoveryK8SEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).MdcContainerAgentlessDiscoveryK8SEnabled = (bool?) content.GetValueForProperty("MdcContainerAgentlessDiscoveryK8SEnabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).MdcContainerAgentlessDiscoveryK8SEnabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("MdcContainerAgentlessDiscoveryK8SCloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).MdcContainerAgentlessDiscoveryK8SCloudRoleArn = (string) content.GetValueForProperty("MdcContainerAgentlessDiscoveryK8SCloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).MdcContainerAgentlessDiscoveryK8SCloudRoleArn, global::System.Convert.ToString); + } + if (content.Contains("ConfigurationCloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).ConfigurationCloudRoleArn = (string) content.GetValueForProperty("ConfigurationCloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).ConfigurationCloudRoleArn, global::System.Convert.ToString); + } + if (content.Contains("ConfigurationExclusionTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).ConfigurationExclusionTag = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfigurationExclusionTags) content.GetValueForProperty("ConfigurationExclusionTag",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).ConfigurationExclusionTag, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingVMScannersConfigurationExclusionTagsTypeConverter.ConvertFrom); + } + if (content.Contains("CiemDiscoveryCloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).CiemDiscoveryCloudRoleArn = (string) content.GetValueForProperty("CiemDiscoveryCloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).CiemDiscoveryCloudRoleArn, global::System.Convert.ToString); + } + if (content.Contains("CiemOidcCloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).CiemOidcCloudRoleArn = (string) content.GetValueForProperty("CiemOidcCloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).CiemOidcCloudRoleArn, global::System.Convert.ToString); + } + if (content.Contains("CiemOidcAzureActiveDirectoryAppName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).CiemOidcAzureActiveDirectoryAppName = (string) content.GetValueForProperty("CiemOidcAzureActiveDirectoryAppName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).CiemOidcAzureActiveDirectoryAppName, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DefenderCspmAwsOffering(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("VMScanner")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).VMScanner = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScanners) content.GetValueForProperty("VMScanner",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).VMScanner, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingVMScannersTypeConverter.ConvertFrom); + } + if (content.Contains("DataSensitivityDiscovery")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).DataSensitivityDiscovery = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingDataSensitivityDiscovery) content.GetValueForProperty("DataSensitivityDiscovery",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).DataSensitivityDiscovery, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingDataSensitivityDiscoveryTypeConverter.ConvertFrom); + } + if (content.Contains("DatabasesDspm")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).DatabasesDspm = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingDatabasesDspm) content.GetValueForProperty("DatabasesDspm",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).DatabasesDspm, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingDatabasesDspmTypeConverter.ConvertFrom); + } + if (content.Contains("Ciem")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).Ciem = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiem) content.GetValueForProperty("Ciem",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).Ciem, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingCiemTypeConverter.ConvertFrom); + } + if (content.Contains("MdcContainersImageAssessment")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).MdcContainersImageAssessment = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingMdcContainersImageAssessment) content.GetValueForProperty("MdcContainersImageAssessment",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).MdcContainersImageAssessment, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingMdcContainersImageAssessmentTypeConverter.ConvertFrom); + } + if (content.Contains("MdcContainersAgentlessDiscoveryK8S")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).MdcContainersAgentlessDiscoveryK8S = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S) content.GetValueForProperty("MdcContainersAgentlessDiscoveryK8S",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).MdcContainersAgentlessDiscoveryK8S, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8STypeConverter.ConvertFrom); + } + if (content.Contains("OfferingType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType = (string) content.GetValueForProperty("OfferingType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType, global::System.Convert.ToString); + } + if (content.Contains("Description")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description, global::System.Convert.ToString); + } + if (content.Contains("VMScannerConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).VMScannerConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfiguration) content.GetValueForProperty("VMScannerConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).VMScannerConfiguration, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingVMScannersConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("VMScannerEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).VMScannerEnabled = (bool?) content.GetValueForProperty("VMScannerEnabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).VMScannerEnabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ConfigurationScanningMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).ConfigurationScanningMode = (string) content.GetValueForProperty("ConfigurationScanningMode",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).ConfigurationScanningMode, global::System.Convert.ToString); + } + if (content.Contains("DataSensitivityDiscoveryEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).DataSensitivityDiscoveryEnabled = (bool?) content.GetValueForProperty("DataSensitivityDiscoveryEnabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).DataSensitivityDiscoveryEnabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("DataSensitivityDiscoveryCloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).DataSensitivityDiscoveryCloudRoleArn = (string) content.GetValueForProperty("DataSensitivityDiscoveryCloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).DataSensitivityDiscoveryCloudRoleArn, global::System.Convert.ToString); + } + if (content.Contains("DatabaseDspmEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).DatabaseDspmEnabled = (bool?) content.GetValueForProperty("DatabaseDspmEnabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).DatabaseDspmEnabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("DatabaseDspmCloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).DatabaseDspmCloudRoleArn = (string) content.GetValueForProperty("DatabaseDspmCloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).DatabaseDspmCloudRoleArn, global::System.Convert.ToString); + } + if (content.Contains("CiemDiscovery")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).CiemDiscovery = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemDiscovery) content.GetValueForProperty("CiemDiscovery",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).CiemDiscovery, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingCiemDiscoveryTypeConverter.ConvertFrom); + } + if (content.Contains("CiemOidc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).CiemOidc = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemOidc) content.GetValueForProperty("CiemOidc",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).CiemOidc, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingCiemOidcTypeConverter.ConvertFrom); + } + if (content.Contains("MdcContainerImageAssessmentEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).MdcContainerImageAssessmentEnabled = (bool?) content.GetValueForProperty("MdcContainerImageAssessmentEnabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).MdcContainerImageAssessmentEnabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("MdcContainerImageAssessmentCloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).MdcContainerImageAssessmentCloudRoleArn = (string) content.GetValueForProperty("MdcContainerImageAssessmentCloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).MdcContainerImageAssessmentCloudRoleArn, global::System.Convert.ToString); + } + if (content.Contains("MdcContainerAgentlessDiscoveryK8SEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).MdcContainerAgentlessDiscoveryK8SEnabled = (bool?) content.GetValueForProperty("MdcContainerAgentlessDiscoveryK8SEnabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).MdcContainerAgentlessDiscoveryK8SEnabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("MdcContainerAgentlessDiscoveryK8SCloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).MdcContainerAgentlessDiscoveryK8SCloudRoleArn = (string) content.GetValueForProperty("MdcContainerAgentlessDiscoveryK8SCloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).MdcContainerAgentlessDiscoveryK8SCloudRoleArn, global::System.Convert.ToString); + } + if (content.Contains("ConfigurationCloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).ConfigurationCloudRoleArn = (string) content.GetValueForProperty("ConfigurationCloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).ConfigurationCloudRoleArn, global::System.Convert.ToString); + } + if (content.Contains("ConfigurationExclusionTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).ConfigurationExclusionTag = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfigurationExclusionTags) content.GetValueForProperty("ConfigurationExclusionTag",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).ConfigurationExclusionTag, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingVMScannersConfigurationExclusionTagsTypeConverter.ConvertFrom); + } + if (content.Contains("CiemDiscoveryCloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).CiemDiscoveryCloudRoleArn = (string) content.GetValueForProperty("CiemDiscoveryCloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).CiemDiscoveryCloudRoleArn, global::System.Convert.ToString); + } + if (content.Contains("CiemOidcCloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).CiemOidcCloudRoleArn = (string) content.GetValueForProperty("CiemOidcCloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).CiemOidcCloudRoleArn, global::System.Convert.ToString); + } + if (content.Contains("CiemOidcAzureActiveDirectoryAppName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).CiemOidcAzureActiveDirectoryAppName = (string) content.GetValueForProperty("CiemOidcAzureActiveDirectoryAppName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal)this).CiemOidcAzureActiveDirectoryAppName, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOffering DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DefenderCspmAwsOffering(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOffering DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DefenderCspmAwsOffering(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOffering FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The CSPM P1 for AWS offering + [System.ComponentModel.TypeConverter(typeof(DefenderCspmAwsOfferingTypeConverter))] + public partial interface IDefenderCspmAwsOffering + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOffering.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOffering.TypeConverter.cs new file mode 100644 index 000000000000..1b2977ce9632 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOffering.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DefenderCspmAwsOfferingTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOffering ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOffering).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DefenderCspmAwsOffering.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DefenderCspmAwsOffering.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DefenderCspmAwsOffering.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOffering.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOffering.cs new file mode 100644 index 000000000000..adfeaa113c24 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOffering.cs @@ -0,0 +1,412 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The CSPM P1 for AWS offering + public partial class DefenderCspmAwsOffering : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOffering, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOffering __cloudOffering = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CloudOffering(); + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiem _ciem; + + /// + /// Defenders CSPM Cloud infrastructure entitlement management (CIEM) offering configurations + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiem Ciem { get => (this._ciem = this._ciem ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingCiem()); set => this._ciem = value; } + + /// The cloud role ARN in AWS for CIEM discovery + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string CiemDiscoveryCloudRoleArn { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemInternal)Ciem).CiemDiscoveryCloudRoleArn; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemInternal)Ciem).CiemDiscoveryCloudRoleArn = value ?? null; } + + /// the azure active directory app name used of authenticating against AWS + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string CiemOidcAzureActiveDirectoryAppName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemInternal)Ciem).CiemOidcAzureActiveDirectoryAppName; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemInternal)Ciem).CiemOidcAzureActiveDirectoryAppName = value ?? null; } + + /// The cloud role ARN in AWS for CIEM oidc connection + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string CiemOidcCloudRoleArn { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemInternal)Ciem).CiemOidcCloudRoleArn; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemInternal)Ciem).CiemOidcCloudRoleArn = value ?? null; } + + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string ConfigurationCloudRoleArn { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersInternal)VMScanner).ConfigurationCloudRoleArn; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersInternal)VMScanner).ConfigurationCloudRoleArn = value ?? null; } + + /// VM tags that indicates that VM should not be scanned + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfigurationExclusionTags ConfigurationExclusionTag { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersInternal)VMScanner).ConfigurationExclusionTag; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersInternal)VMScanner).ConfigurationExclusionTag = value ?? null /* model class */; } + + /// The scanning mode for the VM scan. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string ConfigurationScanningMode { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersInternal)VMScanner).ConfigurationScanningMode; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersInternal)VMScanner).ConfigurationScanningMode = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingDataSensitivityDiscovery _dataSensitivityDiscovery; + + /// The Microsoft Defender Data Sensitivity discovery configuration + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingDataSensitivityDiscovery DataSensitivityDiscovery { get => (this._dataSensitivityDiscovery = this._dataSensitivityDiscovery ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingDataSensitivityDiscovery()); set => this._dataSensitivityDiscovery = value; } + + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string DataSensitivityDiscoveryCloudRoleArn { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingDataSensitivityDiscoveryInternal)DataSensitivityDiscovery).CloudRoleArn; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingDataSensitivityDiscoveryInternal)DataSensitivityDiscovery).CloudRoleArn = value ?? null; } + + /// Is Microsoft Defender Data Sensitivity discovery enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public bool? DataSensitivityDiscoveryEnabled { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingDataSensitivityDiscoveryInternal)DataSensitivityDiscovery).Enabled; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingDataSensitivityDiscoveryInternal)DataSensitivityDiscovery).Enabled = value ?? default(bool); } + + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string DatabaseDspmCloudRoleArn { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingDatabasesDspmInternal)DatabasesDspm).CloudRoleArn; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingDatabasesDspmInternal)DatabasesDspm).CloudRoleArn = value ?? null; } + + /// Is databases DSPM protection enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public bool? DatabaseDspmEnabled { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingDatabasesDspmInternal)DatabasesDspm).Enabled; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingDatabasesDspmInternal)DatabasesDspm).Enabled = value ?? default(bool); } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingDatabasesDspm _databasesDspm; + + /// The databases DSPM configuration + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingDatabasesDspm DatabasesDspm { get => (this._databasesDspm = this._databasesDspm ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingDatabasesDspm()); set => this._databasesDspm = value; } + + /// The offering description. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string Description { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)__cloudOffering).Description; } + + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string MdcContainerAgentlessDiscoveryK8SCloudRoleArn { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8SInternal)MdcContainersAgentlessDiscoveryK8S).CloudRoleArn; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8SInternal)MdcContainersAgentlessDiscoveryK8S).CloudRoleArn = value ?? null; } + + /// Is Microsoft Defender container agentless discovery K8s enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public bool? MdcContainerAgentlessDiscoveryK8SEnabled { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8SInternal)MdcContainersAgentlessDiscoveryK8S).Enabled; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8SInternal)MdcContainersAgentlessDiscoveryK8S).Enabled = value ?? default(bool); } + + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string MdcContainerImageAssessmentCloudRoleArn { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingMdcContainersImageAssessmentInternal)MdcContainersImageAssessment).CloudRoleArn; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingMdcContainersImageAssessmentInternal)MdcContainersImageAssessment).CloudRoleArn = value ?? null; } + + /// Is Microsoft Defender container image assessment enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public bool? MdcContainerImageAssessmentEnabled { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingMdcContainersImageAssessmentInternal)MdcContainersImageAssessment).Enabled; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingMdcContainersImageAssessmentInternal)MdcContainersImageAssessment).Enabled = value ?? default(bool); } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S _mdcContainersAgentlessDiscoveryK8S; + + /// The Microsoft Defender container agentless discovery K8s configuration + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S MdcContainersAgentlessDiscoveryK8S { get => (this._mdcContainersAgentlessDiscoveryK8S = this._mdcContainersAgentlessDiscoveryK8S ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S()); set => this._mdcContainersAgentlessDiscoveryK8S = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingMdcContainersImageAssessment _mdcContainersImageAssessment; + + /// The Microsoft Defender container image assessment configuration + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingMdcContainersImageAssessment MdcContainersImageAssessment { get => (this._mdcContainersImageAssessment = this._mdcContainersImageAssessment ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingMdcContainersImageAssessment()); set => this._mdcContainersImageAssessment = value; } + + /// Internal Acessors for Description + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal.Description { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)__cloudOffering).Description; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)__cloudOffering).Description = value; } + + /// Internal Acessors for Ciem + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiem Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal.Ciem { get => (this._ciem = this._ciem ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingCiem()); set { {_ciem = value;} } } + + /// Internal Acessors for CiemDiscovery + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemDiscovery Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal.CiemDiscovery { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemInternal)Ciem).CiemDiscovery; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemInternal)Ciem).CiemDiscovery = value; } + + /// Internal Acessors for CiemOidc + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemOidc Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal.CiemOidc { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemInternal)Ciem).CiemOidc; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemInternal)Ciem).CiemOidc = value; } + + /// Internal Acessors for DataSensitivityDiscovery + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingDataSensitivityDiscovery Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal.DataSensitivityDiscovery { get => (this._dataSensitivityDiscovery = this._dataSensitivityDiscovery ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingDataSensitivityDiscovery()); set { {_dataSensitivityDiscovery = value;} } } + + /// Internal Acessors for DatabasesDspm + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingDatabasesDspm Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal.DatabasesDspm { get => (this._databasesDspm = this._databasesDspm ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingDatabasesDspm()); set { {_databasesDspm = value;} } } + + /// Internal Acessors for MdcContainersAgentlessDiscoveryK8S + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal.MdcContainersAgentlessDiscoveryK8S { get => (this._mdcContainersAgentlessDiscoveryK8S = this._mdcContainersAgentlessDiscoveryK8S ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S()); set { {_mdcContainersAgentlessDiscoveryK8S = value;} } } + + /// Internal Acessors for MdcContainersImageAssessment + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingMdcContainersImageAssessment Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal.MdcContainersImageAssessment { get => (this._mdcContainersImageAssessment = this._mdcContainersImageAssessment ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingMdcContainersImageAssessment()); set { {_mdcContainersImageAssessment = value;} } } + + /// Internal Acessors for VMScanner + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScanners Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal.VMScanner { get => (this._vMScanner = this._vMScanner ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingVMScanners()); set { {_vMScanner = value;} } } + + /// Internal Acessors for VMScannerConfiguration + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfiguration Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingInternal.VMScannerConfiguration { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersInternal)VMScanner).Configuration; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersInternal)VMScanner).Configuration = value; } + + /// The type of the security offering. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Constant] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string OfferingType { get => "DefenderCspmAws"; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)__cloudOffering).OfferingType = "DefenderCspmAws"; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScanners _vMScanner; + + /// The Microsoft Defender for Server VM scanning configuration + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScanners VMScanner { get => (this._vMScanner = this._vMScanner ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingVMScanners()); set => this._vMScanner = value; } + + /// Is Microsoft Defender for Server VM scanning enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public bool? VMScannerEnabled { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersInternal)VMScanner).Enabled; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersInternal)VMScanner).Enabled = value ?? default(bool); } + + /// Creates an new instance. + public DefenderCspmAwsOffering() + { + this.__cloudOffering.OfferingType = "DefenderCspmAws"; + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__cloudOffering), __cloudOffering); + await eventListener.AssertObjectIsValid(nameof(__cloudOffering), __cloudOffering); + } + } + /// The CSPM P1 for AWS offering + public partial interface IDefenderCspmAwsOffering : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOffering + { + /// The cloud role ARN in AWS for CIEM discovery + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The cloud role ARN in AWS for CIEM discovery", + SerializedName = @"cloudRoleArn", + PossibleTypes = new [] { typeof(string) })] + string CiemDiscoveryCloudRoleArn { get; set; } + /// the azure active directory app name used of authenticating against AWS + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"the azure active directory app name used of authenticating against AWS", + SerializedName = @"azureActiveDirectoryAppName", + PossibleTypes = new [] { typeof(string) })] + string CiemOidcAzureActiveDirectoryAppName { get; set; } + /// The cloud role ARN in AWS for CIEM oidc connection + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The cloud role ARN in AWS for CIEM oidc connection", + SerializedName = @"cloudRoleArn", + PossibleTypes = new [] { typeof(string) })] + string CiemOidcCloudRoleArn { get; set; } + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The cloud role ARN in AWS for this feature", + SerializedName = @"cloudRoleArn", + PossibleTypes = new [] { typeof(string) })] + string ConfigurationCloudRoleArn { get; set; } + /// VM tags that indicates that VM should not be scanned + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"VM tags that indicates that VM should not be scanned", + SerializedName = @"exclusionTags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfigurationExclusionTags) })] + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfigurationExclusionTags ConfigurationExclusionTag { get; set; } + /// The scanning mode for the VM scan. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The scanning mode for the VM scan.", + SerializedName = @"scanningMode", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Default")] + string ConfigurationScanningMode { get; set; } + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The cloud role ARN in AWS for this feature", + SerializedName = @"cloudRoleArn", + PossibleTypes = new [] { typeof(string) })] + string DataSensitivityDiscoveryCloudRoleArn { get; set; } + /// Is Microsoft Defender Data Sensitivity discovery enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Is Microsoft Defender Data Sensitivity discovery enabled", + SerializedName = @"enabled", + PossibleTypes = new [] { typeof(bool) })] + bool? DataSensitivityDiscoveryEnabled { get; set; } + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The cloud role ARN in AWS for this feature", + SerializedName = @"cloudRoleArn", + PossibleTypes = new [] { typeof(string) })] + string DatabaseDspmCloudRoleArn { get; set; } + /// Is databases DSPM protection enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Is databases DSPM protection enabled", + SerializedName = @"enabled", + PossibleTypes = new [] { typeof(bool) })] + bool? DatabaseDspmEnabled { get; set; } + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The cloud role ARN in AWS for this feature", + SerializedName = @"cloudRoleArn", + PossibleTypes = new [] { typeof(string) })] + string MdcContainerAgentlessDiscoveryK8SCloudRoleArn { get; set; } + /// Is Microsoft Defender container agentless discovery K8s enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Is Microsoft Defender container agentless discovery K8s enabled", + SerializedName = @"enabled", + PossibleTypes = new [] { typeof(bool) })] + bool? MdcContainerAgentlessDiscoveryK8SEnabled { get; set; } + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The cloud role ARN in AWS for this feature", + SerializedName = @"cloudRoleArn", + PossibleTypes = new [] { typeof(string) })] + string MdcContainerImageAssessmentCloudRoleArn { get; set; } + /// Is Microsoft Defender container image assessment enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Is Microsoft Defender container image assessment enabled", + SerializedName = @"enabled", + PossibleTypes = new [] { typeof(bool) })] + bool? MdcContainerImageAssessmentEnabled { get; set; } + /// Is Microsoft Defender for Server VM scanning enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Is Microsoft Defender for Server VM scanning enabled", + SerializedName = @"enabled", + PossibleTypes = new [] { typeof(bool) })] + bool? VMScannerEnabled { get; set; } + + } + /// The CSPM P1 for AWS offering + internal partial interface IDefenderCspmAwsOfferingInternal : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal + { + /// + /// Defenders CSPM Cloud infrastructure entitlement management (CIEM) offering configurations + /// + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiem Ciem { get; set; } + /// Defender CSPM CIEM discovery configuration + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemDiscovery CiemDiscovery { get; set; } + /// The cloud role ARN in AWS for CIEM discovery + string CiemDiscoveryCloudRoleArn { get; set; } + /// Defender CSPM CIEM AWS OIDC (open id connect) configuration + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemOidc CiemOidc { get; set; } + /// the azure active directory app name used of authenticating against AWS + string CiemOidcAzureActiveDirectoryAppName { get; set; } + /// The cloud role ARN in AWS for CIEM oidc connection + string CiemOidcCloudRoleArn { get; set; } + /// The cloud role ARN in AWS for this feature + string ConfigurationCloudRoleArn { get; set; } + /// VM tags that indicates that VM should not be scanned + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfigurationExclusionTags ConfigurationExclusionTag { get; set; } + /// The scanning mode for the VM scan. + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Default")] + string ConfigurationScanningMode { get; set; } + /// The Microsoft Defender Data Sensitivity discovery configuration + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingDataSensitivityDiscovery DataSensitivityDiscovery { get; set; } + /// The cloud role ARN in AWS for this feature + string DataSensitivityDiscoveryCloudRoleArn { get; set; } + /// Is Microsoft Defender Data Sensitivity discovery enabled + bool? DataSensitivityDiscoveryEnabled { get; set; } + /// The cloud role ARN in AWS for this feature + string DatabaseDspmCloudRoleArn { get; set; } + /// Is databases DSPM protection enabled + bool? DatabaseDspmEnabled { get; set; } + /// The databases DSPM configuration + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingDatabasesDspm DatabasesDspm { get; set; } + /// The cloud role ARN in AWS for this feature + string MdcContainerAgentlessDiscoveryK8SCloudRoleArn { get; set; } + /// Is Microsoft Defender container agentless discovery K8s enabled + bool? MdcContainerAgentlessDiscoveryK8SEnabled { get; set; } + /// The cloud role ARN in AWS for this feature + string MdcContainerImageAssessmentCloudRoleArn { get; set; } + /// Is Microsoft Defender container image assessment enabled + bool? MdcContainerImageAssessmentEnabled { get; set; } + /// The Microsoft Defender container agentless discovery K8s configuration + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S MdcContainersAgentlessDiscoveryK8S { get; set; } + /// The Microsoft Defender container image assessment configuration + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingMdcContainersImageAssessment MdcContainersImageAssessment { get; set; } + /// The Microsoft Defender for Server VM scanning configuration + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScanners VMScanner { get; set; } + /// configuration for Microsoft Defender for Server VM scanning + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfiguration VMScannerConfiguration { get; set; } + /// Is Microsoft Defender for Server VM scanning enabled + bool? VMScannerEnabled { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOffering.json.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOffering.json.cs new file mode 100644 index 000000000000..107cc62ee8a9 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOffering.json.cs @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The CSPM P1 for AWS offering + public partial class DefenderCspmAwsOffering + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal DefenderCspmAwsOffering(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __cloudOffering = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CloudOffering(json); + {_vMScanner = If( json?.PropertyT("vmScanners"), out var __jsonVMScanners) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingVMScanners.FromJson(__jsonVMScanners) : _vMScanner;} + {_dataSensitivityDiscovery = If( json?.PropertyT("dataSensitivityDiscovery"), out var __jsonDataSensitivityDiscovery) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingDataSensitivityDiscovery.FromJson(__jsonDataSensitivityDiscovery) : _dataSensitivityDiscovery;} + {_databasesDspm = If( json?.PropertyT("databasesDspm"), out var __jsonDatabasesDspm) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingDatabasesDspm.FromJson(__jsonDatabasesDspm) : _databasesDspm;} + {_ciem = If( json?.PropertyT("ciem"), out var __jsonCiem) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingCiem.FromJson(__jsonCiem) : _ciem;} + {_mdcContainersImageAssessment = If( json?.PropertyT("mdcContainersImageAssessment"), out var __jsonMdcContainersImageAssessment) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingMdcContainersImageAssessment.FromJson(__jsonMdcContainersImageAssessment) : _mdcContainersImageAssessment;} + {_mdcContainersAgentlessDiscoveryK8S = If( json?.PropertyT("mdcContainersAgentlessDiscoveryK8s"), out var __jsonMdcContainersAgentlessDiscoveryK8S) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S.FromJson(__jsonMdcContainersAgentlessDiscoveryK8S) : _mdcContainersAgentlessDiscoveryK8S;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOffering. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOffering. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOffering FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DefenderCspmAwsOffering(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __cloudOffering?.ToJson(container, serializationMode); + AddIf( null != this._vMScanner ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._vMScanner.ToJson(null,serializationMode) : null, "vmScanners" ,container.Add ); + AddIf( null != this._dataSensitivityDiscovery ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._dataSensitivityDiscovery.ToJson(null,serializationMode) : null, "dataSensitivityDiscovery" ,container.Add ); + AddIf( null != this._databasesDspm ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._databasesDspm.ToJson(null,serializationMode) : null, "databasesDspm" ,container.Add ); + AddIf( null != this._ciem ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._ciem.ToJson(null,serializationMode) : null, "ciem" ,container.Add ); + AddIf( null != this._mdcContainersImageAssessment ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._mdcContainersImageAssessment.ToJson(null,serializationMode) : null, "mdcContainersImageAssessment" ,container.Add ); + AddIf( null != this._mdcContainersAgentlessDiscoveryK8S ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._mdcContainersAgentlessDiscoveryK8S.ToJson(null,serializationMode) : null, "mdcContainersAgentlessDiscoveryK8s" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingCiem.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingCiem.PowerShell.cs new file mode 100644 index 000000000000..7056ac1b0a9f --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingCiem.PowerShell.cs @@ -0,0 +1,198 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// Defenders CSPM Cloud infrastructure entitlement management (CIEM) offering configurations + /// + [System.ComponentModel.TypeConverter(typeof(DefenderCspmAwsOfferingCiemTypeConverter))] + public partial class DefenderCspmAwsOfferingCiem + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DefenderCspmAwsOfferingCiem(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CiemDiscovery")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemInternal)this).CiemDiscovery = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemDiscovery) content.GetValueForProperty("CiemDiscovery",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemInternal)this).CiemDiscovery, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingCiemDiscoveryTypeConverter.ConvertFrom); + } + if (content.Contains("CiemOidc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemInternal)this).CiemOidc = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemOidc) content.GetValueForProperty("CiemOidc",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemInternal)this).CiemOidc, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingCiemOidcTypeConverter.ConvertFrom); + } + if (content.Contains("CiemDiscoveryCloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemInternal)this).CiemDiscoveryCloudRoleArn = (string) content.GetValueForProperty("CiemDiscoveryCloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemInternal)this).CiemDiscoveryCloudRoleArn, global::System.Convert.ToString); + } + if (content.Contains("CiemOidcCloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemInternal)this).CiemOidcCloudRoleArn = (string) content.GetValueForProperty("CiemOidcCloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemInternal)this).CiemOidcCloudRoleArn, global::System.Convert.ToString); + } + if (content.Contains("CiemOidcAzureActiveDirectoryAppName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemInternal)this).CiemOidcAzureActiveDirectoryAppName = (string) content.GetValueForProperty("CiemOidcAzureActiveDirectoryAppName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemInternal)this).CiemOidcAzureActiveDirectoryAppName, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DefenderCspmAwsOfferingCiem(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CiemDiscovery")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemInternal)this).CiemDiscovery = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemDiscovery) content.GetValueForProperty("CiemDiscovery",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemInternal)this).CiemDiscovery, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingCiemDiscoveryTypeConverter.ConvertFrom); + } + if (content.Contains("CiemOidc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemInternal)this).CiemOidc = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemOidc) content.GetValueForProperty("CiemOidc",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemInternal)this).CiemOidc, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingCiemOidcTypeConverter.ConvertFrom); + } + if (content.Contains("CiemDiscoveryCloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemInternal)this).CiemDiscoveryCloudRoleArn = (string) content.GetValueForProperty("CiemDiscoveryCloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemInternal)this).CiemDiscoveryCloudRoleArn, global::System.Convert.ToString); + } + if (content.Contains("CiemOidcCloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemInternal)this).CiemOidcCloudRoleArn = (string) content.GetValueForProperty("CiemOidcCloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemInternal)this).CiemOidcCloudRoleArn, global::System.Convert.ToString); + } + if (content.Contains("CiemOidcAzureActiveDirectoryAppName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemInternal)this).CiemOidcAzureActiveDirectoryAppName = (string) content.GetValueForProperty("CiemOidcAzureActiveDirectoryAppName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemInternal)this).CiemOidcAzureActiveDirectoryAppName, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiem DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DefenderCspmAwsOfferingCiem(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiem DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DefenderCspmAwsOfferingCiem(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiem FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// Defenders CSPM Cloud infrastructure entitlement management (CIEM) offering configurations + [System.ComponentModel.TypeConverter(typeof(DefenderCspmAwsOfferingCiemTypeConverter))] + public partial interface IDefenderCspmAwsOfferingCiem + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingCiem.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingCiem.TypeConverter.cs new file mode 100644 index 000000000000..6dcf22b4531f --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingCiem.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DefenderCspmAwsOfferingCiemTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiem ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiem).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DefenderCspmAwsOfferingCiem.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DefenderCspmAwsOfferingCiem.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DefenderCspmAwsOfferingCiem.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingCiem.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingCiem.cs new file mode 100644 index 000000000000..131b5db1b6d5 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingCiem.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// + /// Defenders CSPM Cloud infrastructure entitlement management (CIEM) offering configurations + /// + public partial class DefenderCspmAwsOfferingCiem : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiem, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemDiscovery _ciemDiscovery; + + /// Defender CSPM CIEM discovery configuration + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemDiscovery CiemDiscovery { get => (this._ciemDiscovery = this._ciemDiscovery ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingCiemDiscovery()); set => this._ciemDiscovery = value; } + + /// The cloud role ARN in AWS for CIEM discovery + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string CiemDiscoveryCloudRoleArn { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemDiscoveryInternal)CiemDiscovery).CloudRoleArn; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemDiscoveryInternal)CiemDiscovery).CloudRoleArn = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemOidc _ciemOidc; + + /// Defender CSPM CIEM AWS OIDC (open id connect) configuration + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemOidc CiemOidc { get => (this._ciemOidc = this._ciemOidc ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingCiemOidc()); set => this._ciemOidc = value; } + + /// the azure active directory app name used of authenticating against AWS + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string CiemOidcAzureActiveDirectoryAppName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemOidcInternal)CiemOidc).AzureActiveDirectoryAppName; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemOidcInternal)CiemOidc).AzureActiveDirectoryAppName = value ?? null; } + + /// The cloud role ARN in AWS for CIEM oidc connection + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string CiemOidcCloudRoleArn { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemOidcInternal)CiemOidc).CloudRoleArn; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemOidcInternal)CiemOidc).CloudRoleArn = value ?? null; } + + /// Internal Acessors for CiemDiscovery + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemDiscovery Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemInternal.CiemDiscovery { get => (this._ciemDiscovery = this._ciemDiscovery ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingCiemDiscovery()); set { {_ciemDiscovery = value;} } } + + /// Internal Acessors for CiemOidc + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemOidc Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemInternal.CiemOidc { get => (this._ciemOidc = this._ciemOidc ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingCiemOidc()); set { {_ciemOidc = value;} } } + + /// Creates an new instance. + public DefenderCspmAwsOfferingCiem() + { + + } + } + /// Defenders CSPM Cloud infrastructure entitlement management (CIEM) offering configurations + public partial interface IDefenderCspmAwsOfferingCiem : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// The cloud role ARN in AWS for CIEM discovery + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The cloud role ARN in AWS for CIEM discovery", + SerializedName = @"cloudRoleArn", + PossibleTypes = new [] { typeof(string) })] + string CiemDiscoveryCloudRoleArn { get; set; } + /// the azure active directory app name used of authenticating against AWS + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"the azure active directory app name used of authenticating against AWS", + SerializedName = @"azureActiveDirectoryAppName", + PossibleTypes = new [] { typeof(string) })] + string CiemOidcAzureActiveDirectoryAppName { get; set; } + /// The cloud role ARN in AWS for CIEM oidc connection + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The cloud role ARN in AWS for CIEM oidc connection", + SerializedName = @"cloudRoleArn", + PossibleTypes = new [] { typeof(string) })] + string CiemOidcCloudRoleArn { get; set; } + + } + /// Defenders CSPM Cloud infrastructure entitlement management (CIEM) offering configurations + internal partial interface IDefenderCspmAwsOfferingCiemInternal + + { + /// Defender CSPM CIEM discovery configuration + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemDiscovery CiemDiscovery { get; set; } + /// The cloud role ARN in AWS for CIEM discovery + string CiemDiscoveryCloudRoleArn { get; set; } + /// Defender CSPM CIEM AWS OIDC (open id connect) configuration + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemOidc CiemOidc { get; set; } + /// the azure active directory app name used of authenticating against AWS + string CiemOidcAzureActiveDirectoryAppName { get; set; } + /// The cloud role ARN in AWS for CIEM oidc connection + string CiemOidcCloudRoleArn { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingCiem.json.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingCiem.json.cs new file mode 100644 index 000000000000..f1ae460c713b --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingCiem.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// + /// Defenders CSPM Cloud infrastructure entitlement management (CIEM) offering configurations + /// + public partial class DefenderCspmAwsOfferingCiem + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal DefenderCspmAwsOfferingCiem(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_ciemDiscovery = If( json?.PropertyT("ciemDiscovery"), out var __jsonCiemDiscovery) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingCiemDiscovery.FromJson(__jsonCiemDiscovery) : _ciemDiscovery;} + {_ciemOidc = If( json?.PropertyT("ciemOidc"), out var __jsonCiemOidc) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingCiemOidc.FromJson(__jsonCiemOidc) : _ciemOidc;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiem. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiem. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiem FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DefenderCspmAwsOfferingCiem(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._ciemDiscovery ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._ciemDiscovery.ToJson(null,serializationMode) : null, "ciemDiscovery" ,container.Add ); + AddIf( null != this._ciemOidc ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._ciemOidc.ToJson(null,serializationMode) : null, "ciemOidc" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingCiemDiscovery.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingCiemDiscovery.PowerShell.cs new file mode 100644 index 000000000000..4368ba61e604 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingCiemDiscovery.PowerShell.cs @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// Defender CSPM CIEM discovery configuration + [System.ComponentModel.TypeConverter(typeof(DefenderCspmAwsOfferingCiemDiscoveryTypeConverter))] + public partial class DefenderCspmAwsOfferingCiemDiscovery + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DefenderCspmAwsOfferingCiemDiscovery(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemDiscoveryInternal)this).CloudRoleArn = (string) content.GetValueForProperty("CloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemDiscoveryInternal)this).CloudRoleArn, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DefenderCspmAwsOfferingCiemDiscovery(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemDiscoveryInternal)this).CloudRoleArn = (string) content.GetValueForProperty("CloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemDiscoveryInternal)this).CloudRoleArn, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemDiscovery DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DefenderCspmAwsOfferingCiemDiscovery(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemDiscovery DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DefenderCspmAwsOfferingCiemDiscovery(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemDiscovery FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// Defender CSPM CIEM discovery configuration + [System.ComponentModel.TypeConverter(typeof(DefenderCspmAwsOfferingCiemDiscoveryTypeConverter))] + public partial interface IDefenderCspmAwsOfferingCiemDiscovery + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingCiemDiscovery.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingCiemDiscovery.TypeConverter.cs new file mode 100644 index 000000000000..9e63595aa1b1 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingCiemDiscovery.TypeConverter.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DefenderCspmAwsOfferingCiemDiscoveryTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemDiscovery ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemDiscovery).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DefenderCspmAwsOfferingCiemDiscovery.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DefenderCspmAwsOfferingCiemDiscovery.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DefenderCspmAwsOfferingCiemDiscovery.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingCiemDiscovery.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingCiemDiscovery.cs new file mode 100644 index 000000000000..962eba89431a --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingCiemDiscovery.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// Defender CSPM CIEM discovery configuration + public partial class DefenderCspmAwsOfferingCiemDiscovery : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemDiscovery, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemDiscoveryInternal + { + + /// Backing field for property. + private string _cloudRoleArn; + + /// The cloud role ARN in AWS for CIEM discovery + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string CloudRoleArn { get => this._cloudRoleArn; set => this._cloudRoleArn = value; } + + /// Creates an new instance. + public DefenderCspmAwsOfferingCiemDiscovery() + { + + } + } + /// Defender CSPM CIEM discovery configuration + public partial interface IDefenderCspmAwsOfferingCiemDiscovery : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// The cloud role ARN in AWS for CIEM discovery + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The cloud role ARN in AWS for CIEM discovery", + SerializedName = @"cloudRoleArn", + PossibleTypes = new [] { typeof(string) })] + string CloudRoleArn { get; set; } + + } + /// Defender CSPM CIEM discovery configuration + internal partial interface IDefenderCspmAwsOfferingCiemDiscoveryInternal + + { + /// The cloud role ARN in AWS for CIEM discovery + string CloudRoleArn { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingCiemDiscovery.json.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingCiemDiscovery.json.cs new file mode 100644 index 000000000000..8d5894e6a3ca --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingCiemDiscovery.json.cs @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// Defender CSPM CIEM discovery configuration + public partial class DefenderCspmAwsOfferingCiemDiscovery + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal DefenderCspmAwsOfferingCiemDiscovery(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_cloudRoleArn = If( json?.PropertyT("cloudRoleArn"), out var __jsonCloudRoleArn) ? (string)__jsonCloudRoleArn : (string)_cloudRoleArn;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemDiscovery. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemDiscovery. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemDiscovery FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DefenderCspmAwsOfferingCiemDiscovery(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._cloudRoleArn)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._cloudRoleArn.ToString()) : null, "cloudRoleArn" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingCiemOidc.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingCiemOidc.PowerShell.cs new file mode 100644 index 000000000000..89557e510acc --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingCiemOidc.PowerShell.cs @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// Defender CSPM CIEM AWS OIDC (open id connect) configuration + [System.ComponentModel.TypeConverter(typeof(DefenderCspmAwsOfferingCiemOidcTypeConverter))] + public partial class DefenderCspmAwsOfferingCiemOidc + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DefenderCspmAwsOfferingCiemOidc(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemOidcInternal)this).CloudRoleArn = (string) content.GetValueForProperty("CloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemOidcInternal)this).CloudRoleArn, global::System.Convert.ToString); + } + if (content.Contains("AzureActiveDirectoryAppName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemOidcInternal)this).AzureActiveDirectoryAppName = (string) content.GetValueForProperty("AzureActiveDirectoryAppName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemOidcInternal)this).AzureActiveDirectoryAppName, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DefenderCspmAwsOfferingCiemOidc(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemOidcInternal)this).CloudRoleArn = (string) content.GetValueForProperty("CloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemOidcInternal)this).CloudRoleArn, global::System.Convert.ToString); + } + if (content.Contains("AzureActiveDirectoryAppName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemOidcInternal)this).AzureActiveDirectoryAppName = (string) content.GetValueForProperty("AzureActiveDirectoryAppName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemOidcInternal)this).AzureActiveDirectoryAppName, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemOidc DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DefenderCspmAwsOfferingCiemOidc(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemOidc DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DefenderCspmAwsOfferingCiemOidc(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemOidc FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// Defender CSPM CIEM AWS OIDC (open id connect) configuration + [System.ComponentModel.TypeConverter(typeof(DefenderCspmAwsOfferingCiemOidcTypeConverter))] + public partial interface IDefenderCspmAwsOfferingCiemOidc + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingCiemOidc.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingCiemOidc.TypeConverter.cs new file mode 100644 index 000000000000..4b6f5e3e6b40 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingCiemOidc.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DefenderCspmAwsOfferingCiemOidcTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemOidc ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemOidc).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DefenderCspmAwsOfferingCiemOidc.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DefenderCspmAwsOfferingCiemOidc.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DefenderCspmAwsOfferingCiemOidc.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingCiemOidc.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingCiemOidc.cs new file mode 100644 index 000000000000..fe1fe0ebb65f --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingCiemOidc.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// Defender CSPM CIEM AWS OIDC (open id connect) configuration + public partial class DefenderCspmAwsOfferingCiemOidc : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemOidc, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemOidcInternal + { + + /// Backing field for property. + private string _azureActiveDirectoryAppName; + + /// the azure active directory app name used of authenticating against AWS + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string AzureActiveDirectoryAppName { get => this._azureActiveDirectoryAppName; set => this._azureActiveDirectoryAppName = value; } + + /// Backing field for property. + private string _cloudRoleArn; + + /// The cloud role ARN in AWS for CIEM oidc connection + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string CloudRoleArn { get => this._cloudRoleArn; set => this._cloudRoleArn = value; } + + /// Creates an new instance. + public DefenderCspmAwsOfferingCiemOidc() + { + + } + } + /// Defender CSPM CIEM AWS OIDC (open id connect) configuration + public partial interface IDefenderCspmAwsOfferingCiemOidc : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// the azure active directory app name used of authenticating against AWS + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"the azure active directory app name used of authenticating against AWS", + SerializedName = @"azureActiveDirectoryAppName", + PossibleTypes = new [] { typeof(string) })] + string AzureActiveDirectoryAppName { get; set; } + /// The cloud role ARN in AWS for CIEM oidc connection + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The cloud role ARN in AWS for CIEM oidc connection", + SerializedName = @"cloudRoleArn", + PossibleTypes = new [] { typeof(string) })] + string CloudRoleArn { get; set; } + + } + /// Defender CSPM CIEM AWS OIDC (open id connect) configuration + internal partial interface IDefenderCspmAwsOfferingCiemOidcInternal + + { + /// the azure active directory app name used of authenticating against AWS + string AzureActiveDirectoryAppName { get; set; } + /// The cloud role ARN in AWS for CIEM oidc connection + string CloudRoleArn { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingCiemOidc.json.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingCiemOidc.json.cs new file mode 100644 index 000000000000..5f0017d27600 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingCiemOidc.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// Defender CSPM CIEM AWS OIDC (open id connect) configuration + public partial class DefenderCspmAwsOfferingCiemOidc + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal DefenderCspmAwsOfferingCiemOidc(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_cloudRoleArn = If( json?.PropertyT("cloudRoleArn"), out var __jsonCloudRoleArn) ? (string)__jsonCloudRoleArn : (string)_cloudRoleArn;} + {_azureActiveDirectoryAppName = If( json?.PropertyT("azureActiveDirectoryAppName"), out var __jsonAzureActiveDirectoryAppName) ? (string)__jsonAzureActiveDirectoryAppName : (string)_azureActiveDirectoryAppName;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemOidc. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemOidc. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingCiemOidc FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DefenderCspmAwsOfferingCiemOidc(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._cloudRoleArn)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._cloudRoleArn.ToString()) : null, "cloudRoleArn" ,container.Add ); + AddIf( null != (((object)this._azureActiveDirectoryAppName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._azureActiveDirectoryAppName.ToString()) : null, "azureActiveDirectoryAppName" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingDataSensitivityDiscovery.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingDataSensitivityDiscovery.PowerShell.cs new file mode 100644 index 000000000000..366ea9b8f6b1 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingDataSensitivityDiscovery.PowerShell.cs @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The Microsoft Defender Data Sensitivity discovery configuration + [System.ComponentModel.TypeConverter(typeof(DefenderCspmAwsOfferingDataSensitivityDiscoveryTypeConverter))] + public partial class DefenderCspmAwsOfferingDataSensitivityDiscovery + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DefenderCspmAwsOfferingDataSensitivityDiscovery(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Enabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingDataSensitivityDiscoveryInternal)this).Enabled = (bool?) content.GetValueForProperty("Enabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingDataSensitivityDiscoveryInternal)this).Enabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("CloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingDataSensitivityDiscoveryInternal)this).CloudRoleArn = (string) content.GetValueForProperty("CloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingDataSensitivityDiscoveryInternal)this).CloudRoleArn, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DefenderCspmAwsOfferingDataSensitivityDiscovery(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Enabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingDataSensitivityDiscoveryInternal)this).Enabled = (bool?) content.GetValueForProperty("Enabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingDataSensitivityDiscoveryInternal)this).Enabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("CloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingDataSensitivityDiscoveryInternal)this).CloudRoleArn = (string) content.GetValueForProperty("CloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingDataSensitivityDiscoveryInternal)this).CloudRoleArn, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingDataSensitivityDiscovery DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DefenderCspmAwsOfferingDataSensitivityDiscovery(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingDataSensitivityDiscovery DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DefenderCspmAwsOfferingDataSensitivityDiscovery(content); + } + + /// + /// Creates a new instance of , deserializing the content from + /// a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingDataSensitivityDiscovery FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The Microsoft Defender Data Sensitivity discovery configuration + [System.ComponentModel.TypeConverter(typeof(DefenderCspmAwsOfferingDataSensitivityDiscoveryTypeConverter))] + public partial interface IDefenderCspmAwsOfferingDataSensitivityDiscovery + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingDataSensitivityDiscovery.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingDataSensitivityDiscovery.TypeConverter.cs new file mode 100644 index 000000000000..64ebb9296413 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingDataSensitivityDiscovery.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DefenderCspmAwsOfferingDataSensitivityDiscoveryTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, + /// otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingDataSensitivityDiscovery ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingDataSensitivityDiscovery).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DefenderCspmAwsOfferingDataSensitivityDiscovery.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DefenderCspmAwsOfferingDataSensitivityDiscovery.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DefenderCspmAwsOfferingDataSensitivityDiscovery.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingDataSensitivityDiscovery.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingDataSensitivityDiscovery.cs new file mode 100644 index 000000000000..7a247d1ce0db --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingDataSensitivityDiscovery.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The Microsoft Defender Data Sensitivity discovery configuration + public partial class DefenderCspmAwsOfferingDataSensitivityDiscovery : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingDataSensitivityDiscovery, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingDataSensitivityDiscoveryInternal + { + + /// Backing field for property. + private string _cloudRoleArn; + + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string CloudRoleArn { get => this._cloudRoleArn; set => this._cloudRoleArn = value; } + + /// Backing field for property. + private bool? _enabled; + + /// Is Microsoft Defender Data Sensitivity discovery enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public bool? Enabled { get => this._enabled; set => this._enabled = value; } + + /// + /// Creates an new instance. + /// + public DefenderCspmAwsOfferingDataSensitivityDiscovery() + { + + } + } + /// The Microsoft Defender Data Sensitivity discovery configuration + public partial interface IDefenderCspmAwsOfferingDataSensitivityDiscovery : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The cloud role ARN in AWS for this feature", + SerializedName = @"cloudRoleArn", + PossibleTypes = new [] { typeof(string) })] + string CloudRoleArn { get; set; } + /// Is Microsoft Defender Data Sensitivity discovery enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Is Microsoft Defender Data Sensitivity discovery enabled", + SerializedName = @"enabled", + PossibleTypes = new [] { typeof(bool) })] + bool? Enabled { get; set; } + + } + /// The Microsoft Defender Data Sensitivity discovery configuration + internal partial interface IDefenderCspmAwsOfferingDataSensitivityDiscoveryInternal + + { + /// The cloud role ARN in AWS for this feature + string CloudRoleArn { get; set; } + /// Is Microsoft Defender Data Sensitivity discovery enabled + bool? Enabled { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingDataSensitivityDiscovery.json.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingDataSensitivityDiscovery.json.cs new file mode 100644 index 000000000000..3e7d6ea52218 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingDataSensitivityDiscovery.json.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The Microsoft Defender Data Sensitivity discovery configuration + public partial class DefenderCspmAwsOfferingDataSensitivityDiscovery + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal DefenderCspmAwsOfferingDataSensitivityDiscovery(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_enabled = If( json?.PropertyT("enabled"), out var __jsonEnabled) ? (bool?)__jsonEnabled : _enabled;} + {_cloudRoleArn = If( json?.PropertyT("cloudRoleArn"), out var __jsonCloudRoleArn) ? (string)__jsonCloudRoleArn : (string)_cloudRoleArn;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingDataSensitivityDiscovery. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingDataSensitivityDiscovery. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingDataSensitivityDiscovery FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DefenderCspmAwsOfferingDataSensitivityDiscovery(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._enabled ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonBoolean((bool)this._enabled) : null, "enabled" ,container.Add ); + AddIf( null != (((object)this._cloudRoleArn)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._cloudRoleArn.ToString()) : null, "cloudRoleArn" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingDatabasesDspm.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingDatabasesDspm.PowerShell.cs new file mode 100644 index 000000000000..cf5c83f2b98c --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingDatabasesDspm.PowerShell.cs @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The databases DSPM configuration + [System.ComponentModel.TypeConverter(typeof(DefenderCspmAwsOfferingDatabasesDspmTypeConverter))] + public partial class DefenderCspmAwsOfferingDatabasesDspm + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DefenderCspmAwsOfferingDatabasesDspm(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Enabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingDatabasesDspmInternal)this).Enabled = (bool?) content.GetValueForProperty("Enabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingDatabasesDspmInternal)this).Enabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("CloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingDatabasesDspmInternal)this).CloudRoleArn = (string) content.GetValueForProperty("CloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingDatabasesDspmInternal)this).CloudRoleArn, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DefenderCspmAwsOfferingDatabasesDspm(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Enabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingDatabasesDspmInternal)this).Enabled = (bool?) content.GetValueForProperty("Enabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingDatabasesDspmInternal)this).Enabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("CloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingDatabasesDspmInternal)this).CloudRoleArn = (string) content.GetValueForProperty("CloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingDatabasesDspmInternal)this).CloudRoleArn, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingDatabasesDspm DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DefenderCspmAwsOfferingDatabasesDspm(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingDatabasesDspm DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DefenderCspmAwsOfferingDatabasesDspm(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingDatabasesDspm FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The databases DSPM configuration + [System.ComponentModel.TypeConverter(typeof(DefenderCspmAwsOfferingDatabasesDspmTypeConverter))] + public partial interface IDefenderCspmAwsOfferingDatabasesDspm + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingDatabasesDspm.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingDatabasesDspm.TypeConverter.cs new file mode 100644 index 000000000000..81f100e1df65 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingDatabasesDspm.TypeConverter.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DefenderCspmAwsOfferingDatabasesDspmTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingDatabasesDspm ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingDatabasesDspm).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DefenderCspmAwsOfferingDatabasesDspm.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DefenderCspmAwsOfferingDatabasesDspm.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DefenderCspmAwsOfferingDatabasesDspm.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingDatabasesDspm.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingDatabasesDspm.cs new file mode 100644 index 000000000000..e78bf39969d8 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingDatabasesDspm.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The databases DSPM configuration + public partial class DefenderCspmAwsOfferingDatabasesDspm : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingDatabasesDspm, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingDatabasesDspmInternal + { + + /// Backing field for property. + private string _cloudRoleArn; + + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string CloudRoleArn { get => this._cloudRoleArn; set => this._cloudRoleArn = value; } + + /// Backing field for property. + private bool? _enabled; + + /// Is databases DSPM protection enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public bool? Enabled { get => this._enabled; set => this._enabled = value; } + + /// Creates an new instance. + public DefenderCspmAwsOfferingDatabasesDspm() + { + + } + } + /// The databases DSPM configuration + public partial interface IDefenderCspmAwsOfferingDatabasesDspm : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The cloud role ARN in AWS for this feature", + SerializedName = @"cloudRoleArn", + PossibleTypes = new [] { typeof(string) })] + string CloudRoleArn { get; set; } + /// Is databases DSPM protection enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Is databases DSPM protection enabled", + SerializedName = @"enabled", + PossibleTypes = new [] { typeof(bool) })] + bool? Enabled { get; set; } + + } + /// The databases DSPM configuration + internal partial interface IDefenderCspmAwsOfferingDatabasesDspmInternal + + { + /// The cloud role ARN in AWS for this feature + string CloudRoleArn { get; set; } + /// Is databases DSPM protection enabled + bool? Enabled { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingDatabasesDspm.json.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingDatabasesDspm.json.cs new file mode 100644 index 000000000000..bc20d06becf2 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingDatabasesDspm.json.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The databases DSPM configuration + public partial class DefenderCspmAwsOfferingDatabasesDspm + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal DefenderCspmAwsOfferingDatabasesDspm(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_enabled = If( json?.PropertyT("enabled"), out var __jsonEnabled) ? (bool?)__jsonEnabled : _enabled;} + {_cloudRoleArn = If( json?.PropertyT("cloudRoleArn"), out var __jsonCloudRoleArn) ? (string)__jsonCloudRoleArn : (string)_cloudRoleArn;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingDatabasesDspm. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingDatabasesDspm. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingDatabasesDspm FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DefenderCspmAwsOfferingDatabasesDspm(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._enabled ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonBoolean((bool)this._enabled) : null, "enabled" ,container.Add ); + AddIf( null != (((object)this._cloudRoleArn)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._cloudRoleArn.ToString()) : null, "cloudRoleArn" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S.PowerShell.cs new file mode 100644 index 000000000000..db676da92a6d --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S.PowerShell.cs @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The Microsoft Defender container agentless discovery K8s configuration + [System.ComponentModel.TypeConverter(typeof(DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8STypeConverter))] + public partial class DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Enabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8SInternal)this).Enabled = (bool?) content.GetValueForProperty("Enabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8SInternal)this).Enabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("CloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8SInternal)this).CloudRoleArn = (string) content.GetValueForProperty("CloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8SInternal)this).CloudRoleArn, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Enabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8SInternal)this).Enabled = (bool?) content.GetValueForProperty("Enabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8SInternal)this).Enabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("CloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8SInternal)this).CloudRoleArn = (string) content.GetValueForProperty("CloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8SInternal)this).CloudRoleArn, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S(content); + } + + /// + /// Creates a new instance of , deserializing the + /// content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The Microsoft Defender container agentless discovery K8s configuration + [System.ComponentModel.TypeConverter(typeof(DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8STypeConverter))] + public partial interface IDefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S.TypeConverter.cs new file mode 100644 index 000000000000..136169a16dd8 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8STypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no + /// suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no + /// suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S.cs new file mode 100644 index 000000000000..e4e96bc531be --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The Microsoft Defender container agentless discovery K8s configuration + public partial class DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8SInternal + { + + /// Backing field for property. + private string _cloudRoleArn; + + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string CloudRoleArn { get => this._cloudRoleArn; set => this._cloudRoleArn = value; } + + /// Backing field for property. + private bool? _enabled; + + /// Is Microsoft Defender container agentless discovery K8s enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public bool? Enabled { get => this._enabled; set => this._enabled = value; } + + /// + /// Creates an new instance. + /// + public DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S() + { + + } + } + /// The Microsoft Defender container agentless discovery K8s configuration + public partial interface IDefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The cloud role ARN in AWS for this feature", + SerializedName = @"cloudRoleArn", + PossibleTypes = new [] { typeof(string) })] + string CloudRoleArn { get; set; } + /// Is Microsoft Defender container agentless discovery K8s enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Is Microsoft Defender container agentless discovery K8s enabled", + SerializedName = @"enabled", + PossibleTypes = new [] { typeof(bool) })] + bool? Enabled { get; set; } + + } + /// The Microsoft Defender container agentless discovery K8s configuration + internal partial interface IDefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8SInternal + + { + /// The cloud role ARN in AWS for this feature + string CloudRoleArn { get; set; } + /// Is Microsoft Defender container agentless discovery K8s enabled + bool? Enabled { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S.json.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S.json.cs new file mode 100644 index 000000000000..e0faf5a6208e --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S.json.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The Microsoft Defender container agentless discovery K8s configuration + public partial class DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_enabled = If( json?.PropertyT("enabled"), out var __jsonEnabled) ? (bool?)__jsonEnabled : _enabled;} + {_cloudRoleArn = If( json?.PropertyT("cloudRoleArn"), out var __jsonCloudRoleArn) ? (string)__jsonCloudRoleArn : (string)_cloudRoleArn;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._enabled ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonBoolean((bool)this._enabled) : null, "enabled" ,container.Add ); + AddIf( null != (((object)this._cloudRoleArn)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._cloudRoleArn.ToString()) : null, "cloudRoleArn" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingMdcContainersImageAssessment.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingMdcContainersImageAssessment.PowerShell.cs new file mode 100644 index 000000000000..ac4c9da57084 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingMdcContainersImageAssessment.PowerShell.cs @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The Microsoft Defender container image assessment configuration + [System.ComponentModel.TypeConverter(typeof(DefenderCspmAwsOfferingMdcContainersImageAssessmentTypeConverter))] + public partial class DefenderCspmAwsOfferingMdcContainersImageAssessment + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DefenderCspmAwsOfferingMdcContainersImageAssessment(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Enabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingMdcContainersImageAssessmentInternal)this).Enabled = (bool?) content.GetValueForProperty("Enabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingMdcContainersImageAssessmentInternal)this).Enabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("CloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingMdcContainersImageAssessmentInternal)this).CloudRoleArn = (string) content.GetValueForProperty("CloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingMdcContainersImageAssessmentInternal)this).CloudRoleArn, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DefenderCspmAwsOfferingMdcContainersImageAssessment(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Enabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingMdcContainersImageAssessmentInternal)this).Enabled = (bool?) content.GetValueForProperty("Enabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingMdcContainersImageAssessmentInternal)this).Enabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("CloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingMdcContainersImageAssessmentInternal)this).CloudRoleArn = (string) content.GetValueForProperty("CloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingMdcContainersImageAssessmentInternal)this).CloudRoleArn, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingMdcContainersImageAssessment DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DefenderCspmAwsOfferingMdcContainersImageAssessment(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingMdcContainersImageAssessment DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DefenderCspmAwsOfferingMdcContainersImageAssessment(content); + } + + /// + /// Creates a new instance of , deserializing the content + /// from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingMdcContainersImageAssessment FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The Microsoft Defender container image assessment configuration + [System.ComponentModel.TypeConverter(typeof(DefenderCspmAwsOfferingMdcContainersImageAssessmentTypeConverter))] + public partial interface IDefenderCspmAwsOfferingMdcContainersImageAssessment + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingMdcContainersImageAssessment.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingMdcContainersImageAssessment.TypeConverter.cs new file mode 100644 index 000000000000..e85e56e951af --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingMdcContainersImageAssessment.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DefenderCspmAwsOfferingMdcContainersImageAssessmentTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a + /// type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingMdcContainersImageAssessment ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingMdcContainersImageAssessment).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DefenderCspmAwsOfferingMdcContainersImageAssessment.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DefenderCspmAwsOfferingMdcContainersImageAssessment.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DefenderCspmAwsOfferingMdcContainersImageAssessment.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingMdcContainersImageAssessment.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingMdcContainersImageAssessment.cs new file mode 100644 index 000000000000..153215a2222c --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingMdcContainersImageAssessment.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The Microsoft Defender container image assessment configuration + public partial class DefenderCspmAwsOfferingMdcContainersImageAssessment : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingMdcContainersImageAssessment, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingMdcContainersImageAssessmentInternal + { + + /// Backing field for property. + private string _cloudRoleArn; + + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string CloudRoleArn { get => this._cloudRoleArn; set => this._cloudRoleArn = value; } + + /// Backing field for property. + private bool? _enabled; + + /// Is Microsoft Defender container image assessment enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public bool? Enabled { get => this._enabled; set => this._enabled = value; } + + /// + /// Creates an new instance. + /// + public DefenderCspmAwsOfferingMdcContainersImageAssessment() + { + + } + } + /// The Microsoft Defender container image assessment configuration + public partial interface IDefenderCspmAwsOfferingMdcContainersImageAssessment : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The cloud role ARN in AWS for this feature", + SerializedName = @"cloudRoleArn", + PossibleTypes = new [] { typeof(string) })] + string CloudRoleArn { get; set; } + /// Is Microsoft Defender container image assessment enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Is Microsoft Defender container image assessment enabled", + SerializedName = @"enabled", + PossibleTypes = new [] { typeof(bool) })] + bool? Enabled { get; set; } + + } + /// The Microsoft Defender container image assessment configuration + internal partial interface IDefenderCspmAwsOfferingMdcContainersImageAssessmentInternal + + { + /// The cloud role ARN in AWS for this feature + string CloudRoleArn { get; set; } + /// Is Microsoft Defender container image assessment enabled + bool? Enabled { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingMdcContainersImageAssessment.json.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingMdcContainersImageAssessment.json.cs new file mode 100644 index 000000000000..e4d938e0b0ee --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingMdcContainersImageAssessment.json.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The Microsoft Defender container image assessment configuration + public partial class DefenderCspmAwsOfferingMdcContainersImageAssessment + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal DefenderCspmAwsOfferingMdcContainersImageAssessment(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_enabled = If( json?.PropertyT("enabled"), out var __jsonEnabled) ? (bool?)__jsonEnabled : _enabled;} + {_cloudRoleArn = If( json?.PropertyT("cloudRoleArn"), out var __jsonCloudRoleArn) ? (string)__jsonCloudRoleArn : (string)_cloudRoleArn;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingMdcContainersImageAssessment. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingMdcContainersImageAssessment. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingMdcContainersImageAssessment FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DefenderCspmAwsOfferingMdcContainersImageAssessment(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._enabled ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonBoolean((bool)this._enabled) : null, "enabled" ,container.Add ); + AddIf( null != (((object)this._cloudRoleArn)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._cloudRoleArn.ToString()) : null, "cloudRoleArn" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingVMScanners.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingVMScanners.PowerShell.cs new file mode 100644 index 000000000000..1cbe813099bb --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingVMScanners.PowerShell.cs @@ -0,0 +1,198 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The Microsoft Defender for Server VM scanning configuration + [System.ComponentModel.TypeConverter(typeof(DefenderCspmAwsOfferingVMScannersTypeConverter))] + public partial class DefenderCspmAwsOfferingVMScanners + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DefenderCspmAwsOfferingVMScanners(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Configuration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersInternal)this).Configuration = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfiguration) content.GetValueForProperty("Configuration",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersInternal)this).Configuration, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingVMScannersConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("Enabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersInternal)this).Enabled = (bool?) content.GetValueForProperty("Enabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersInternal)this).Enabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ConfigurationScanningMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersInternal)this).ConfigurationScanningMode = (string) content.GetValueForProperty("ConfigurationScanningMode",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersInternal)this).ConfigurationScanningMode, global::System.Convert.ToString); + } + if (content.Contains("ConfigurationCloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersInternal)this).ConfigurationCloudRoleArn = (string) content.GetValueForProperty("ConfigurationCloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersInternal)this).ConfigurationCloudRoleArn, global::System.Convert.ToString); + } + if (content.Contains("ConfigurationExclusionTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersInternal)this).ConfigurationExclusionTag = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfigurationExclusionTags) content.GetValueForProperty("ConfigurationExclusionTag",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersInternal)this).ConfigurationExclusionTag, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingVMScannersConfigurationExclusionTagsTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DefenderCspmAwsOfferingVMScanners(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Configuration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersInternal)this).Configuration = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfiguration) content.GetValueForProperty("Configuration",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersInternal)this).Configuration, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingVMScannersConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("Enabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersInternal)this).Enabled = (bool?) content.GetValueForProperty("Enabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersInternal)this).Enabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ConfigurationScanningMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersInternal)this).ConfigurationScanningMode = (string) content.GetValueForProperty("ConfigurationScanningMode",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersInternal)this).ConfigurationScanningMode, global::System.Convert.ToString); + } + if (content.Contains("ConfigurationCloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersInternal)this).ConfigurationCloudRoleArn = (string) content.GetValueForProperty("ConfigurationCloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersInternal)this).ConfigurationCloudRoleArn, global::System.Convert.ToString); + } + if (content.Contains("ConfigurationExclusionTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersInternal)this).ConfigurationExclusionTag = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfigurationExclusionTags) content.GetValueForProperty("ConfigurationExclusionTag",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersInternal)this).ConfigurationExclusionTag, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingVMScannersConfigurationExclusionTagsTypeConverter.ConvertFrom); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScanners DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DefenderCspmAwsOfferingVMScanners(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScanners DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DefenderCspmAwsOfferingVMScanners(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScanners FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The Microsoft Defender for Server VM scanning configuration + [System.ComponentModel.TypeConverter(typeof(DefenderCspmAwsOfferingVMScannersTypeConverter))] + public partial interface IDefenderCspmAwsOfferingVMScanners + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingVMScanners.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingVMScanners.TypeConverter.cs new file mode 100644 index 000000000000..3cc7a7ab4389 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingVMScanners.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DefenderCspmAwsOfferingVMScannersTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScanners ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScanners).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DefenderCspmAwsOfferingVMScanners.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DefenderCspmAwsOfferingVMScanners.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DefenderCspmAwsOfferingVMScanners.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingVMScanners.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingVMScanners.cs new file mode 100644 index 000000000000..81f7db720cce --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingVMScanners.cs @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The Microsoft Defender for Server VM scanning configuration + public partial class DefenderCspmAwsOfferingVMScanners : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScanners, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfiguration _configuration; + + /// configuration for Microsoft Defender for Server VM scanning + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfiguration Configuration { get => (this._configuration = this._configuration ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingVMScannersConfiguration()); set => this._configuration = value; } + + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string ConfigurationCloudRoleArn { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfigurationInternal)Configuration).CloudRoleArn; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfigurationInternal)Configuration).CloudRoleArn = value ?? null; } + + /// VM tags that indicates that VM should not be scanned + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfigurationExclusionTags ConfigurationExclusionTag { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfigurationInternal)Configuration).ExclusionTag; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfigurationInternal)Configuration).ExclusionTag = value ?? null /* model class */; } + + /// The scanning mode for the VM scan. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string ConfigurationScanningMode { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfigurationInternal)Configuration).ScanningMode; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfigurationInternal)Configuration).ScanningMode = value ?? null; } + + /// Backing field for property. + private bool? _enabled; + + /// Is Microsoft Defender for Server VM scanning enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public bool? Enabled { get => this._enabled; set => this._enabled = value; } + + /// Internal Acessors for Configuration + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfiguration Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersInternal.Configuration { get => (this._configuration = this._configuration ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingVMScannersConfiguration()); set { {_configuration = value;} } } + + /// Creates an new instance. + public DefenderCspmAwsOfferingVMScanners() + { + + } + } + /// The Microsoft Defender for Server VM scanning configuration + public partial interface IDefenderCspmAwsOfferingVMScanners : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The cloud role ARN in AWS for this feature", + SerializedName = @"cloudRoleArn", + PossibleTypes = new [] { typeof(string) })] + string ConfigurationCloudRoleArn { get; set; } + /// VM tags that indicates that VM should not be scanned + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"VM tags that indicates that VM should not be scanned", + SerializedName = @"exclusionTags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfigurationExclusionTags) })] + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfigurationExclusionTags ConfigurationExclusionTag { get; set; } + /// The scanning mode for the VM scan. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The scanning mode for the VM scan.", + SerializedName = @"scanningMode", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Default")] + string ConfigurationScanningMode { get; set; } + /// Is Microsoft Defender for Server VM scanning enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Is Microsoft Defender for Server VM scanning enabled", + SerializedName = @"enabled", + PossibleTypes = new [] { typeof(bool) })] + bool? Enabled { get; set; } + + } + /// The Microsoft Defender for Server VM scanning configuration + internal partial interface IDefenderCspmAwsOfferingVMScannersInternal + + { + /// configuration for Microsoft Defender for Server VM scanning + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfiguration Configuration { get; set; } + /// The cloud role ARN in AWS for this feature + string ConfigurationCloudRoleArn { get; set; } + /// VM tags that indicates that VM should not be scanned + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfigurationExclusionTags ConfigurationExclusionTag { get; set; } + /// The scanning mode for the VM scan. + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Default")] + string ConfigurationScanningMode { get; set; } + /// Is Microsoft Defender for Server VM scanning enabled + bool? Enabled { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingVMScanners.json.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingVMScanners.json.cs new file mode 100644 index 000000000000..cf32033ce544 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingVMScanners.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The Microsoft Defender for Server VM scanning configuration + public partial class DefenderCspmAwsOfferingVMScanners + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal DefenderCspmAwsOfferingVMScanners(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_configuration = If( json?.PropertyT("configuration"), out var __jsonConfiguration) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingVMScannersConfiguration.FromJson(__jsonConfiguration) : _configuration;} + {_enabled = If( json?.PropertyT("enabled"), out var __jsonEnabled) ? (bool?)__jsonEnabled : _enabled;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScanners. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScanners. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScanners FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DefenderCspmAwsOfferingVMScanners(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._configuration ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._configuration.ToJson(null,serializationMode) : null, "configuration" ,container.Add ); + AddIf( null != this._enabled ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonBoolean((bool)this._enabled) : null, "enabled" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingVMScannersConfiguration.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingVMScannersConfiguration.PowerShell.cs new file mode 100644 index 000000000000..4aaf2373c150 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingVMScannersConfiguration.PowerShell.cs @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// configuration for Microsoft Defender for Server VM scanning + [System.ComponentModel.TypeConverter(typeof(DefenderCspmAwsOfferingVMScannersConfigurationTypeConverter))] + public partial class DefenderCspmAwsOfferingVMScannersConfiguration + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DefenderCspmAwsOfferingVMScannersConfiguration(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfigurationInternal)this).CloudRoleArn = (string) content.GetValueForProperty("CloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfigurationInternal)this).CloudRoleArn, global::System.Convert.ToString); + } + if (content.Contains("ScanningMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfigurationInternal)this).ScanningMode = (string) content.GetValueForProperty("ScanningMode",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfigurationInternal)this).ScanningMode, global::System.Convert.ToString); + } + if (content.Contains("ExclusionTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfigurationInternal)this).ExclusionTag = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfigurationExclusionTags) content.GetValueForProperty("ExclusionTag",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfigurationInternal)this).ExclusionTag, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingVMScannersConfigurationExclusionTagsTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DefenderCspmAwsOfferingVMScannersConfiguration(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfigurationInternal)this).CloudRoleArn = (string) content.GetValueForProperty("CloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfigurationInternal)this).CloudRoleArn, global::System.Convert.ToString); + } + if (content.Contains("ScanningMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfigurationInternal)this).ScanningMode = (string) content.GetValueForProperty("ScanningMode",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfigurationInternal)this).ScanningMode, global::System.Convert.ToString); + } + if (content.Contains("ExclusionTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfigurationInternal)this).ExclusionTag = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfigurationExclusionTags) content.GetValueForProperty("ExclusionTag",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfigurationInternal)this).ExclusionTag, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingVMScannersConfigurationExclusionTagsTypeConverter.ConvertFrom); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfiguration DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DefenderCspmAwsOfferingVMScannersConfiguration(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfiguration DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DefenderCspmAwsOfferingVMScannersConfiguration(content); + } + + /// + /// Creates a new instance of , deserializing the content from + /// a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfiguration FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// configuration for Microsoft Defender for Server VM scanning + [System.ComponentModel.TypeConverter(typeof(DefenderCspmAwsOfferingVMScannersConfigurationTypeConverter))] + public partial interface IDefenderCspmAwsOfferingVMScannersConfiguration + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingVMScannersConfiguration.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingVMScannersConfiguration.TypeConverter.cs new file mode 100644 index 000000000000..1a4b3aab914f --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingVMScannersConfiguration.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DefenderCspmAwsOfferingVMScannersConfigurationTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, + /// otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfiguration ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfiguration).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DefenderCspmAwsOfferingVMScannersConfiguration.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DefenderCspmAwsOfferingVMScannersConfiguration.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DefenderCspmAwsOfferingVMScannersConfiguration.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingVMScannersConfiguration.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingVMScannersConfiguration.cs new file mode 100644 index 000000000000..e11b66c7728c --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingVMScannersConfiguration.cs @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// configuration for Microsoft Defender for Server VM scanning + public partial class DefenderCspmAwsOfferingVMScannersConfiguration : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfiguration, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfigurationInternal + { + + /// Backing field for property. + private string _cloudRoleArn; + + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string CloudRoleArn { get => this._cloudRoleArn; set => this._cloudRoleArn = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfigurationExclusionTags _exclusionTag; + + /// VM tags that indicates that VM should not be scanned + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfigurationExclusionTags ExclusionTag { get => (this._exclusionTag = this._exclusionTag ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingVMScannersConfigurationExclusionTags()); set => this._exclusionTag = value; } + + /// Backing field for property. + private string _scanningMode; + + /// The scanning mode for the VM scan. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string ScanningMode { get => this._scanningMode; set => this._scanningMode = value; } + + /// + /// Creates an new instance. + /// + public DefenderCspmAwsOfferingVMScannersConfiguration() + { + + } + } + /// configuration for Microsoft Defender for Server VM scanning + public partial interface IDefenderCspmAwsOfferingVMScannersConfiguration : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The cloud role ARN in AWS for this feature", + SerializedName = @"cloudRoleArn", + PossibleTypes = new [] { typeof(string) })] + string CloudRoleArn { get; set; } + /// VM tags that indicates that VM should not be scanned + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"VM tags that indicates that VM should not be scanned", + SerializedName = @"exclusionTags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfigurationExclusionTags) })] + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfigurationExclusionTags ExclusionTag { get; set; } + /// The scanning mode for the VM scan. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The scanning mode for the VM scan.", + SerializedName = @"scanningMode", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Default")] + string ScanningMode { get; set; } + + } + /// configuration for Microsoft Defender for Server VM scanning + internal partial interface IDefenderCspmAwsOfferingVMScannersConfigurationInternal + + { + /// The cloud role ARN in AWS for this feature + string CloudRoleArn { get; set; } + /// VM tags that indicates that VM should not be scanned + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfigurationExclusionTags ExclusionTag { get; set; } + /// The scanning mode for the VM scan. + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Default")] + string ScanningMode { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingVMScannersConfiguration.json.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingVMScannersConfiguration.json.cs new file mode 100644 index 000000000000..aca17aa9fbc3 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingVMScannersConfiguration.json.cs @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// configuration for Microsoft Defender for Server VM scanning + public partial class DefenderCspmAwsOfferingVMScannersConfiguration + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal DefenderCspmAwsOfferingVMScannersConfiguration(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_cloudRoleArn = If( json?.PropertyT("cloudRoleArn"), out var __jsonCloudRoleArn) ? (string)__jsonCloudRoleArn : (string)_cloudRoleArn;} + {_scanningMode = If( json?.PropertyT("scanningMode"), out var __jsonScanningMode) ? (string)__jsonScanningMode : (string)_scanningMode;} + {_exclusionTag = If( json?.PropertyT("exclusionTags"), out var __jsonExclusionTags) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingVMScannersConfigurationExclusionTags.FromJson(__jsonExclusionTags) : _exclusionTag;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfiguration. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfiguration. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfiguration FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DefenderCspmAwsOfferingVMScannersConfiguration(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._cloudRoleArn)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._cloudRoleArn.ToString()) : null, "cloudRoleArn" ,container.Add ); + AddIf( null != (((object)this._scanningMode)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._scanningMode.ToString()) : null, "scanningMode" ,container.Add ); + AddIf( null != this._exclusionTag ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._exclusionTag.ToJson(null,serializationMode) : null, "exclusionTags" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingVMScannersConfigurationExclusionTags.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingVMScannersConfigurationExclusionTags.PowerShell.cs new file mode 100644 index 000000000000..3b9774e59ddf --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingVMScannersConfigurationExclusionTags.PowerShell.cs @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// VM tags that indicates that VM should not be scanned + [System.ComponentModel.TypeConverter(typeof(DefenderCspmAwsOfferingVMScannersConfigurationExclusionTagsTypeConverter))] + public partial class DefenderCspmAwsOfferingVMScannersConfigurationExclusionTags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DefenderCspmAwsOfferingVMScannersConfigurationExclusionTags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DefenderCspmAwsOfferingVMScannersConfigurationExclusionTags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfigurationExclusionTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DefenderCspmAwsOfferingVMScannersConfigurationExclusionTags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfigurationExclusionTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DefenderCspmAwsOfferingVMScannersConfigurationExclusionTags(content); + } + + /// + /// Creates a new instance of , deserializing the + /// content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfigurationExclusionTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// VM tags that indicates that VM should not be scanned + [System.ComponentModel.TypeConverter(typeof(DefenderCspmAwsOfferingVMScannersConfigurationExclusionTagsTypeConverter))] + public partial interface IDefenderCspmAwsOfferingVMScannersConfigurationExclusionTags + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingVMScannersConfigurationExclusionTags.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingVMScannersConfigurationExclusionTags.TypeConverter.cs new file mode 100644 index 000000000000..6722f21ff5a4 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingVMScannersConfigurationExclusionTags.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DefenderCspmAwsOfferingVMScannersConfigurationExclusionTagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is + /// no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is + /// no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfigurationExclusionTags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfigurationExclusionTags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DefenderCspmAwsOfferingVMScannersConfigurationExclusionTags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DefenderCspmAwsOfferingVMScannersConfigurationExclusionTags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DefenderCspmAwsOfferingVMScannersConfigurationExclusionTags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingVMScannersConfigurationExclusionTags.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingVMScannersConfigurationExclusionTags.cs new file mode 100644 index 000000000000..692ad1f497a7 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingVMScannersConfigurationExclusionTags.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// VM tags that indicates that VM should not be scanned + public partial class DefenderCspmAwsOfferingVMScannersConfigurationExclusionTags : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfigurationExclusionTags, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfigurationExclusionTagsInternal + { + + /// + /// Creates an new instance. + /// + public DefenderCspmAwsOfferingVMScannersConfigurationExclusionTags() + { + + } + } + /// VM tags that indicates that VM should not be scanned + public partial interface IDefenderCspmAwsOfferingVMScannersConfigurationExclusionTags : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray + { + + } + /// VM tags that indicates that VM should not be scanned + internal partial interface IDefenderCspmAwsOfferingVMScannersConfigurationExclusionTagsInternal + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingVMScannersConfigurationExclusionTags.dictionary.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingVMScannersConfigurationExclusionTags.dictionary.cs new file mode 100644 index 000000000000..1f127bd2b11a --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingVMScannersConfigurationExclusionTags.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + public partial class DefenderCspmAwsOfferingVMScannersConfigurationExclusionTags : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOfferingVMScannersConfigurationExclusionTags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingVMScannersConfigurationExclusionTags.json.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingVMScannersConfigurationExclusionTags.json.cs new file mode 100644 index 000000000000..fe977b18c399 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmAwsOfferingVMScannersConfigurationExclusionTags.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// VM tags that indicates that VM should not be scanned + public partial class DefenderCspmAwsOfferingVMScannersConfigurationExclusionTags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + /// + internal DefenderCspmAwsOfferingVMScannersConfigurationExclusionTags(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfigurationExclusionTags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfigurationExclusionTags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfigurationExclusionTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DefenderCspmAwsOfferingVMScannersConfigurationExclusionTags(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOffering.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOffering.PowerShell.cs new file mode 100644 index 000000000000..57391f44f2b2 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOffering.PowerShell.cs @@ -0,0 +1,340 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The CSPM P1 for GCP offering + [System.ComponentModel.TypeConverter(typeof(DefenderCspmGcpOfferingTypeConverter))] + public partial class DefenderCspmGcpOffering + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DefenderCspmGcpOffering(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CiemDiscovery")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).CiemDiscovery = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingCiemDiscovery) content.GetValueForProperty("CiemDiscovery",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).CiemDiscovery, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmGcpOfferingCiemDiscoveryTypeConverter.ConvertFrom); + } + if (content.Contains("VMScanner")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).VMScanner = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScanners) content.GetValueForProperty("VMScanner",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).VMScanner, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmGcpOfferingVMScannersTypeConverter.ConvertFrom); + } + if (content.Contains("DataSensitivityDiscovery")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).DataSensitivityDiscovery = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingDataSensitivityDiscovery) content.GetValueForProperty("DataSensitivityDiscovery",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).DataSensitivityDiscovery, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmGcpOfferingDataSensitivityDiscoveryTypeConverter.ConvertFrom); + } + if (content.Contains("MdcContainersImageAssessment")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).MdcContainersImageAssessment = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingMdcContainersImageAssessment) content.GetValueForProperty("MdcContainersImageAssessment",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).MdcContainersImageAssessment, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmGcpOfferingMdcContainersImageAssessmentTypeConverter.ConvertFrom); + } + if (content.Contains("MdcContainersAgentlessDiscoveryK8S")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).MdcContainersAgentlessDiscoveryK8S = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S) content.GetValueForProperty("MdcContainersAgentlessDiscoveryK8S",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).MdcContainersAgentlessDiscoveryK8S, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8STypeConverter.ConvertFrom); + } + if (content.Contains("OfferingType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType = (string) content.GetValueForProperty("OfferingType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType, global::System.Convert.ToString); + } + if (content.Contains("Description")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description, global::System.Convert.ToString); + } + if (content.Contains("CiemDiscoveryWorkloadIdentityProviderId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).CiemDiscoveryWorkloadIdentityProviderId = (string) content.GetValueForProperty("CiemDiscoveryWorkloadIdentityProviderId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).CiemDiscoveryWorkloadIdentityProviderId, global::System.Convert.ToString); + } + if (content.Contains("CiemDiscoveryServiceAccountEmailAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).CiemDiscoveryServiceAccountEmailAddress = (string) content.GetValueForProperty("CiemDiscoveryServiceAccountEmailAddress",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).CiemDiscoveryServiceAccountEmailAddress, global::System.Convert.ToString); + } + if (content.Contains("CiemDiscoveryAzureActiveDirectoryAppName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).CiemDiscoveryAzureActiveDirectoryAppName = (string) content.GetValueForProperty("CiemDiscoveryAzureActiveDirectoryAppName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).CiemDiscoveryAzureActiveDirectoryAppName, global::System.Convert.ToString); + } + if (content.Contains("VMScannerConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).VMScannerConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersConfiguration) content.GetValueForProperty("VMScannerConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).VMScannerConfiguration, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmGcpOfferingVMScannersConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("VMScannerEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).VMScannerEnabled = (bool?) content.GetValueForProperty("VMScannerEnabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).VMScannerEnabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ConfigurationScanningMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).ConfigurationScanningMode = (string) content.GetValueForProperty("ConfigurationScanningMode",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).ConfigurationScanningMode, global::System.Convert.ToString); + } + if (content.Contains("DataSensitivityDiscoveryEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).DataSensitivityDiscoveryEnabled = (bool?) content.GetValueForProperty("DataSensitivityDiscoveryEnabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).DataSensitivityDiscoveryEnabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("DataSensitivityDiscoveryWorkloadIdentityProviderId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).DataSensitivityDiscoveryWorkloadIdentityProviderId = (string) content.GetValueForProperty("DataSensitivityDiscoveryWorkloadIdentityProviderId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).DataSensitivityDiscoveryWorkloadIdentityProviderId, global::System.Convert.ToString); + } + if (content.Contains("DataSensitivityDiscoveryServiceAccountEmailAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).DataSensitivityDiscoveryServiceAccountEmailAddress = (string) content.GetValueForProperty("DataSensitivityDiscoveryServiceAccountEmailAddress",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).DataSensitivityDiscoveryServiceAccountEmailAddress, global::System.Convert.ToString); + } + if (content.Contains("MdcContainerImageAssessmentEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).MdcContainerImageAssessmentEnabled = (bool?) content.GetValueForProperty("MdcContainerImageAssessmentEnabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).MdcContainerImageAssessmentEnabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("MdcContainerImageAssessmentWorkloadIdentityProviderId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).MdcContainerImageAssessmentWorkloadIdentityProviderId = (string) content.GetValueForProperty("MdcContainerImageAssessmentWorkloadIdentityProviderId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).MdcContainerImageAssessmentWorkloadIdentityProviderId, global::System.Convert.ToString); + } + if (content.Contains("MdcContainerImageAssessmentServiceAccountEmailAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).MdcContainerImageAssessmentServiceAccountEmailAddress = (string) content.GetValueForProperty("MdcContainerImageAssessmentServiceAccountEmailAddress",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).MdcContainerImageAssessmentServiceAccountEmailAddress, global::System.Convert.ToString); + } + if (content.Contains("MdcContainerAgentlessDiscoveryK8SEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).MdcContainerAgentlessDiscoveryK8SEnabled = (bool?) content.GetValueForProperty("MdcContainerAgentlessDiscoveryK8SEnabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).MdcContainerAgentlessDiscoveryK8SEnabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId = (string) content.GetValueForProperty("MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId, global::System.Convert.ToString); + } + if (content.Contains("MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress = (string) content.GetValueForProperty("MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress, global::System.Convert.ToString); + } + if (content.Contains("ConfigurationExclusionTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).ConfigurationExclusionTag = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersConfigurationExclusionTags) content.GetValueForProperty("ConfigurationExclusionTag",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).ConfigurationExclusionTag, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmGcpOfferingVMScannersConfigurationExclusionTagsTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DefenderCspmGcpOffering(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CiemDiscovery")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).CiemDiscovery = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingCiemDiscovery) content.GetValueForProperty("CiemDiscovery",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).CiemDiscovery, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmGcpOfferingCiemDiscoveryTypeConverter.ConvertFrom); + } + if (content.Contains("VMScanner")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).VMScanner = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScanners) content.GetValueForProperty("VMScanner",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).VMScanner, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmGcpOfferingVMScannersTypeConverter.ConvertFrom); + } + if (content.Contains("DataSensitivityDiscovery")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).DataSensitivityDiscovery = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingDataSensitivityDiscovery) content.GetValueForProperty("DataSensitivityDiscovery",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).DataSensitivityDiscovery, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmGcpOfferingDataSensitivityDiscoveryTypeConverter.ConvertFrom); + } + if (content.Contains("MdcContainersImageAssessment")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).MdcContainersImageAssessment = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingMdcContainersImageAssessment) content.GetValueForProperty("MdcContainersImageAssessment",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).MdcContainersImageAssessment, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmGcpOfferingMdcContainersImageAssessmentTypeConverter.ConvertFrom); + } + if (content.Contains("MdcContainersAgentlessDiscoveryK8S")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).MdcContainersAgentlessDiscoveryK8S = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S) content.GetValueForProperty("MdcContainersAgentlessDiscoveryK8S",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).MdcContainersAgentlessDiscoveryK8S, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8STypeConverter.ConvertFrom); + } + if (content.Contains("OfferingType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType = (string) content.GetValueForProperty("OfferingType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType, global::System.Convert.ToString); + } + if (content.Contains("Description")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description, global::System.Convert.ToString); + } + if (content.Contains("CiemDiscoveryWorkloadIdentityProviderId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).CiemDiscoveryWorkloadIdentityProviderId = (string) content.GetValueForProperty("CiemDiscoveryWorkloadIdentityProviderId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).CiemDiscoveryWorkloadIdentityProviderId, global::System.Convert.ToString); + } + if (content.Contains("CiemDiscoveryServiceAccountEmailAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).CiemDiscoveryServiceAccountEmailAddress = (string) content.GetValueForProperty("CiemDiscoveryServiceAccountEmailAddress",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).CiemDiscoveryServiceAccountEmailAddress, global::System.Convert.ToString); + } + if (content.Contains("CiemDiscoveryAzureActiveDirectoryAppName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).CiemDiscoveryAzureActiveDirectoryAppName = (string) content.GetValueForProperty("CiemDiscoveryAzureActiveDirectoryAppName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).CiemDiscoveryAzureActiveDirectoryAppName, global::System.Convert.ToString); + } + if (content.Contains("VMScannerConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).VMScannerConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersConfiguration) content.GetValueForProperty("VMScannerConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).VMScannerConfiguration, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmGcpOfferingVMScannersConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("VMScannerEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).VMScannerEnabled = (bool?) content.GetValueForProperty("VMScannerEnabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).VMScannerEnabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ConfigurationScanningMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).ConfigurationScanningMode = (string) content.GetValueForProperty("ConfigurationScanningMode",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).ConfigurationScanningMode, global::System.Convert.ToString); + } + if (content.Contains("DataSensitivityDiscoveryEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).DataSensitivityDiscoveryEnabled = (bool?) content.GetValueForProperty("DataSensitivityDiscoveryEnabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).DataSensitivityDiscoveryEnabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("DataSensitivityDiscoveryWorkloadIdentityProviderId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).DataSensitivityDiscoveryWorkloadIdentityProviderId = (string) content.GetValueForProperty("DataSensitivityDiscoveryWorkloadIdentityProviderId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).DataSensitivityDiscoveryWorkloadIdentityProviderId, global::System.Convert.ToString); + } + if (content.Contains("DataSensitivityDiscoveryServiceAccountEmailAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).DataSensitivityDiscoveryServiceAccountEmailAddress = (string) content.GetValueForProperty("DataSensitivityDiscoveryServiceAccountEmailAddress",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).DataSensitivityDiscoveryServiceAccountEmailAddress, global::System.Convert.ToString); + } + if (content.Contains("MdcContainerImageAssessmentEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).MdcContainerImageAssessmentEnabled = (bool?) content.GetValueForProperty("MdcContainerImageAssessmentEnabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).MdcContainerImageAssessmentEnabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("MdcContainerImageAssessmentWorkloadIdentityProviderId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).MdcContainerImageAssessmentWorkloadIdentityProviderId = (string) content.GetValueForProperty("MdcContainerImageAssessmentWorkloadIdentityProviderId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).MdcContainerImageAssessmentWorkloadIdentityProviderId, global::System.Convert.ToString); + } + if (content.Contains("MdcContainerImageAssessmentServiceAccountEmailAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).MdcContainerImageAssessmentServiceAccountEmailAddress = (string) content.GetValueForProperty("MdcContainerImageAssessmentServiceAccountEmailAddress",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).MdcContainerImageAssessmentServiceAccountEmailAddress, global::System.Convert.ToString); + } + if (content.Contains("MdcContainerAgentlessDiscoveryK8SEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).MdcContainerAgentlessDiscoveryK8SEnabled = (bool?) content.GetValueForProperty("MdcContainerAgentlessDiscoveryK8SEnabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).MdcContainerAgentlessDiscoveryK8SEnabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId = (string) content.GetValueForProperty("MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId, global::System.Convert.ToString); + } + if (content.Contains("MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress = (string) content.GetValueForProperty("MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress, global::System.Convert.ToString); + } + if (content.Contains("ConfigurationExclusionTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).ConfigurationExclusionTag = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersConfigurationExclusionTags) content.GetValueForProperty("ConfigurationExclusionTag",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal)this).ConfigurationExclusionTag, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmGcpOfferingVMScannersConfigurationExclusionTagsTypeConverter.ConvertFrom); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOffering DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DefenderCspmGcpOffering(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOffering DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DefenderCspmGcpOffering(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOffering FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The CSPM P1 for GCP offering + [System.ComponentModel.TypeConverter(typeof(DefenderCspmGcpOfferingTypeConverter))] + public partial interface IDefenderCspmGcpOffering + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOffering.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOffering.TypeConverter.cs new file mode 100644 index 000000000000..9823cc28b199 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOffering.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DefenderCspmGcpOfferingTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOffering ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOffering).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DefenderCspmGcpOffering.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DefenderCspmGcpOffering.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DefenderCspmGcpOffering.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOffering.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOffering.cs new file mode 100644 index 000000000000..847619a31e8a --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOffering.cs @@ -0,0 +1,396 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The CSPM P1 for GCP offering + public partial class DefenderCspmGcpOffering : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOffering, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOffering __cloudOffering = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CloudOffering(); + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingCiemDiscovery _ciemDiscovery; + + /// + /// GCP Defenders CSPM Cloud infrastructure entitlement management (CIEM) discovery offering configurations + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingCiemDiscovery CiemDiscovery { get => (this._ciemDiscovery = this._ciemDiscovery ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmGcpOfferingCiemDiscovery()); set => this._ciemDiscovery = value; } + + /// + /// the azure active directory app name used of authenticating against GCP workload identity federation + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string CiemDiscoveryAzureActiveDirectoryAppName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingCiemDiscoveryInternal)CiemDiscovery).AzureActiveDirectoryAppName; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingCiemDiscoveryInternal)CiemDiscovery).AzureActiveDirectoryAppName = value ?? null; } + + /// The service account email address in GCP for CIEM discovery offering + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string CiemDiscoveryServiceAccountEmailAddress { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingCiemDiscoveryInternal)CiemDiscovery).ServiceAccountEmailAddress; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingCiemDiscoveryInternal)CiemDiscovery).ServiceAccountEmailAddress = value ?? null; } + + /// The GCP workload identity provider id for CIEM discovery offering + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string CiemDiscoveryWorkloadIdentityProviderId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingCiemDiscoveryInternal)CiemDiscovery).WorkloadIdentityProviderId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingCiemDiscoveryInternal)CiemDiscovery).WorkloadIdentityProviderId = value ?? null; } + + /// VM tags that indicates that VM should not be scanned + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersConfigurationExclusionTags ConfigurationExclusionTag { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersInternal)VMScanner).ConfigurationExclusionTag; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersInternal)VMScanner).ConfigurationExclusionTag = value ?? null /* model class */; } + + /// The scanning mode for the VM scan. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string ConfigurationScanningMode { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersInternal)VMScanner).ConfigurationScanningMode; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersInternal)VMScanner).ConfigurationScanningMode = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingDataSensitivityDiscovery _dataSensitivityDiscovery; + + /// The Microsoft Defender Data Sensitivity discovery configuration + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingDataSensitivityDiscovery DataSensitivityDiscovery { get => (this._dataSensitivityDiscovery = this._dataSensitivityDiscovery ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmGcpOfferingDataSensitivityDiscovery()); set => this._dataSensitivityDiscovery = value; } + + /// Is Microsoft Defender Data Sensitivity discovery enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public bool? DataSensitivityDiscoveryEnabled { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingDataSensitivityDiscoveryInternal)DataSensitivityDiscovery).Enabled; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingDataSensitivityDiscoveryInternal)DataSensitivityDiscovery).Enabled = value ?? default(bool); } + + /// The service account email address in GCP for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string DataSensitivityDiscoveryServiceAccountEmailAddress { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingDataSensitivityDiscoveryInternal)DataSensitivityDiscovery).ServiceAccountEmailAddress; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingDataSensitivityDiscoveryInternal)DataSensitivityDiscovery).ServiceAccountEmailAddress = value ?? null; } + + /// The workload identity provider id in GCP for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string DataSensitivityDiscoveryWorkloadIdentityProviderId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingDataSensitivityDiscoveryInternal)DataSensitivityDiscovery).WorkloadIdentityProviderId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingDataSensitivityDiscoveryInternal)DataSensitivityDiscovery).WorkloadIdentityProviderId = value ?? null; } + + /// The offering description. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string Description { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)__cloudOffering).Description; } + + /// Is Microsoft Defender container agentless discovery enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public bool? MdcContainerAgentlessDiscoveryK8SEnabled { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8SInternal)MdcContainersAgentlessDiscoveryK8S).Enabled; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8SInternal)MdcContainersAgentlessDiscoveryK8S).Enabled = value ?? default(bool); } + + /// The service account email address in GCP for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8SInternal)MdcContainersAgentlessDiscoveryK8S).ServiceAccountEmailAddress; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8SInternal)MdcContainersAgentlessDiscoveryK8S).ServiceAccountEmailAddress = value ?? null; } + + /// The workload identity provider id in GCP for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8SInternal)MdcContainersAgentlessDiscoveryK8S).WorkloadIdentityProviderId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8SInternal)MdcContainersAgentlessDiscoveryK8S).WorkloadIdentityProviderId = value ?? null; } + + /// Is Microsoft Defender container image assessment enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public bool? MdcContainerImageAssessmentEnabled { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingMdcContainersImageAssessmentInternal)MdcContainersImageAssessment).Enabled; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingMdcContainersImageAssessmentInternal)MdcContainersImageAssessment).Enabled = value ?? default(bool); } + + /// The service account email address in GCP for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string MdcContainerImageAssessmentServiceAccountEmailAddress { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingMdcContainersImageAssessmentInternal)MdcContainersImageAssessment).ServiceAccountEmailAddress; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingMdcContainersImageAssessmentInternal)MdcContainersImageAssessment).ServiceAccountEmailAddress = value ?? null; } + + /// The workload identity provider id in GCP for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string MdcContainerImageAssessmentWorkloadIdentityProviderId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingMdcContainersImageAssessmentInternal)MdcContainersImageAssessment).WorkloadIdentityProviderId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingMdcContainersImageAssessmentInternal)MdcContainersImageAssessment).WorkloadIdentityProviderId = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S _mdcContainersAgentlessDiscoveryK8S; + + /// The Microsoft Defender Container agentless discovery configuration + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S MdcContainersAgentlessDiscoveryK8S { get => (this._mdcContainersAgentlessDiscoveryK8S = this._mdcContainersAgentlessDiscoveryK8S ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S()); set => this._mdcContainersAgentlessDiscoveryK8S = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingMdcContainersImageAssessment _mdcContainersImageAssessment; + + /// The Microsoft Defender Container image assessment configuration + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingMdcContainersImageAssessment MdcContainersImageAssessment { get => (this._mdcContainersImageAssessment = this._mdcContainersImageAssessment ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmGcpOfferingMdcContainersImageAssessment()); set => this._mdcContainersImageAssessment = value; } + + /// Internal Acessors for Description + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal.Description { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)__cloudOffering).Description; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)__cloudOffering).Description = value; } + + /// Internal Acessors for CiemDiscovery + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingCiemDiscovery Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal.CiemDiscovery { get => (this._ciemDiscovery = this._ciemDiscovery ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmGcpOfferingCiemDiscovery()); set { {_ciemDiscovery = value;} } } + + /// Internal Acessors for DataSensitivityDiscovery + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingDataSensitivityDiscovery Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal.DataSensitivityDiscovery { get => (this._dataSensitivityDiscovery = this._dataSensitivityDiscovery ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmGcpOfferingDataSensitivityDiscovery()); set { {_dataSensitivityDiscovery = value;} } } + + /// Internal Acessors for MdcContainersAgentlessDiscoveryK8S + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal.MdcContainersAgentlessDiscoveryK8S { get => (this._mdcContainersAgentlessDiscoveryK8S = this._mdcContainersAgentlessDiscoveryK8S ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S()); set { {_mdcContainersAgentlessDiscoveryK8S = value;} } } + + /// Internal Acessors for MdcContainersImageAssessment + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingMdcContainersImageAssessment Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal.MdcContainersImageAssessment { get => (this._mdcContainersImageAssessment = this._mdcContainersImageAssessment ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmGcpOfferingMdcContainersImageAssessment()); set { {_mdcContainersImageAssessment = value;} } } + + /// Internal Acessors for VMScanner + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScanners Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal.VMScanner { get => (this._vMScanner = this._vMScanner ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmGcpOfferingVMScanners()); set { {_vMScanner = value;} } } + + /// Internal Acessors for VMScannerConfiguration + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersConfiguration Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingInternal.VMScannerConfiguration { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersInternal)VMScanner).Configuration; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersInternal)VMScanner).Configuration = value; } + + /// The type of the security offering. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Constant] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string OfferingType { get => "DefenderCspmGcp"; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)__cloudOffering).OfferingType = "DefenderCspmGcp"; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScanners _vMScanner; + + /// The Microsoft Defender for Server VM scanning configuration + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScanners VMScanner { get => (this._vMScanner = this._vMScanner ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmGcpOfferingVMScanners()); set => this._vMScanner = value; } + + /// Is Microsoft Defender for Server VM scanning enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public bool? VMScannerEnabled { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersInternal)VMScanner).Enabled; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersInternal)VMScanner).Enabled = value ?? default(bool); } + + /// Creates an new instance. + public DefenderCspmGcpOffering() + { + this.__cloudOffering.OfferingType = "DefenderCspmGcp"; + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__cloudOffering), __cloudOffering); + await eventListener.AssertObjectIsValid(nameof(__cloudOffering), __cloudOffering); + } + } + /// The CSPM P1 for GCP offering + public partial interface IDefenderCspmGcpOffering : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOffering + { + /// + /// the azure active directory app name used of authenticating against GCP workload identity federation + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"the azure active directory app name used of authenticating against GCP workload identity federation", + SerializedName = @"azureActiveDirectoryAppName", + PossibleTypes = new [] { typeof(string) })] + string CiemDiscoveryAzureActiveDirectoryAppName { get; set; } + /// The service account email address in GCP for CIEM discovery offering + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The service account email address in GCP for CIEM discovery offering", + SerializedName = @"serviceAccountEmailAddress", + PossibleTypes = new [] { typeof(string) })] + string CiemDiscoveryServiceAccountEmailAddress { get; set; } + /// The GCP workload identity provider id for CIEM discovery offering + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The GCP workload identity provider id for CIEM discovery offering", + SerializedName = @"workloadIdentityProviderId", + PossibleTypes = new [] { typeof(string) })] + string CiemDiscoveryWorkloadIdentityProviderId { get; set; } + /// VM tags that indicates that VM should not be scanned + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"VM tags that indicates that VM should not be scanned", + SerializedName = @"exclusionTags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersConfigurationExclusionTags) })] + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersConfigurationExclusionTags ConfigurationExclusionTag { get; set; } + /// The scanning mode for the VM scan. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The scanning mode for the VM scan.", + SerializedName = @"scanningMode", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Default")] + string ConfigurationScanningMode { get; set; } + /// Is Microsoft Defender Data Sensitivity discovery enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Is Microsoft Defender Data Sensitivity discovery enabled", + SerializedName = @"enabled", + PossibleTypes = new [] { typeof(bool) })] + bool? DataSensitivityDiscoveryEnabled { get; set; } + /// The service account email address in GCP for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The service account email address in GCP for this feature", + SerializedName = @"serviceAccountEmailAddress", + PossibleTypes = new [] { typeof(string) })] + string DataSensitivityDiscoveryServiceAccountEmailAddress { get; set; } + /// The workload identity provider id in GCP for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The workload identity provider id in GCP for this feature", + SerializedName = @"workloadIdentityProviderId", + PossibleTypes = new [] { typeof(string) })] + string DataSensitivityDiscoveryWorkloadIdentityProviderId { get; set; } + /// Is Microsoft Defender container agentless discovery enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Is Microsoft Defender container agentless discovery enabled", + SerializedName = @"enabled", + PossibleTypes = new [] { typeof(bool) })] + bool? MdcContainerAgentlessDiscoveryK8SEnabled { get; set; } + /// The service account email address in GCP for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The service account email address in GCP for this feature", + SerializedName = @"serviceAccountEmailAddress", + PossibleTypes = new [] { typeof(string) })] + string MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress { get; set; } + /// The workload identity provider id in GCP for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The workload identity provider id in GCP for this feature", + SerializedName = @"workloadIdentityProviderId", + PossibleTypes = new [] { typeof(string) })] + string MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId { get; set; } + /// Is Microsoft Defender container image assessment enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Is Microsoft Defender container image assessment enabled", + SerializedName = @"enabled", + PossibleTypes = new [] { typeof(bool) })] + bool? MdcContainerImageAssessmentEnabled { get; set; } + /// The service account email address in GCP for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The service account email address in GCP for this feature", + SerializedName = @"serviceAccountEmailAddress", + PossibleTypes = new [] { typeof(string) })] + string MdcContainerImageAssessmentServiceAccountEmailAddress { get; set; } + /// The workload identity provider id in GCP for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The workload identity provider id in GCP for this feature", + SerializedName = @"workloadIdentityProviderId", + PossibleTypes = new [] { typeof(string) })] + string MdcContainerImageAssessmentWorkloadIdentityProviderId { get; set; } + /// Is Microsoft Defender for Server VM scanning enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Is Microsoft Defender for Server VM scanning enabled", + SerializedName = @"enabled", + PossibleTypes = new [] { typeof(bool) })] + bool? VMScannerEnabled { get; set; } + + } + /// The CSPM P1 for GCP offering + internal partial interface IDefenderCspmGcpOfferingInternal : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal + { + /// + /// GCP Defenders CSPM Cloud infrastructure entitlement management (CIEM) discovery offering configurations + /// + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingCiemDiscovery CiemDiscovery { get; set; } + /// + /// the azure active directory app name used of authenticating against GCP workload identity federation + /// + string CiemDiscoveryAzureActiveDirectoryAppName { get; set; } + /// The service account email address in GCP for CIEM discovery offering + string CiemDiscoveryServiceAccountEmailAddress { get; set; } + /// The GCP workload identity provider id for CIEM discovery offering + string CiemDiscoveryWorkloadIdentityProviderId { get; set; } + /// VM tags that indicates that VM should not be scanned + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersConfigurationExclusionTags ConfigurationExclusionTag { get; set; } + /// The scanning mode for the VM scan. + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Default")] + string ConfigurationScanningMode { get; set; } + /// The Microsoft Defender Data Sensitivity discovery configuration + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingDataSensitivityDiscovery DataSensitivityDiscovery { get; set; } + /// Is Microsoft Defender Data Sensitivity discovery enabled + bool? DataSensitivityDiscoveryEnabled { get; set; } + /// The service account email address in GCP for this feature + string DataSensitivityDiscoveryServiceAccountEmailAddress { get; set; } + /// The workload identity provider id in GCP for this feature + string DataSensitivityDiscoveryWorkloadIdentityProviderId { get; set; } + /// Is Microsoft Defender container agentless discovery enabled + bool? MdcContainerAgentlessDiscoveryK8SEnabled { get; set; } + /// The service account email address in GCP for this feature + string MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress { get; set; } + /// The workload identity provider id in GCP for this feature + string MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId { get; set; } + /// Is Microsoft Defender container image assessment enabled + bool? MdcContainerImageAssessmentEnabled { get; set; } + /// The service account email address in GCP for this feature + string MdcContainerImageAssessmentServiceAccountEmailAddress { get; set; } + /// The workload identity provider id in GCP for this feature + string MdcContainerImageAssessmentWorkloadIdentityProviderId { get; set; } + /// The Microsoft Defender Container agentless discovery configuration + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S MdcContainersAgentlessDiscoveryK8S { get; set; } + /// The Microsoft Defender Container image assessment configuration + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingMdcContainersImageAssessment MdcContainersImageAssessment { get; set; } + /// The Microsoft Defender for Server VM scanning configuration + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScanners VMScanner { get; set; } + /// configuration for Microsoft Defender for Server VM scanning + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersConfiguration VMScannerConfiguration { get; set; } + /// Is Microsoft Defender for Server VM scanning enabled + bool? VMScannerEnabled { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOffering.json.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOffering.json.cs new file mode 100644 index 000000000000..4fd31303af9d --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOffering.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The CSPM P1 for GCP offering + public partial class DefenderCspmGcpOffering + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal DefenderCspmGcpOffering(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __cloudOffering = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CloudOffering(json); + {_ciemDiscovery = If( json?.PropertyT("ciemDiscovery"), out var __jsonCiemDiscovery) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmGcpOfferingCiemDiscovery.FromJson(__jsonCiemDiscovery) : _ciemDiscovery;} + {_vMScanner = If( json?.PropertyT("vmScanners"), out var __jsonVMScanners) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmGcpOfferingVMScanners.FromJson(__jsonVMScanners) : _vMScanner;} + {_dataSensitivityDiscovery = If( json?.PropertyT("dataSensitivityDiscovery"), out var __jsonDataSensitivityDiscovery) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmGcpOfferingDataSensitivityDiscovery.FromJson(__jsonDataSensitivityDiscovery) : _dataSensitivityDiscovery;} + {_mdcContainersImageAssessment = If( json?.PropertyT("mdcContainersImageAssessment"), out var __jsonMdcContainersImageAssessment) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmGcpOfferingMdcContainersImageAssessment.FromJson(__jsonMdcContainersImageAssessment) : _mdcContainersImageAssessment;} + {_mdcContainersAgentlessDiscoveryK8S = If( json?.PropertyT("mdcContainersAgentlessDiscoveryK8s"), out var __jsonMdcContainersAgentlessDiscoveryK8S) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S.FromJson(__jsonMdcContainersAgentlessDiscoveryK8S) : _mdcContainersAgentlessDiscoveryK8S;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOffering. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOffering. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOffering FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DefenderCspmGcpOffering(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __cloudOffering?.ToJson(container, serializationMode); + AddIf( null != this._ciemDiscovery ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._ciemDiscovery.ToJson(null,serializationMode) : null, "ciemDiscovery" ,container.Add ); + AddIf( null != this._vMScanner ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._vMScanner.ToJson(null,serializationMode) : null, "vmScanners" ,container.Add ); + AddIf( null != this._dataSensitivityDiscovery ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._dataSensitivityDiscovery.ToJson(null,serializationMode) : null, "dataSensitivityDiscovery" ,container.Add ); + AddIf( null != this._mdcContainersImageAssessment ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._mdcContainersImageAssessment.ToJson(null,serializationMode) : null, "mdcContainersImageAssessment" ,container.Add ); + AddIf( null != this._mdcContainersAgentlessDiscoveryK8S ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._mdcContainersAgentlessDiscoveryK8S.ToJson(null,serializationMode) : null, "mdcContainersAgentlessDiscoveryK8s" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingCiemDiscovery.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingCiemDiscovery.PowerShell.cs new file mode 100644 index 000000000000..1205b7ea167c --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingCiemDiscovery.PowerShell.cs @@ -0,0 +1,184 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// GCP Defenders CSPM Cloud infrastructure entitlement management (CIEM) discovery offering configurations + /// + [System.ComponentModel.TypeConverter(typeof(DefenderCspmGcpOfferingCiemDiscoveryTypeConverter))] + public partial class DefenderCspmGcpOfferingCiemDiscovery + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DefenderCspmGcpOfferingCiemDiscovery(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("WorkloadIdentityProviderId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingCiemDiscoveryInternal)this).WorkloadIdentityProviderId = (string) content.GetValueForProperty("WorkloadIdentityProviderId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingCiemDiscoveryInternal)this).WorkloadIdentityProviderId, global::System.Convert.ToString); + } + if (content.Contains("ServiceAccountEmailAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingCiemDiscoveryInternal)this).ServiceAccountEmailAddress = (string) content.GetValueForProperty("ServiceAccountEmailAddress",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingCiemDiscoveryInternal)this).ServiceAccountEmailAddress, global::System.Convert.ToString); + } + if (content.Contains("AzureActiveDirectoryAppName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingCiemDiscoveryInternal)this).AzureActiveDirectoryAppName = (string) content.GetValueForProperty("AzureActiveDirectoryAppName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingCiemDiscoveryInternal)this).AzureActiveDirectoryAppName, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DefenderCspmGcpOfferingCiemDiscovery(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("WorkloadIdentityProviderId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingCiemDiscoveryInternal)this).WorkloadIdentityProviderId = (string) content.GetValueForProperty("WorkloadIdentityProviderId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingCiemDiscoveryInternal)this).WorkloadIdentityProviderId, global::System.Convert.ToString); + } + if (content.Contains("ServiceAccountEmailAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingCiemDiscoveryInternal)this).ServiceAccountEmailAddress = (string) content.GetValueForProperty("ServiceAccountEmailAddress",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingCiemDiscoveryInternal)this).ServiceAccountEmailAddress, global::System.Convert.ToString); + } + if (content.Contains("AzureActiveDirectoryAppName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingCiemDiscoveryInternal)this).AzureActiveDirectoryAppName = (string) content.GetValueForProperty("AzureActiveDirectoryAppName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingCiemDiscoveryInternal)this).AzureActiveDirectoryAppName, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingCiemDiscovery DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DefenderCspmGcpOfferingCiemDiscovery(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingCiemDiscovery DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DefenderCspmGcpOfferingCiemDiscovery(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingCiemDiscovery FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// GCP Defenders CSPM Cloud infrastructure entitlement management (CIEM) discovery offering configurations + [System.ComponentModel.TypeConverter(typeof(DefenderCspmGcpOfferingCiemDiscoveryTypeConverter))] + public partial interface IDefenderCspmGcpOfferingCiemDiscovery + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingCiemDiscovery.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingCiemDiscovery.TypeConverter.cs new file mode 100644 index 000000000000..333d0c59496b --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingCiemDiscovery.TypeConverter.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DefenderCspmGcpOfferingCiemDiscoveryTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingCiemDiscovery ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingCiemDiscovery).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DefenderCspmGcpOfferingCiemDiscovery.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DefenderCspmGcpOfferingCiemDiscovery.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DefenderCspmGcpOfferingCiemDiscovery.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingCiemDiscovery.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingCiemDiscovery.cs new file mode 100644 index 000000000000..66ba39785a0b --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingCiemDiscovery.cs @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// + /// GCP Defenders CSPM Cloud infrastructure entitlement management (CIEM) discovery offering configurations + /// + public partial class DefenderCspmGcpOfferingCiemDiscovery : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingCiemDiscovery, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingCiemDiscoveryInternal + { + + /// Backing field for property. + private string _azureActiveDirectoryAppName; + + /// + /// the azure active directory app name used of authenticating against GCP workload identity federation + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string AzureActiveDirectoryAppName { get => this._azureActiveDirectoryAppName; set => this._azureActiveDirectoryAppName = value; } + + /// Backing field for property. + private string _serviceAccountEmailAddress; + + /// The service account email address in GCP for CIEM discovery offering + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string ServiceAccountEmailAddress { get => this._serviceAccountEmailAddress; set => this._serviceAccountEmailAddress = value; } + + /// Backing field for property. + private string _workloadIdentityProviderId; + + /// The GCP workload identity provider id for CIEM discovery offering + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string WorkloadIdentityProviderId { get => this._workloadIdentityProviderId; set => this._workloadIdentityProviderId = value; } + + /// Creates an new instance. + public DefenderCspmGcpOfferingCiemDiscovery() + { + + } + } + /// GCP Defenders CSPM Cloud infrastructure entitlement management (CIEM) discovery offering configurations + public partial interface IDefenderCspmGcpOfferingCiemDiscovery : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// + /// the azure active directory app name used of authenticating against GCP workload identity federation + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"the azure active directory app name used of authenticating against GCP workload identity federation", + SerializedName = @"azureActiveDirectoryAppName", + PossibleTypes = new [] { typeof(string) })] + string AzureActiveDirectoryAppName { get; set; } + /// The service account email address in GCP for CIEM discovery offering + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The service account email address in GCP for CIEM discovery offering", + SerializedName = @"serviceAccountEmailAddress", + PossibleTypes = new [] { typeof(string) })] + string ServiceAccountEmailAddress { get; set; } + /// The GCP workload identity provider id for CIEM discovery offering + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The GCP workload identity provider id for CIEM discovery offering", + SerializedName = @"workloadIdentityProviderId", + PossibleTypes = new [] { typeof(string) })] + string WorkloadIdentityProviderId { get; set; } + + } + /// GCP Defenders CSPM Cloud infrastructure entitlement management (CIEM) discovery offering configurations + internal partial interface IDefenderCspmGcpOfferingCiemDiscoveryInternal + + { + /// + /// the azure active directory app name used of authenticating against GCP workload identity federation + /// + string AzureActiveDirectoryAppName { get; set; } + /// The service account email address in GCP for CIEM discovery offering + string ServiceAccountEmailAddress { get; set; } + /// The GCP workload identity provider id for CIEM discovery offering + string WorkloadIdentityProviderId { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingCiemDiscovery.json.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingCiemDiscovery.json.cs new file mode 100644 index 000000000000..295d27323fa9 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingCiemDiscovery.json.cs @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// + /// GCP Defenders CSPM Cloud infrastructure entitlement management (CIEM) discovery offering configurations + /// + public partial class DefenderCspmGcpOfferingCiemDiscovery + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal DefenderCspmGcpOfferingCiemDiscovery(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_workloadIdentityProviderId = If( json?.PropertyT("workloadIdentityProviderId"), out var __jsonWorkloadIdentityProviderId) ? (string)__jsonWorkloadIdentityProviderId : (string)_workloadIdentityProviderId;} + {_serviceAccountEmailAddress = If( json?.PropertyT("serviceAccountEmailAddress"), out var __jsonServiceAccountEmailAddress) ? (string)__jsonServiceAccountEmailAddress : (string)_serviceAccountEmailAddress;} + {_azureActiveDirectoryAppName = If( json?.PropertyT("azureActiveDirectoryAppName"), out var __jsonAzureActiveDirectoryAppName) ? (string)__jsonAzureActiveDirectoryAppName : (string)_azureActiveDirectoryAppName;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingCiemDiscovery. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingCiemDiscovery. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingCiemDiscovery FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DefenderCspmGcpOfferingCiemDiscovery(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._workloadIdentityProviderId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._workloadIdentityProviderId.ToString()) : null, "workloadIdentityProviderId" ,container.Add ); + AddIf( null != (((object)this._serviceAccountEmailAddress)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._serviceAccountEmailAddress.ToString()) : null, "serviceAccountEmailAddress" ,container.Add ); + AddIf( null != (((object)this._azureActiveDirectoryAppName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._azureActiveDirectoryAppName.ToString()) : null, "azureActiveDirectoryAppName" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingDataSensitivityDiscovery.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingDataSensitivityDiscovery.PowerShell.cs new file mode 100644 index 000000000000..2ac038b1cea2 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingDataSensitivityDiscovery.PowerShell.cs @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The Microsoft Defender Data Sensitivity discovery configuration + [System.ComponentModel.TypeConverter(typeof(DefenderCspmGcpOfferingDataSensitivityDiscoveryTypeConverter))] + public partial class DefenderCspmGcpOfferingDataSensitivityDiscovery + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DefenderCspmGcpOfferingDataSensitivityDiscovery(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Enabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingDataSensitivityDiscoveryInternal)this).Enabled = (bool?) content.GetValueForProperty("Enabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingDataSensitivityDiscoveryInternal)this).Enabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("WorkloadIdentityProviderId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingDataSensitivityDiscoveryInternal)this).WorkloadIdentityProviderId = (string) content.GetValueForProperty("WorkloadIdentityProviderId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingDataSensitivityDiscoveryInternal)this).WorkloadIdentityProviderId, global::System.Convert.ToString); + } + if (content.Contains("ServiceAccountEmailAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingDataSensitivityDiscoveryInternal)this).ServiceAccountEmailAddress = (string) content.GetValueForProperty("ServiceAccountEmailAddress",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingDataSensitivityDiscoveryInternal)this).ServiceAccountEmailAddress, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DefenderCspmGcpOfferingDataSensitivityDiscovery(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Enabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingDataSensitivityDiscoveryInternal)this).Enabled = (bool?) content.GetValueForProperty("Enabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingDataSensitivityDiscoveryInternal)this).Enabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("WorkloadIdentityProviderId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingDataSensitivityDiscoveryInternal)this).WorkloadIdentityProviderId = (string) content.GetValueForProperty("WorkloadIdentityProviderId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingDataSensitivityDiscoveryInternal)this).WorkloadIdentityProviderId, global::System.Convert.ToString); + } + if (content.Contains("ServiceAccountEmailAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingDataSensitivityDiscoveryInternal)this).ServiceAccountEmailAddress = (string) content.GetValueForProperty("ServiceAccountEmailAddress",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingDataSensitivityDiscoveryInternal)this).ServiceAccountEmailAddress, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingDataSensitivityDiscovery DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DefenderCspmGcpOfferingDataSensitivityDiscovery(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingDataSensitivityDiscovery DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DefenderCspmGcpOfferingDataSensitivityDiscovery(content); + } + + /// + /// Creates a new instance of , deserializing the content from + /// a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingDataSensitivityDiscovery FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The Microsoft Defender Data Sensitivity discovery configuration + [System.ComponentModel.TypeConverter(typeof(DefenderCspmGcpOfferingDataSensitivityDiscoveryTypeConverter))] + public partial interface IDefenderCspmGcpOfferingDataSensitivityDiscovery + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingDataSensitivityDiscovery.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingDataSensitivityDiscovery.TypeConverter.cs new file mode 100644 index 000000000000..7ed3ab88ac91 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingDataSensitivityDiscovery.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DefenderCspmGcpOfferingDataSensitivityDiscoveryTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, + /// otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingDataSensitivityDiscovery ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingDataSensitivityDiscovery).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DefenderCspmGcpOfferingDataSensitivityDiscovery.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DefenderCspmGcpOfferingDataSensitivityDiscovery.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DefenderCspmGcpOfferingDataSensitivityDiscovery.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingDataSensitivityDiscovery.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingDataSensitivityDiscovery.cs new file mode 100644 index 000000000000..ec6ca0480a4d --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingDataSensitivityDiscovery.cs @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The Microsoft Defender Data Sensitivity discovery configuration + public partial class DefenderCspmGcpOfferingDataSensitivityDiscovery : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingDataSensitivityDiscovery, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingDataSensitivityDiscoveryInternal + { + + /// Backing field for property. + private bool? _enabled; + + /// Is Microsoft Defender Data Sensitivity discovery enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public bool? Enabled { get => this._enabled; set => this._enabled = value; } + + /// Backing field for property. + private string _serviceAccountEmailAddress; + + /// The service account email address in GCP for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string ServiceAccountEmailAddress { get => this._serviceAccountEmailAddress; set => this._serviceAccountEmailAddress = value; } + + /// Backing field for property. + private string _workloadIdentityProviderId; + + /// The workload identity provider id in GCP for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string WorkloadIdentityProviderId { get => this._workloadIdentityProviderId; set => this._workloadIdentityProviderId = value; } + + /// + /// Creates an new instance. + /// + public DefenderCspmGcpOfferingDataSensitivityDiscovery() + { + + } + } + /// The Microsoft Defender Data Sensitivity discovery configuration + public partial interface IDefenderCspmGcpOfferingDataSensitivityDiscovery : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// Is Microsoft Defender Data Sensitivity discovery enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Is Microsoft Defender Data Sensitivity discovery enabled", + SerializedName = @"enabled", + PossibleTypes = new [] { typeof(bool) })] + bool? Enabled { get; set; } + /// The service account email address in GCP for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The service account email address in GCP for this feature", + SerializedName = @"serviceAccountEmailAddress", + PossibleTypes = new [] { typeof(string) })] + string ServiceAccountEmailAddress { get; set; } + /// The workload identity provider id in GCP for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The workload identity provider id in GCP for this feature", + SerializedName = @"workloadIdentityProviderId", + PossibleTypes = new [] { typeof(string) })] + string WorkloadIdentityProviderId { get; set; } + + } + /// The Microsoft Defender Data Sensitivity discovery configuration + internal partial interface IDefenderCspmGcpOfferingDataSensitivityDiscoveryInternal + + { + /// Is Microsoft Defender Data Sensitivity discovery enabled + bool? Enabled { get; set; } + /// The service account email address in GCP for this feature + string ServiceAccountEmailAddress { get; set; } + /// The workload identity provider id in GCP for this feature + string WorkloadIdentityProviderId { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingDataSensitivityDiscovery.json.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingDataSensitivityDiscovery.json.cs new file mode 100644 index 000000000000..3463e65bb96b --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingDataSensitivityDiscovery.json.cs @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The Microsoft Defender Data Sensitivity discovery configuration + public partial class DefenderCspmGcpOfferingDataSensitivityDiscovery + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal DefenderCspmGcpOfferingDataSensitivityDiscovery(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_enabled = If( json?.PropertyT("enabled"), out var __jsonEnabled) ? (bool?)__jsonEnabled : _enabled;} + {_workloadIdentityProviderId = If( json?.PropertyT("workloadIdentityProviderId"), out var __jsonWorkloadIdentityProviderId) ? (string)__jsonWorkloadIdentityProviderId : (string)_workloadIdentityProviderId;} + {_serviceAccountEmailAddress = If( json?.PropertyT("serviceAccountEmailAddress"), out var __jsonServiceAccountEmailAddress) ? (string)__jsonServiceAccountEmailAddress : (string)_serviceAccountEmailAddress;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingDataSensitivityDiscovery. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingDataSensitivityDiscovery. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingDataSensitivityDiscovery FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DefenderCspmGcpOfferingDataSensitivityDiscovery(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._enabled ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonBoolean((bool)this._enabled) : null, "enabled" ,container.Add ); + AddIf( null != (((object)this._workloadIdentityProviderId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._workloadIdentityProviderId.ToString()) : null, "workloadIdentityProviderId" ,container.Add ); + AddIf( null != (((object)this._serviceAccountEmailAddress)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._serviceAccountEmailAddress.ToString()) : null, "serviceAccountEmailAddress" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S.PowerShell.cs new file mode 100644 index 000000000000..a5343b071918 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S.PowerShell.cs @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The Microsoft Defender Container agentless discovery configuration + [System.ComponentModel.TypeConverter(typeof(DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8STypeConverter))] + public partial class DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Enabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8SInternal)this).Enabled = (bool?) content.GetValueForProperty("Enabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8SInternal)this).Enabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("WorkloadIdentityProviderId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8SInternal)this).WorkloadIdentityProviderId = (string) content.GetValueForProperty("WorkloadIdentityProviderId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8SInternal)this).WorkloadIdentityProviderId, global::System.Convert.ToString); + } + if (content.Contains("ServiceAccountEmailAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8SInternal)this).ServiceAccountEmailAddress = (string) content.GetValueForProperty("ServiceAccountEmailAddress",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8SInternal)this).ServiceAccountEmailAddress, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Enabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8SInternal)this).Enabled = (bool?) content.GetValueForProperty("Enabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8SInternal)this).Enabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("WorkloadIdentityProviderId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8SInternal)this).WorkloadIdentityProviderId = (string) content.GetValueForProperty("WorkloadIdentityProviderId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8SInternal)this).WorkloadIdentityProviderId, global::System.Convert.ToString); + } + if (content.Contains("ServiceAccountEmailAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8SInternal)this).ServiceAccountEmailAddress = (string) content.GetValueForProperty("ServiceAccountEmailAddress",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8SInternal)this).ServiceAccountEmailAddress, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S(content); + } + + /// + /// Creates a new instance of , deserializing the + /// content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The Microsoft Defender Container agentless discovery configuration + [System.ComponentModel.TypeConverter(typeof(DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8STypeConverter))] + public partial interface IDefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S.TypeConverter.cs new file mode 100644 index 000000000000..99cde92e9b89 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8STypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no + /// suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no + /// suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S.cs new file mode 100644 index 000000000000..69d3f8548e76 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S.cs @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The Microsoft Defender Container agentless discovery configuration + public partial class DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8SInternal + { + + /// Backing field for property. + private bool? _enabled; + + /// Is Microsoft Defender container agentless discovery enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public bool? Enabled { get => this._enabled; set => this._enabled = value; } + + /// Backing field for property. + private string _serviceAccountEmailAddress; + + /// The service account email address in GCP for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string ServiceAccountEmailAddress { get => this._serviceAccountEmailAddress; set => this._serviceAccountEmailAddress = value; } + + /// Backing field for property. + private string _workloadIdentityProviderId; + + /// The workload identity provider id in GCP for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string WorkloadIdentityProviderId { get => this._workloadIdentityProviderId; set => this._workloadIdentityProviderId = value; } + + /// + /// Creates an new instance. + /// + public DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S() + { + + } + } + /// The Microsoft Defender Container agentless discovery configuration + public partial interface IDefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// Is Microsoft Defender container agentless discovery enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Is Microsoft Defender container agentless discovery enabled", + SerializedName = @"enabled", + PossibleTypes = new [] { typeof(bool) })] + bool? Enabled { get; set; } + /// The service account email address in GCP for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The service account email address in GCP for this feature", + SerializedName = @"serviceAccountEmailAddress", + PossibleTypes = new [] { typeof(string) })] + string ServiceAccountEmailAddress { get; set; } + /// The workload identity provider id in GCP for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The workload identity provider id in GCP for this feature", + SerializedName = @"workloadIdentityProviderId", + PossibleTypes = new [] { typeof(string) })] + string WorkloadIdentityProviderId { get; set; } + + } + /// The Microsoft Defender Container agentless discovery configuration + internal partial interface IDefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8SInternal + + { + /// Is Microsoft Defender container agentless discovery enabled + bool? Enabled { get; set; } + /// The service account email address in GCP for this feature + string ServiceAccountEmailAddress { get; set; } + /// The workload identity provider id in GCP for this feature + string WorkloadIdentityProviderId { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S.json.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S.json.cs new file mode 100644 index 000000000000..844b55149df4 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S.json.cs @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The Microsoft Defender Container agentless discovery configuration + public partial class DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_enabled = If( json?.PropertyT("enabled"), out var __jsonEnabled) ? (bool?)__jsonEnabled : _enabled;} + {_workloadIdentityProviderId = If( json?.PropertyT("workloadIdentityProviderId"), out var __jsonWorkloadIdentityProviderId) ? (string)__jsonWorkloadIdentityProviderId : (string)_workloadIdentityProviderId;} + {_serviceAccountEmailAddress = If( json?.PropertyT("serviceAccountEmailAddress"), out var __jsonServiceAccountEmailAddress) ? (string)__jsonServiceAccountEmailAddress : (string)_serviceAccountEmailAddress;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._enabled ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonBoolean((bool)this._enabled) : null, "enabled" ,container.Add ); + AddIf( null != (((object)this._workloadIdentityProviderId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._workloadIdentityProviderId.ToString()) : null, "workloadIdentityProviderId" ,container.Add ); + AddIf( null != (((object)this._serviceAccountEmailAddress)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._serviceAccountEmailAddress.ToString()) : null, "serviceAccountEmailAddress" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingMdcContainersImageAssessment.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingMdcContainersImageAssessment.PowerShell.cs new file mode 100644 index 000000000000..a2e4298228c6 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingMdcContainersImageAssessment.PowerShell.cs @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The Microsoft Defender Container image assessment configuration + [System.ComponentModel.TypeConverter(typeof(DefenderCspmGcpOfferingMdcContainersImageAssessmentTypeConverter))] + public partial class DefenderCspmGcpOfferingMdcContainersImageAssessment + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DefenderCspmGcpOfferingMdcContainersImageAssessment(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Enabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingMdcContainersImageAssessmentInternal)this).Enabled = (bool?) content.GetValueForProperty("Enabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingMdcContainersImageAssessmentInternal)this).Enabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("WorkloadIdentityProviderId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingMdcContainersImageAssessmentInternal)this).WorkloadIdentityProviderId = (string) content.GetValueForProperty("WorkloadIdentityProviderId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingMdcContainersImageAssessmentInternal)this).WorkloadIdentityProviderId, global::System.Convert.ToString); + } + if (content.Contains("ServiceAccountEmailAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingMdcContainersImageAssessmentInternal)this).ServiceAccountEmailAddress = (string) content.GetValueForProperty("ServiceAccountEmailAddress",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingMdcContainersImageAssessmentInternal)this).ServiceAccountEmailAddress, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DefenderCspmGcpOfferingMdcContainersImageAssessment(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Enabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingMdcContainersImageAssessmentInternal)this).Enabled = (bool?) content.GetValueForProperty("Enabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingMdcContainersImageAssessmentInternal)this).Enabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("WorkloadIdentityProviderId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingMdcContainersImageAssessmentInternal)this).WorkloadIdentityProviderId = (string) content.GetValueForProperty("WorkloadIdentityProviderId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingMdcContainersImageAssessmentInternal)this).WorkloadIdentityProviderId, global::System.Convert.ToString); + } + if (content.Contains("ServiceAccountEmailAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingMdcContainersImageAssessmentInternal)this).ServiceAccountEmailAddress = (string) content.GetValueForProperty("ServiceAccountEmailAddress",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingMdcContainersImageAssessmentInternal)this).ServiceAccountEmailAddress, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingMdcContainersImageAssessment DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DefenderCspmGcpOfferingMdcContainersImageAssessment(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingMdcContainersImageAssessment DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DefenderCspmGcpOfferingMdcContainersImageAssessment(content); + } + + /// + /// Creates a new instance of , deserializing the content + /// from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingMdcContainersImageAssessment FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The Microsoft Defender Container image assessment configuration + [System.ComponentModel.TypeConverter(typeof(DefenderCspmGcpOfferingMdcContainersImageAssessmentTypeConverter))] + public partial interface IDefenderCspmGcpOfferingMdcContainersImageAssessment + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingMdcContainersImageAssessment.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingMdcContainersImageAssessment.TypeConverter.cs new file mode 100644 index 000000000000..377f338ff2fa --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingMdcContainersImageAssessment.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DefenderCspmGcpOfferingMdcContainersImageAssessmentTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a + /// type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingMdcContainersImageAssessment ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingMdcContainersImageAssessment).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DefenderCspmGcpOfferingMdcContainersImageAssessment.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DefenderCspmGcpOfferingMdcContainersImageAssessment.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DefenderCspmGcpOfferingMdcContainersImageAssessment.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingMdcContainersImageAssessment.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingMdcContainersImageAssessment.cs new file mode 100644 index 000000000000..a729429ba46e --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingMdcContainersImageAssessment.cs @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The Microsoft Defender Container image assessment configuration + public partial class DefenderCspmGcpOfferingMdcContainersImageAssessment : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingMdcContainersImageAssessment, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingMdcContainersImageAssessmentInternal + { + + /// Backing field for property. + private bool? _enabled; + + /// Is Microsoft Defender container image assessment enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public bool? Enabled { get => this._enabled; set => this._enabled = value; } + + /// Backing field for property. + private string _serviceAccountEmailAddress; + + /// The service account email address in GCP for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string ServiceAccountEmailAddress { get => this._serviceAccountEmailAddress; set => this._serviceAccountEmailAddress = value; } + + /// Backing field for property. + private string _workloadIdentityProviderId; + + /// The workload identity provider id in GCP for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string WorkloadIdentityProviderId { get => this._workloadIdentityProviderId; set => this._workloadIdentityProviderId = value; } + + /// + /// Creates an new instance. + /// + public DefenderCspmGcpOfferingMdcContainersImageAssessment() + { + + } + } + /// The Microsoft Defender Container image assessment configuration + public partial interface IDefenderCspmGcpOfferingMdcContainersImageAssessment : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// Is Microsoft Defender container image assessment enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Is Microsoft Defender container image assessment enabled", + SerializedName = @"enabled", + PossibleTypes = new [] { typeof(bool) })] + bool? Enabled { get; set; } + /// The service account email address in GCP for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The service account email address in GCP for this feature", + SerializedName = @"serviceAccountEmailAddress", + PossibleTypes = new [] { typeof(string) })] + string ServiceAccountEmailAddress { get; set; } + /// The workload identity provider id in GCP for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The workload identity provider id in GCP for this feature", + SerializedName = @"workloadIdentityProviderId", + PossibleTypes = new [] { typeof(string) })] + string WorkloadIdentityProviderId { get; set; } + + } + /// The Microsoft Defender Container image assessment configuration + internal partial interface IDefenderCspmGcpOfferingMdcContainersImageAssessmentInternal + + { + /// Is Microsoft Defender container image assessment enabled + bool? Enabled { get; set; } + /// The service account email address in GCP for this feature + string ServiceAccountEmailAddress { get; set; } + /// The workload identity provider id in GCP for this feature + string WorkloadIdentityProviderId { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingMdcContainersImageAssessment.json.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingMdcContainersImageAssessment.json.cs new file mode 100644 index 000000000000..6575cf3a129e --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingMdcContainersImageAssessment.json.cs @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The Microsoft Defender Container image assessment configuration + public partial class DefenderCspmGcpOfferingMdcContainersImageAssessment + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal DefenderCspmGcpOfferingMdcContainersImageAssessment(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_enabled = If( json?.PropertyT("enabled"), out var __jsonEnabled) ? (bool?)__jsonEnabled : _enabled;} + {_workloadIdentityProviderId = If( json?.PropertyT("workloadIdentityProviderId"), out var __jsonWorkloadIdentityProviderId) ? (string)__jsonWorkloadIdentityProviderId : (string)_workloadIdentityProviderId;} + {_serviceAccountEmailAddress = If( json?.PropertyT("serviceAccountEmailAddress"), out var __jsonServiceAccountEmailAddress) ? (string)__jsonServiceAccountEmailAddress : (string)_serviceAccountEmailAddress;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingMdcContainersImageAssessment. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingMdcContainersImageAssessment. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingMdcContainersImageAssessment FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DefenderCspmGcpOfferingMdcContainersImageAssessment(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._enabled ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonBoolean((bool)this._enabled) : null, "enabled" ,container.Add ); + AddIf( null != (((object)this._workloadIdentityProviderId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._workloadIdentityProviderId.ToString()) : null, "workloadIdentityProviderId" ,container.Add ); + AddIf( null != (((object)this._serviceAccountEmailAddress)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._serviceAccountEmailAddress.ToString()) : null, "serviceAccountEmailAddress" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingVMScanners.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingVMScanners.PowerShell.cs new file mode 100644 index 000000000000..0170a4e269dd --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingVMScanners.PowerShell.cs @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The Microsoft Defender for Server VM scanning configuration + [System.ComponentModel.TypeConverter(typeof(DefenderCspmGcpOfferingVMScannersTypeConverter))] + public partial class DefenderCspmGcpOfferingVMScanners + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DefenderCspmGcpOfferingVMScanners(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Configuration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersInternal)this).Configuration = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersConfiguration) content.GetValueForProperty("Configuration",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersInternal)this).Configuration, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmGcpOfferingVMScannersConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("Enabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersInternal)this).Enabled = (bool?) content.GetValueForProperty("Enabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersInternal)this).Enabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ConfigurationScanningMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersInternal)this).ConfigurationScanningMode = (string) content.GetValueForProperty("ConfigurationScanningMode",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersInternal)this).ConfigurationScanningMode, global::System.Convert.ToString); + } + if (content.Contains("ConfigurationExclusionTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersInternal)this).ConfigurationExclusionTag = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersConfigurationExclusionTags) content.GetValueForProperty("ConfigurationExclusionTag",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersInternal)this).ConfigurationExclusionTag, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmGcpOfferingVMScannersConfigurationExclusionTagsTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DefenderCspmGcpOfferingVMScanners(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Configuration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersInternal)this).Configuration = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersConfiguration) content.GetValueForProperty("Configuration",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersInternal)this).Configuration, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmGcpOfferingVMScannersConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("Enabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersInternal)this).Enabled = (bool?) content.GetValueForProperty("Enabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersInternal)this).Enabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ConfigurationScanningMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersInternal)this).ConfigurationScanningMode = (string) content.GetValueForProperty("ConfigurationScanningMode",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersInternal)this).ConfigurationScanningMode, global::System.Convert.ToString); + } + if (content.Contains("ConfigurationExclusionTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersInternal)this).ConfigurationExclusionTag = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersConfigurationExclusionTags) content.GetValueForProperty("ConfigurationExclusionTag",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersInternal)this).ConfigurationExclusionTag, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmGcpOfferingVMScannersConfigurationExclusionTagsTypeConverter.ConvertFrom); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScanners DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DefenderCspmGcpOfferingVMScanners(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScanners DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DefenderCspmGcpOfferingVMScanners(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScanners FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The Microsoft Defender for Server VM scanning configuration + [System.ComponentModel.TypeConverter(typeof(DefenderCspmGcpOfferingVMScannersTypeConverter))] + public partial interface IDefenderCspmGcpOfferingVMScanners + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingVMScanners.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingVMScanners.TypeConverter.cs new file mode 100644 index 000000000000..ca06765a6c39 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingVMScanners.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DefenderCspmGcpOfferingVMScannersTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScanners ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScanners).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DefenderCspmGcpOfferingVMScanners.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DefenderCspmGcpOfferingVMScanners.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DefenderCspmGcpOfferingVMScanners.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingVMScanners.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingVMScanners.cs new file mode 100644 index 000000000000..e3c8a6fdece5 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingVMScanners.cs @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The Microsoft Defender for Server VM scanning configuration + public partial class DefenderCspmGcpOfferingVMScanners : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScanners, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersConfiguration _configuration; + + /// configuration for Microsoft Defender for Server VM scanning + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersConfiguration Configuration { get => (this._configuration = this._configuration ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmGcpOfferingVMScannersConfiguration()); set => this._configuration = value; } + + /// VM tags that indicates that VM should not be scanned + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersConfigurationExclusionTags ConfigurationExclusionTag { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersConfigurationInternal)Configuration).ExclusionTag; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersConfigurationInternal)Configuration).ExclusionTag = value ?? null /* model class */; } + + /// The scanning mode for the VM scan. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string ConfigurationScanningMode { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersConfigurationInternal)Configuration).ScanningMode; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersConfigurationInternal)Configuration).ScanningMode = value ?? null; } + + /// Backing field for property. + private bool? _enabled; + + /// Is Microsoft Defender for Server VM scanning enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public bool? Enabled { get => this._enabled; set => this._enabled = value; } + + /// Internal Acessors for Configuration + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersConfiguration Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersInternal.Configuration { get => (this._configuration = this._configuration ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmGcpOfferingVMScannersConfiguration()); set { {_configuration = value;} } } + + /// Creates an new instance. + public DefenderCspmGcpOfferingVMScanners() + { + + } + } + /// The Microsoft Defender for Server VM scanning configuration + public partial interface IDefenderCspmGcpOfferingVMScanners : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// VM tags that indicates that VM should not be scanned + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"VM tags that indicates that VM should not be scanned", + SerializedName = @"exclusionTags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersConfigurationExclusionTags) })] + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersConfigurationExclusionTags ConfigurationExclusionTag { get; set; } + /// The scanning mode for the VM scan. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The scanning mode for the VM scan.", + SerializedName = @"scanningMode", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Default")] + string ConfigurationScanningMode { get; set; } + /// Is Microsoft Defender for Server VM scanning enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Is Microsoft Defender for Server VM scanning enabled", + SerializedName = @"enabled", + PossibleTypes = new [] { typeof(bool) })] + bool? Enabled { get; set; } + + } + /// The Microsoft Defender for Server VM scanning configuration + internal partial interface IDefenderCspmGcpOfferingVMScannersInternal + + { + /// configuration for Microsoft Defender for Server VM scanning + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersConfiguration Configuration { get; set; } + /// VM tags that indicates that VM should not be scanned + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersConfigurationExclusionTags ConfigurationExclusionTag { get; set; } + /// The scanning mode for the VM scan. + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Default")] + string ConfigurationScanningMode { get; set; } + /// Is Microsoft Defender for Server VM scanning enabled + bool? Enabled { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingVMScanners.json.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingVMScanners.json.cs new file mode 100644 index 000000000000..cd67b6b289e2 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingVMScanners.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The Microsoft Defender for Server VM scanning configuration + public partial class DefenderCspmGcpOfferingVMScanners + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal DefenderCspmGcpOfferingVMScanners(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_configuration = If( json?.PropertyT("configuration"), out var __jsonConfiguration) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmGcpOfferingVMScannersConfiguration.FromJson(__jsonConfiguration) : _configuration;} + {_enabled = If( json?.PropertyT("enabled"), out var __jsonEnabled) ? (bool?)__jsonEnabled : _enabled;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScanners. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScanners. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScanners FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DefenderCspmGcpOfferingVMScanners(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._configuration ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._configuration.ToJson(null,serializationMode) : null, "configuration" ,container.Add ); + AddIf( null != this._enabled ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonBoolean((bool)this._enabled) : null, "enabled" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingVMScannersConfiguration.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingVMScannersConfiguration.PowerShell.cs new file mode 100644 index 000000000000..2abc3ac2c44b --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingVMScannersConfiguration.PowerShell.cs @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// configuration for Microsoft Defender for Server VM scanning + [System.ComponentModel.TypeConverter(typeof(DefenderCspmGcpOfferingVMScannersConfigurationTypeConverter))] + public partial class DefenderCspmGcpOfferingVMScannersConfiguration + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DefenderCspmGcpOfferingVMScannersConfiguration(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ScanningMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersConfigurationInternal)this).ScanningMode = (string) content.GetValueForProperty("ScanningMode",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersConfigurationInternal)this).ScanningMode, global::System.Convert.ToString); + } + if (content.Contains("ExclusionTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersConfigurationInternal)this).ExclusionTag = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersConfigurationExclusionTags) content.GetValueForProperty("ExclusionTag",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersConfigurationInternal)this).ExclusionTag, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmGcpOfferingVMScannersConfigurationExclusionTagsTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DefenderCspmGcpOfferingVMScannersConfiguration(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ScanningMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersConfigurationInternal)this).ScanningMode = (string) content.GetValueForProperty("ScanningMode",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersConfigurationInternal)this).ScanningMode, global::System.Convert.ToString); + } + if (content.Contains("ExclusionTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersConfigurationInternal)this).ExclusionTag = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersConfigurationExclusionTags) content.GetValueForProperty("ExclusionTag",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersConfigurationInternal)this).ExclusionTag, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmGcpOfferingVMScannersConfigurationExclusionTagsTypeConverter.ConvertFrom); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersConfiguration DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DefenderCspmGcpOfferingVMScannersConfiguration(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersConfiguration DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DefenderCspmGcpOfferingVMScannersConfiguration(content); + } + + /// + /// Creates a new instance of , deserializing the content from + /// a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersConfiguration FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// configuration for Microsoft Defender for Server VM scanning + [System.ComponentModel.TypeConverter(typeof(DefenderCspmGcpOfferingVMScannersConfigurationTypeConverter))] + public partial interface IDefenderCspmGcpOfferingVMScannersConfiguration + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingVMScannersConfiguration.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingVMScannersConfiguration.TypeConverter.cs new file mode 100644 index 000000000000..f8db28d1a997 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingVMScannersConfiguration.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DefenderCspmGcpOfferingVMScannersConfigurationTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, + /// otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersConfiguration ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersConfiguration).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DefenderCspmGcpOfferingVMScannersConfiguration.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DefenderCspmGcpOfferingVMScannersConfiguration.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DefenderCspmGcpOfferingVMScannersConfiguration.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingVMScannersConfiguration.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingVMScannersConfiguration.cs new file mode 100644 index 000000000000..6ec70c6023ea --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingVMScannersConfiguration.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// configuration for Microsoft Defender for Server VM scanning + public partial class DefenderCspmGcpOfferingVMScannersConfiguration : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersConfiguration, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersConfigurationInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersConfigurationExclusionTags _exclusionTag; + + /// VM tags that indicates that VM should not be scanned + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersConfigurationExclusionTags ExclusionTag { get => (this._exclusionTag = this._exclusionTag ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmGcpOfferingVMScannersConfigurationExclusionTags()); set => this._exclusionTag = value; } + + /// Backing field for property. + private string _scanningMode; + + /// The scanning mode for the VM scan. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string ScanningMode { get => this._scanningMode; set => this._scanningMode = value; } + + /// + /// Creates an new instance. + /// + public DefenderCspmGcpOfferingVMScannersConfiguration() + { + + } + } + /// configuration for Microsoft Defender for Server VM scanning + public partial interface IDefenderCspmGcpOfferingVMScannersConfiguration : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// VM tags that indicates that VM should not be scanned + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"VM tags that indicates that VM should not be scanned", + SerializedName = @"exclusionTags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersConfigurationExclusionTags) })] + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersConfigurationExclusionTags ExclusionTag { get; set; } + /// The scanning mode for the VM scan. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The scanning mode for the VM scan.", + SerializedName = @"scanningMode", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Default")] + string ScanningMode { get; set; } + + } + /// configuration for Microsoft Defender for Server VM scanning + internal partial interface IDefenderCspmGcpOfferingVMScannersConfigurationInternal + + { + /// VM tags that indicates that VM should not be scanned + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersConfigurationExclusionTags ExclusionTag { get; set; } + /// The scanning mode for the VM scan. + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Default")] + string ScanningMode { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingVMScannersConfiguration.json.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingVMScannersConfiguration.json.cs new file mode 100644 index 000000000000..bfff9273d166 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingVMScannersConfiguration.json.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// configuration for Microsoft Defender for Server VM scanning + public partial class DefenderCspmGcpOfferingVMScannersConfiguration + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal DefenderCspmGcpOfferingVMScannersConfiguration(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_scanningMode = If( json?.PropertyT("scanningMode"), out var __jsonScanningMode) ? (string)__jsonScanningMode : (string)_scanningMode;} + {_exclusionTag = If( json?.PropertyT("exclusionTags"), out var __jsonExclusionTags) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmGcpOfferingVMScannersConfigurationExclusionTags.FromJson(__jsonExclusionTags) : _exclusionTag;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersConfiguration. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersConfiguration. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersConfiguration FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DefenderCspmGcpOfferingVMScannersConfiguration(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._scanningMode)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._scanningMode.ToString()) : null, "scanningMode" ,container.Add ); + AddIf( null != this._exclusionTag ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._exclusionTag.ToJson(null,serializationMode) : null, "exclusionTags" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingVMScannersConfigurationExclusionTags.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingVMScannersConfigurationExclusionTags.PowerShell.cs new file mode 100644 index 000000000000..ac7a27e06dac --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingVMScannersConfigurationExclusionTags.PowerShell.cs @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// VM tags that indicates that VM should not be scanned + [System.ComponentModel.TypeConverter(typeof(DefenderCspmGcpOfferingVMScannersConfigurationExclusionTagsTypeConverter))] + public partial class DefenderCspmGcpOfferingVMScannersConfigurationExclusionTags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DefenderCspmGcpOfferingVMScannersConfigurationExclusionTags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DefenderCspmGcpOfferingVMScannersConfigurationExclusionTags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersConfigurationExclusionTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DefenderCspmGcpOfferingVMScannersConfigurationExclusionTags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersConfigurationExclusionTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DefenderCspmGcpOfferingVMScannersConfigurationExclusionTags(content); + } + + /// + /// Creates a new instance of , deserializing the + /// content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersConfigurationExclusionTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// VM tags that indicates that VM should not be scanned + [System.ComponentModel.TypeConverter(typeof(DefenderCspmGcpOfferingVMScannersConfigurationExclusionTagsTypeConverter))] + public partial interface IDefenderCspmGcpOfferingVMScannersConfigurationExclusionTags + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingVMScannersConfigurationExclusionTags.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingVMScannersConfigurationExclusionTags.TypeConverter.cs new file mode 100644 index 000000000000..3cb469d8641a --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingVMScannersConfigurationExclusionTags.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DefenderCspmGcpOfferingVMScannersConfigurationExclusionTagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is + /// no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is + /// no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersConfigurationExclusionTags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersConfigurationExclusionTags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DefenderCspmGcpOfferingVMScannersConfigurationExclusionTags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DefenderCspmGcpOfferingVMScannersConfigurationExclusionTags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DefenderCspmGcpOfferingVMScannersConfigurationExclusionTags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingVMScannersConfigurationExclusionTags.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingVMScannersConfigurationExclusionTags.cs new file mode 100644 index 000000000000..18174e093e38 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingVMScannersConfigurationExclusionTags.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// VM tags that indicates that VM should not be scanned + public partial class DefenderCspmGcpOfferingVMScannersConfigurationExclusionTags : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersConfigurationExclusionTags, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersConfigurationExclusionTagsInternal + { + + /// + /// Creates an new instance. + /// + public DefenderCspmGcpOfferingVMScannersConfigurationExclusionTags() + { + + } + } + /// VM tags that indicates that VM should not be scanned + public partial interface IDefenderCspmGcpOfferingVMScannersConfigurationExclusionTags : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray + { + + } + /// VM tags that indicates that VM should not be scanned + internal partial interface IDefenderCspmGcpOfferingVMScannersConfigurationExclusionTagsInternal + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingVMScannersConfigurationExclusionTags.dictionary.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingVMScannersConfigurationExclusionTags.dictionary.cs new file mode 100644 index 000000000000..6434dde5737f --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingVMScannersConfigurationExclusionTags.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + public partial class DefenderCspmGcpOfferingVMScannersConfigurationExclusionTags : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmGcpOfferingVMScannersConfigurationExclusionTags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingVMScannersConfigurationExclusionTags.json.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingVMScannersConfigurationExclusionTags.json.cs new file mode 100644 index 000000000000..50fc0bab44cf --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderCspmGcpOfferingVMScannersConfigurationExclusionTags.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// VM tags that indicates that VM should not be scanned + public partial class DefenderCspmGcpOfferingVMScannersConfigurationExclusionTags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + /// + internal DefenderCspmGcpOfferingVMScannersConfigurationExclusionTags(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersConfigurationExclusionTags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersConfigurationExclusionTags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersConfigurationExclusionTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DefenderCspmGcpOfferingVMScannersConfigurationExclusionTags(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderFoDatabasesAwsOfferingArcAutoProvisioning.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderFoDatabasesAwsOfferingArcAutoProvisioning.PowerShell.cs new file mode 100644 index 000000000000..214953c076a5 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderFoDatabasesAwsOfferingArcAutoProvisioning.PowerShell.cs @@ -0,0 +1,201 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The ARC autoprovisioning configuration + [System.ComponentModel.TypeConverter(typeof(DefenderFoDatabasesAwsOfferingArcAutoProvisioningTypeConverter))] + public partial class DefenderFoDatabasesAwsOfferingArcAutoProvisioning + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DefenderFoDatabasesAwsOfferingArcAutoProvisioning(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Configuration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioningInternal)this).Configuration = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioningConfiguration) content.GetValueForProperty("Configuration",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioningInternal)this).Configuration, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderFoDatabasesAwsOfferingArcAutoProvisioningConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("Enabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioningInternal)this).Enabled = (bool?) content.GetValueForProperty("Enabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioningInternal)this).Enabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("CloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioningInternal)this).CloudRoleArn = (string) content.GetValueForProperty("CloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioningInternal)this).CloudRoleArn, global::System.Convert.ToString); + } + if (content.Contains("ConfigurationProxy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioningInternal)this).ConfigurationProxy = (string) content.GetValueForProperty("ConfigurationProxy",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioningInternal)this).ConfigurationProxy, global::System.Convert.ToString); + } + if (content.Contains("ConfigurationPrivateLinkScope")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioningInternal)this).ConfigurationPrivateLinkScope = (string) content.GetValueForProperty("ConfigurationPrivateLinkScope",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioningInternal)this).ConfigurationPrivateLinkScope, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DefenderFoDatabasesAwsOfferingArcAutoProvisioning(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Configuration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioningInternal)this).Configuration = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioningConfiguration) content.GetValueForProperty("Configuration",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioningInternal)this).Configuration, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderFoDatabasesAwsOfferingArcAutoProvisioningConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("Enabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioningInternal)this).Enabled = (bool?) content.GetValueForProperty("Enabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioningInternal)this).Enabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("CloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioningInternal)this).CloudRoleArn = (string) content.GetValueForProperty("CloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioningInternal)this).CloudRoleArn, global::System.Convert.ToString); + } + if (content.Contains("ConfigurationProxy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioningInternal)this).ConfigurationProxy = (string) content.GetValueForProperty("ConfigurationProxy",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioningInternal)this).ConfigurationProxy, global::System.Convert.ToString); + } + if (content.Contains("ConfigurationPrivateLinkScope")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioningInternal)this).ConfigurationPrivateLinkScope = (string) content.GetValueForProperty("ConfigurationPrivateLinkScope",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioningInternal)this).ConfigurationPrivateLinkScope, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioning DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DefenderFoDatabasesAwsOfferingArcAutoProvisioning(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioning DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DefenderFoDatabasesAwsOfferingArcAutoProvisioning(content); + } + + /// + /// Creates a new instance of , deserializing the content + /// from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioning FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The ARC autoprovisioning configuration + [System.ComponentModel.TypeConverter(typeof(DefenderFoDatabasesAwsOfferingArcAutoProvisioningTypeConverter))] + public partial interface IDefenderFoDatabasesAwsOfferingArcAutoProvisioning + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderFoDatabasesAwsOfferingArcAutoProvisioning.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderFoDatabasesAwsOfferingArcAutoProvisioning.TypeConverter.cs new file mode 100644 index 000000000000..e9fd98cbc313 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderFoDatabasesAwsOfferingArcAutoProvisioning.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DefenderFoDatabasesAwsOfferingArcAutoProvisioningTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, + /// otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioning ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioning).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DefenderFoDatabasesAwsOfferingArcAutoProvisioning.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DefenderFoDatabasesAwsOfferingArcAutoProvisioning.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DefenderFoDatabasesAwsOfferingArcAutoProvisioning.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderFoDatabasesAwsOfferingArcAutoProvisioning.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderFoDatabasesAwsOfferingArcAutoProvisioning.cs new file mode 100644 index 000000000000..f56bf062fcf9 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderFoDatabasesAwsOfferingArcAutoProvisioning.cs @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The ARC autoprovisioning configuration + public partial class DefenderFoDatabasesAwsOfferingArcAutoProvisioning : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioning, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioningInternal + { + + /// Backing field for property. + private string _cloudRoleArn; + + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string CloudRoleArn { get => this._cloudRoleArn; set => this._cloudRoleArn = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioningConfiguration _configuration; + + /// Configuration for servers Arc auto provisioning + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioningConfiguration Configuration { get => (this._configuration = this._configuration ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderFoDatabasesAwsOfferingArcAutoProvisioningConfiguration()); set => this._configuration = value; } + + /// Optional Arc private link scope resource id to link the Arc agent + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string ConfigurationPrivateLinkScope { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioningConfigurationInternal)Configuration).PrivateLinkScope; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioningConfigurationInternal)Configuration).PrivateLinkScope = value ?? null; } + + /// Optional http proxy endpoint to use for the Arc agent + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string ConfigurationProxy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioningConfigurationInternal)Configuration).Proxy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioningConfigurationInternal)Configuration).Proxy = value ?? null; } + + /// Backing field for property. + private bool? _enabled; + + /// Is arc auto provisioning enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public bool? Enabled { get => this._enabled; set => this._enabled = value; } + + /// Internal Acessors for Configuration + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioningConfiguration Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioningInternal.Configuration { get => (this._configuration = this._configuration ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderFoDatabasesAwsOfferingArcAutoProvisioningConfiguration()); set { {_configuration = value;} } } + + /// + /// Creates an new instance. + /// + public DefenderFoDatabasesAwsOfferingArcAutoProvisioning() + { + + } + } + /// The ARC autoprovisioning configuration + public partial interface IDefenderFoDatabasesAwsOfferingArcAutoProvisioning : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The cloud role ARN in AWS for this feature", + SerializedName = @"cloudRoleArn", + PossibleTypes = new [] { typeof(string) })] + string CloudRoleArn { get; set; } + /// Optional Arc private link scope resource id to link the Arc agent + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Optional Arc private link scope resource id to link the Arc agent", + SerializedName = @"privateLinkScope", + PossibleTypes = new [] { typeof(string) })] + string ConfigurationPrivateLinkScope { get; set; } + /// Optional http proxy endpoint to use for the Arc agent + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Optional http proxy endpoint to use for the Arc agent", + SerializedName = @"proxy", + PossibleTypes = new [] { typeof(string) })] + string ConfigurationProxy { get; set; } + /// Is arc auto provisioning enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Is arc auto provisioning enabled", + SerializedName = @"enabled", + PossibleTypes = new [] { typeof(bool) })] + bool? Enabled { get; set; } + + } + /// The ARC autoprovisioning configuration + internal partial interface IDefenderFoDatabasesAwsOfferingArcAutoProvisioningInternal + + { + /// The cloud role ARN in AWS for this feature + string CloudRoleArn { get; set; } + /// Configuration for servers Arc auto provisioning + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioningConfiguration Configuration { get; set; } + /// Optional Arc private link scope resource id to link the Arc agent + string ConfigurationPrivateLinkScope { get; set; } + /// Optional http proxy endpoint to use for the Arc agent + string ConfigurationProxy { get; set; } + /// Is arc auto provisioning enabled + bool? Enabled { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderFoDatabasesAwsOfferingArcAutoProvisioning.json.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderFoDatabasesAwsOfferingArcAutoProvisioning.json.cs new file mode 100644 index 000000000000..e6558814f01b --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderFoDatabasesAwsOfferingArcAutoProvisioning.json.cs @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The ARC autoprovisioning configuration + public partial class DefenderFoDatabasesAwsOfferingArcAutoProvisioning + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal DefenderFoDatabasesAwsOfferingArcAutoProvisioning(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_configuration = If( json?.PropertyT("configuration"), out var __jsonConfiguration) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderFoDatabasesAwsOfferingArcAutoProvisioningConfiguration.FromJson(__jsonConfiguration) : _configuration;} + {_enabled = If( json?.PropertyT("enabled"), out var __jsonEnabled) ? (bool?)__jsonEnabled : _enabled;} + {_cloudRoleArn = If( json?.PropertyT("cloudRoleArn"), out var __jsonCloudRoleArn) ? (string)__jsonCloudRoleArn : (string)_cloudRoleArn;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioning. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioning. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioning FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DefenderFoDatabasesAwsOfferingArcAutoProvisioning(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._configuration ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._configuration.ToJson(null,serializationMode) : null, "configuration" ,container.Add ); + AddIf( null != this._enabled ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonBoolean((bool)this._enabled) : null, "enabled" ,container.Add ); + AddIf( null != (((object)this._cloudRoleArn)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._cloudRoleArn.ToString()) : null, "cloudRoleArn" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderFoDatabasesAwsOfferingArcAutoProvisioningConfiguration.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderFoDatabasesAwsOfferingArcAutoProvisioningConfiguration.PowerShell.cs new file mode 100644 index 000000000000..ffee4df3481a --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderFoDatabasesAwsOfferingArcAutoProvisioningConfiguration.PowerShell.cs @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// Configuration for servers Arc auto provisioning + [System.ComponentModel.TypeConverter(typeof(DefenderFoDatabasesAwsOfferingArcAutoProvisioningConfigurationTypeConverter))] + public partial class DefenderFoDatabasesAwsOfferingArcAutoProvisioningConfiguration + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DefenderFoDatabasesAwsOfferingArcAutoProvisioningConfiguration(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Proxy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioningConfigurationInternal)this).Proxy = (string) content.GetValueForProperty("Proxy",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioningConfigurationInternal)this).Proxy, global::System.Convert.ToString); + } + if (content.Contains("PrivateLinkScope")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioningConfigurationInternal)this).PrivateLinkScope = (string) content.GetValueForProperty("PrivateLinkScope",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioningConfigurationInternal)this).PrivateLinkScope, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DefenderFoDatabasesAwsOfferingArcAutoProvisioningConfiguration(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Proxy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioningConfigurationInternal)this).Proxy = (string) content.GetValueForProperty("Proxy",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioningConfigurationInternal)this).Proxy, global::System.Convert.ToString); + } + if (content.Contains("PrivateLinkScope")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioningConfigurationInternal)this).PrivateLinkScope = (string) content.GetValueForProperty("PrivateLinkScope",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioningConfigurationInternal)this).PrivateLinkScope, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioningConfiguration DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DefenderFoDatabasesAwsOfferingArcAutoProvisioningConfiguration(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioningConfiguration DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DefenderFoDatabasesAwsOfferingArcAutoProvisioningConfiguration(content); + } + + /// + /// Creates a new instance of , deserializing + /// the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioningConfiguration FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// Configuration for servers Arc auto provisioning + [System.ComponentModel.TypeConverter(typeof(DefenderFoDatabasesAwsOfferingArcAutoProvisioningConfigurationTypeConverter))] + public partial interface IDefenderFoDatabasesAwsOfferingArcAutoProvisioningConfiguration + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderFoDatabasesAwsOfferingArcAutoProvisioningConfiguration.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderFoDatabasesAwsOfferingArcAutoProvisioningConfiguration.TypeConverter.cs new file mode 100644 index 000000000000..83dbb88015bf --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderFoDatabasesAwsOfferingArcAutoProvisioningConfiguration.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DefenderFoDatabasesAwsOfferingArcAutoProvisioningConfigurationTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there + /// is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there + /// is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioningConfiguration ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioningConfiguration).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DefenderFoDatabasesAwsOfferingArcAutoProvisioningConfiguration.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DefenderFoDatabasesAwsOfferingArcAutoProvisioningConfiguration.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DefenderFoDatabasesAwsOfferingArcAutoProvisioningConfiguration.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderFoDatabasesAwsOfferingArcAutoProvisioningConfiguration.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderFoDatabasesAwsOfferingArcAutoProvisioningConfiguration.cs new file mode 100644 index 000000000000..42184d946a7e --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderFoDatabasesAwsOfferingArcAutoProvisioningConfiguration.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// Configuration for servers Arc auto provisioning + public partial class DefenderFoDatabasesAwsOfferingArcAutoProvisioningConfiguration : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioningConfiguration, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioningConfigurationInternal + { + + /// Backing field for property. + private string _privateLinkScope; + + /// Optional Arc private link scope resource id to link the Arc agent + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string PrivateLinkScope { get => this._privateLinkScope; set => this._privateLinkScope = value; } + + /// Backing field for property. + private string _proxy; + + /// Optional http proxy endpoint to use for the Arc agent + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string Proxy { get => this._proxy; set => this._proxy = value; } + + /// + /// Creates an new instance. + /// + public DefenderFoDatabasesAwsOfferingArcAutoProvisioningConfiguration() + { + + } + } + /// Configuration for servers Arc auto provisioning + public partial interface IDefenderFoDatabasesAwsOfferingArcAutoProvisioningConfiguration : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// Optional Arc private link scope resource id to link the Arc agent + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Optional Arc private link scope resource id to link the Arc agent", + SerializedName = @"privateLinkScope", + PossibleTypes = new [] { typeof(string) })] + string PrivateLinkScope { get; set; } + /// Optional http proxy endpoint to use for the Arc agent + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Optional http proxy endpoint to use for the Arc agent", + SerializedName = @"proxy", + PossibleTypes = new [] { typeof(string) })] + string Proxy { get; set; } + + } + /// Configuration for servers Arc auto provisioning + internal partial interface IDefenderFoDatabasesAwsOfferingArcAutoProvisioningConfigurationInternal + + { + /// Optional Arc private link scope resource id to link the Arc agent + string PrivateLinkScope { get; set; } + /// Optional http proxy endpoint to use for the Arc agent + string Proxy { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderFoDatabasesAwsOfferingArcAutoProvisioningConfiguration.json.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderFoDatabasesAwsOfferingArcAutoProvisioningConfiguration.json.cs new file mode 100644 index 000000000000..825c3629e6f9 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderFoDatabasesAwsOfferingArcAutoProvisioningConfiguration.json.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// Configuration for servers Arc auto provisioning + public partial class DefenderFoDatabasesAwsOfferingArcAutoProvisioningConfiguration + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal DefenderFoDatabasesAwsOfferingArcAutoProvisioningConfiguration(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_proxy = If( json?.PropertyT("proxy"), out var __jsonProxy) ? (string)__jsonProxy : (string)_proxy;} + {_privateLinkScope = If( json?.PropertyT("privateLinkScope"), out var __jsonPrivateLinkScope) ? (string)__jsonPrivateLinkScope : (string)_privateLinkScope;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioningConfiguration. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioningConfiguration. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioningConfiguration FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DefenderFoDatabasesAwsOfferingArcAutoProvisioningConfiguration(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._proxy)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._proxy.ToString()) : null, "proxy" ,container.Add ); + AddIf( null != (((object)this._privateLinkScope)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._privateLinkScope.ToString()) : null, "privateLinkScope" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderFoDatabasesAwsOfferingDatabasesDspm.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderFoDatabasesAwsOfferingDatabasesDspm.PowerShell.cs new file mode 100644 index 000000000000..c2b4197c4730 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderFoDatabasesAwsOfferingDatabasesDspm.PowerShell.cs @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The databases data security posture management (DSPM) configuration + [System.ComponentModel.TypeConverter(typeof(DefenderFoDatabasesAwsOfferingDatabasesDspmTypeConverter))] + public partial class DefenderFoDatabasesAwsOfferingDatabasesDspm + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DefenderFoDatabasesAwsOfferingDatabasesDspm(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Enabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingDatabasesDspmInternal)this).Enabled = (bool?) content.GetValueForProperty("Enabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingDatabasesDspmInternal)this).Enabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("CloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingDatabasesDspmInternal)this).CloudRoleArn = (string) content.GetValueForProperty("CloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingDatabasesDspmInternal)this).CloudRoleArn, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DefenderFoDatabasesAwsOfferingDatabasesDspm(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Enabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingDatabasesDspmInternal)this).Enabled = (bool?) content.GetValueForProperty("Enabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingDatabasesDspmInternal)this).Enabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("CloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingDatabasesDspmInternal)this).CloudRoleArn = (string) content.GetValueForProperty("CloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingDatabasesDspmInternal)this).CloudRoleArn, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingDatabasesDspm DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DefenderFoDatabasesAwsOfferingDatabasesDspm(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingDatabasesDspm DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DefenderFoDatabasesAwsOfferingDatabasesDspm(content); + } + + /// + /// Creates a new instance of , deserializing the content from a + /// json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingDatabasesDspm FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The databases data security posture management (DSPM) configuration + [System.ComponentModel.TypeConverter(typeof(DefenderFoDatabasesAwsOfferingDatabasesDspmTypeConverter))] + public partial interface IDefenderFoDatabasesAwsOfferingDatabasesDspm + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderFoDatabasesAwsOfferingDatabasesDspm.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderFoDatabasesAwsOfferingDatabasesDspm.TypeConverter.cs new file mode 100644 index 000000000000..6fe85201c2a4 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderFoDatabasesAwsOfferingDatabasesDspm.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DefenderFoDatabasesAwsOfferingDatabasesDspmTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingDatabasesDspm ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingDatabasesDspm).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DefenderFoDatabasesAwsOfferingDatabasesDspm.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DefenderFoDatabasesAwsOfferingDatabasesDspm.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DefenderFoDatabasesAwsOfferingDatabasesDspm.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderFoDatabasesAwsOfferingDatabasesDspm.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderFoDatabasesAwsOfferingDatabasesDspm.cs new file mode 100644 index 000000000000..89a135b262c4 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderFoDatabasesAwsOfferingDatabasesDspm.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The databases data security posture management (DSPM) configuration + public partial class DefenderFoDatabasesAwsOfferingDatabasesDspm : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingDatabasesDspm, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingDatabasesDspmInternal + { + + /// Backing field for property. + private string _cloudRoleArn; + + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string CloudRoleArn { get => this._cloudRoleArn; set => this._cloudRoleArn = value; } + + /// Backing field for property. + private bool? _enabled; + + /// Is databases data security posture management (DSPM) protection enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public bool? Enabled { get => this._enabled; set => this._enabled = value; } + + /// + /// Creates an new instance. + /// + public DefenderFoDatabasesAwsOfferingDatabasesDspm() + { + + } + } + /// The databases data security posture management (DSPM) configuration + public partial interface IDefenderFoDatabasesAwsOfferingDatabasesDspm : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The cloud role ARN in AWS for this feature", + SerializedName = @"cloudRoleArn", + PossibleTypes = new [] { typeof(string) })] + string CloudRoleArn { get; set; } + /// Is databases data security posture management (DSPM) protection enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Is databases data security posture management (DSPM) protection enabled", + SerializedName = @"enabled", + PossibleTypes = new [] { typeof(bool) })] + bool? Enabled { get; set; } + + } + /// The databases data security posture management (DSPM) configuration + internal partial interface IDefenderFoDatabasesAwsOfferingDatabasesDspmInternal + + { + /// The cloud role ARN in AWS for this feature + string CloudRoleArn { get; set; } + /// Is databases data security posture management (DSPM) protection enabled + bool? Enabled { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderFoDatabasesAwsOfferingDatabasesDspm.json.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderFoDatabasesAwsOfferingDatabasesDspm.json.cs new file mode 100644 index 000000000000..93c30101aaef --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderFoDatabasesAwsOfferingDatabasesDspm.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The databases data security posture management (DSPM) configuration + public partial class DefenderFoDatabasesAwsOfferingDatabasesDspm + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal DefenderFoDatabasesAwsOfferingDatabasesDspm(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_enabled = If( json?.PropertyT("enabled"), out var __jsonEnabled) ? (bool?)__jsonEnabled : _enabled;} + {_cloudRoleArn = If( json?.PropertyT("cloudRoleArn"), out var __jsonCloudRoleArn) ? (string)__jsonCloudRoleArn : (string)_cloudRoleArn;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingDatabasesDspm. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingDatabasesDspm. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingDatabasesDspm FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DefenderFoDatabasesAwsOfferingDatabasesDspm(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._enabled ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonBoolean((bool)this._enabled) : null, "enabled" ,container.Add ); + AddIf( null != (((object)this._cloudRoleArn)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._cloudRoleArn.ToString()) : null, "cloudRoleArn" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderFoDatabasesAwsOfferingRds.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderFoDatabasesAwsOfferingRds.PowerShell.cs new file mode 100644 index 000000000000..fbcafa62076e --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderFoDatabasesAwsOfferingRds.PowerShell.cs @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The RDS configuration + [System.ComponentModel.TypeConverter(typeof(DefenderFoDatabasesAwsOfferingRdsTypeConverter))] + public partial class DefenderFoDatabasesAwsOfferingRds + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DefenderFoDatabasesAwsOfferingRds(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Enabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingRdsInternal)this).Enabled = (bool?) content.GetValueForProperty("Enabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingRdsInternal)this).Enabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("CloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingRdsInternal)this).CloudRoleArn = (string) content.GetValueForProperty("CloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingRdsInternal)this).CloudRoleArn, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DefenderFoDatabasesAwsOfferingRds(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Enabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingRdsInternal)this).Enabled = (bool?) content.GetValueForProperty("Enabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingRdsInternal)this).Enabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("CloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingRdsInternal)this).CloudRoleArn = (string) content.GetValueForProperty("CloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingRdsInternal)this).CloudRoleArn, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingRds DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DefenderFoDatabasesAwsOfferingRds(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingRds DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DefenderFoDatabasesAwsOfferingRds(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingRds FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The RDS configuration + [System.ComponentModel.TypeConverter(typeof(DefenderFoDatabasesAwsOfferingRdsTypeConverter))] + public partial interface IDefenderFoDatabasesAwsOfferingRds + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderFoDatabasesAwsOfferingRds.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderFoDatabasesAwsOfferingRds.TypeConverter.cs new file mode 100644 index 000000000000..7de077da3cb6 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderFoDatabasesAwsOfferingRds.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DefenderFoDatabasesAwsOfferingRdsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingRds ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingRds).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DefenderFoDatabasesAwsOfferingRds.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DefenderFoDatabasesAwsOfferingRds.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DefenderFoDatabasesAwsOfferingRds.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderFoDatabasesAwsOfferingRds.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderFoDatabasesAwsOfferingRds.cs new file mode 100644 index 000000000000..f2700cafe39d --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderFoDatabasesAwsOfferingRds.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The RDS configuration + public partial class DefenderFoDatabasesAwsOfferingRds : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingRds, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingRdsInternal + { + + /// Backing field for property. + private string _cloudRoleArn; + + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string CloudRoleArn { get => this._cloudRoleArn; set => this._cloudRoleArn = value; } + + /// Backing field for property. + private bool? _enabled; + + /// Is RDS protection enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public bool? Enabled { get => this._enabled; set => this._enabled = value; } + + /// Creates an new instance. + public DefenderFoDatabasesAwsOfferingRds() + { + + } + } + /// The RDS configuration + public partial interface IDefenderFoDatabasesAwsOfferingRds : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The cloud role ARN in AWS for this feature", + SerializedName = @"cloudRoleArn", + PossibleTypes = new [] { typeof(string) })] + string CloudRoleArn { get; set; } + /// Is RDS protection enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Is RDS protection enabled", + SerializedName = @"enabled", + PossibleTypes = new [] { typeof(bool) })] + bool? Enabled { get; set; } + + } + /// The RDS configuration + internal partial interface IDefenderFoDatabasesAwsOfferingRdsInternal + + { + /// The cloud role ARN in AWS for this feature + string CloudRoleArn { get; set; } + /// Is RDS protection enabled + bool? Enabled { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderFoDatabasesAwsOfferingRds.json.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderFoDatabasesAwsOfferingRds.json.cs new file mode 100644 index 000000000000..203325f2be46 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderFoDatabasesAwsOfferingRds.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The RDS configuration + public partial class DefenderFoDatabasesAwsOfferingRds + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal DefenderFoDatabasesAwsOfferingRds(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_enabled = If( json?.PropertyT("enabled"), out var __jsonEnabled) ? (bool?)__jsonEnabled : _enabled;} + {_cloudRoleArn = If( json?.PropertyT("cloudRoleArn"), out var __jsonCloudRoleArn) ? (string)__jsonCloudRoleArn : (string)_cloudRoleArn;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingRds. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingRds. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingRds FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DefenderFoDatabasesAwsOfferingRds(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._enabled ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonBoolean((bool)this._enabled) : null, "enabled" ,container.Add ); + AddIf( null != (((object)this._cloudRoleArn)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._cloudRoleArn.ToString()) : null, "cloudRoleArn" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOffering.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOffering.PowerShell.cs new file mode 100644 index 000000000000..7160178bac70 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOffering.PowerShell.cs @@ -0,0 +1,348 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The Defender for Containers AWS offering + [System.ComponentModel.TypeConverter(typeof(DefenderForContainersAwsOfferingTypeConverter))] + public partial class DefenderForContainersAwsOffering + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DefenderForContainersAwsOffering(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("KubernetesService")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).KubernetesService = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingKubernetesService) content.GetValueForProperty("KubernetesService",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).KubernetesService, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersAwsOfferingKubernetesServiceTypeConverter.ConvertFrom); + } + if (content.Contains("KubernetesScubaReader")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).KubernetesScubaReader = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingKubernetesScubaReader) content.GetValueForProperty("KubernetesScubaReader",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).KubernetesScubaReader, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersAwsOfferingKubernetesScubaReaderTypeConverter.ConvertFrom); + } + if (content.Contains("CloudWatchToKinesi")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).CloudWatchToKinesi = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingCloudWatchToKinesis) content.GetValueForProperty("CloudWatchToKinesi",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).CloudWatchToKinesi, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersAwsOfferingCloudWatchToKinesisTypeConverter.ConvertFrom); + } + if (content.Contains("KinesisToS3")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).KinesisToS3 = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingKinesisToS3) content.GetValueForProperty("KinesisToS3",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).KinesisToS3, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersAwsOfferingKinesisToS3TypeConverter.ConvertFrom); + } + if (content.Contains("ContainerVulnerabilityAssessment")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).ContainerVulnerabilityAssessment = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingContainerVulnerabilityAssessment) content.GetValueForProperty("ContainerVulnerabilityAssessment",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).ContainerVulnerabilityAssessment, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTypeConverter.ConvertFrom); + } + if (content.Contains("ContainerVulnerabilityAssessmentTask")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).ContainerVulnerabilityAssessmentTask = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTask) content.GetValueForProperty("ContainerVulnerabilityAssessmentTask",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).ContainerVulnerabilityAssessmentTask, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTaskTypeConverter.ConvertFrom); + } + if (content.Contains("MdcContainersImageAssessment")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).MdcContainersImageAssessment = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingMdcContainersImageAssessment) content.GetValueForProperty("MdcContainersImageAssessment",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).MdcContainersImageAssessment, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersAwsOfferingMdcContainersImageAssessmentTypeConverter.ConvertFrom); + } + if (content.Contains("MdcContainersAgentlessDiscoveryK8S")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).MdcContainersAgentlessDiscoveryK8S = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S) content.GetValueForProperty("MdcContainersAgentlessDiscoveryK8S",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).MdcContainersAgentlessDiscoveryK8S, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8STypeConverter.ConvertFrom); + } + if (content.Contains("EnableContainerVulnerabilityAssessment")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).EnableContainerVulnerabilityAssessment = (bool?) content.GetValueForProperty("EnableContainerVulnerabilityAssessment",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).EnableContainerVulnerabilityAssessment, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("AutoProvisioning")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).AutoProvisioning = (bool?) content.GetValueForProperty("AutoProvisioning",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).AutoProvisioning, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("KubeAuditRetentionTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).KubeAuditRetentionTime = (long?) content.GetValueForProperty("KubeAuditRetentionTime",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).KubeAuditRetentionTime, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ScubaExternalId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).ScubaExternalId = (string) content.GetValueForProperty("ScubaExternalId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).ScubaExternalId, global::System.Convert.ToString); + } + if (content.Contains("OfferingType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType = (string) content.GetValueForProperty("OfferingType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType, global::System.Convert.ToString); + } + if (content.Contains("Description")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description, global::System.Convert.ToString); + } + if (content.Contains("KuberneteServiceCloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).KuberneteServiceCloudRoleArn = (string) content.GetValueForProperty("KuberneteServiceCloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).KuberneteServiceCloudRoleArn, global::System.Convert.ToString); + } + if (content.Contains("KuberneteScubaReaderCloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).KuberneteScubaReaderCloudRoleArn = (string) content.GetValueForProperty("KuberneteScubaReaderCloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).KuberneteScubaReaderCloudRoleArn, global::System.Convert.ToString); + } + if (content.Contains("CloudWatchToKinesiCloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).CloudWatchToKinesiCloudRoleArn = (string) content.GetValueForProperty("CloudWatchToKinesiCloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).CloudWatchToKinesiCloudRoleArn, global::System.Convert.ToString); + } + if (content.Contains("KinesiToS3CloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).KinesiToS3CloudRoleArn = (string) content.GetValueForProperty("KinesiToS3CloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).KinesiToS3CloudRoleArn, global::System.Convert.ToString); + } + if (content.Contains("ContainerVulnerabilityAssessmentCloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).ContainerVulnerabilityAssessmentCloudRoleArn = (string) content.GetValueForProperty("ContainerVulnerabilityAssessmentCloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).ContainerVulnerabilityAssessmentCloudRoleArn, global::System.Convert.ToString); + } + if (content.Contains("ContainerVulnerabilityAssessmentTaskCloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).ContainerVulnerabilityAssessmentTaskCloudRoleArn = (string) content.GetValueForProperty("ContainerVulnerabilityAssessmentTaskCloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).ContainerVulnerabilityAssessmentTaskCloudRoleArn, global::System.Convert.ToString); + } + if (content.Contains("MdcContainerImageAssessmentEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).MdcContainerImageAssessmentEnabled = (bool?) content.GetValueForProperty("MdcContainerImageAssessmentEnabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).MdcContainerImageAssessmentEnabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("MdcContainerImageAssessmentCloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).MdcContainerImageAssessmentCloudRoleArn = (string) content.GetValueForProperty("MdcContainerImageAssessmentCloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).MdcContainerImageAssessmentCloudRoleArn, global::System.Convert.ToString); + } + if (content.Contains("MdcContainerAgentlessDiscoveryK8SEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).MdcContainerAgentlessDiscoveryK8SEnabled = (bool?) content.GetValueForProperty("MdcContainerAgentlessDiscoveryK8SEnabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).MdcContainerAgentlessDiscoveryK8SEnabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("MdcContainerAgentlessDiscoveryK8SCloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).MdcContainerAgentlessDiscoveryK8SCloudRoleArn = (string) content.GetValueForProperty("MdcContainerAgentlessDiscoveryK8SCloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).MdcContainerAgentlessDiscoveryK8SCloudRoleArn, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DefenderForContainersAwsOffering(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("KubernetesService")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).KubernetesService = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingKubernetesService) content.GetValueForProperty("KubernetesService",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).KubernetesService, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersAwsOfferingKubernetesServiceTypeConverter.ConvertFrom); + } + if (content.Contains("KubernetesScubaReader")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).KubernetesScubaReader = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingKubernetesScubaReader) content.GetValueForProperty("KubernetesScubaReader",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).KubernetesScubaReader, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersAwsOfferingKubernetesScubaReaderTypeConverter.ConvertFrom); + } + if (content.Contains("CloudWatchToKinesi")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).CloudWatchToKinesi = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingCloudWatchToKinesis) content.GetValueForProperty("CloudWatchToKinesi",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).CloudWatchToKinesi, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersAwsOfferingCloudWatchToKinesisTypeConverter.ConvertFrom); + } + if (content.Contains("KinesisToS3")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).KinesisToS3 = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingKinesisToS3) content.GetValueForProperty("KinesisToS3",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).KinesisToS3, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersAwsOfferingKinesisToS3TypeConverter.ConvertFrom); + } + if (content.Contains("ContainerVulnerabilityAssessment")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).ContainerVulnerabilityAssessment = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingContainerVulnerabilityAssessment) content.GetValueForProperty("ContainerVulnerabilityAssessment",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).ContainerVulnerabilityAssessment, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTypeConverter.ConvertFrom); + } + if (content.Contains("ContainerVulnerabilityAssessmentTask")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).ContainerVulnerabilityAssessmentTask = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTask) content.GetValueForProperty("ContainerVulnerabilityAssessmentTask",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).ContainerVulnerabilityAssessmentTask, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTaskTypeConverter.ConvertFrom); + } + if (content.Contains("MdcContainersImageAssessment")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).MdcContainersImageAssessment = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingMdcContainersImageAssessment) content.GetValueForProperty("MdcContainersImageAssessment",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).MdcContainersImageAssessment, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersAwsOfferingMdcContainersImageAssessmentTypeConverter.ConvertFrom); + } + if (content.Contains("MdcContainersAgentlessDiscoveryK8S")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).MdcContainersAgentlessDiscoveryK8S = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S) content.GetValueForProperty("MdcContainersAgentlessDiscoveryK8S",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).MdcContainersAgentlessDiscoveryK8S, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8STypeConverter.ConvertFrom); + } + if (content.Contains("EnableContainerVulnerabilityAssessment")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).EnableContainerVulnerabilityAssessment = (bool?) content.GetValueForProperty("EnableContainerVulnerabilityAssessment",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).EnableContainerVulnerabilityAssessment, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("AutoProvisioning")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).AutoProvisioning = (bool?) content.GetValueForProperty("AutoProvisioning",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).AutoProvisioning, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("KubeAuditRetentionTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).KubeAuditRetentionTime = (long?) content.GetValueForProperty("KubeAuditRetentionTime",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).KubeAuditRetentionTime, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ScubaExternalId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).ScubaExternalId = (string) content.GetValueForProperty("ScubaExternalId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).ScubaExternalId, global::System.Convert.ToString); + } + if (content.Contains("OfferingType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType = (string) content.GetValueForProperty("OfferingType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType, global::System.Convert.ToString); + } + if (content.Contains("Description")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description, global::System.Convert.ToString); + } + if (content.Contains("KuberneteServiceCloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).KuberneteServiceCloudRoleArn = (string) content.GetValueForProperty("KuberneteServiceCloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).KuberneteServiceCloudRoleArn, global::System.Convert.ToString); + } + if (content.Contains("KuberneteScubaReaderCloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).KuberneteScubaReaderCloudRoleArn = (string) content.GetValueForProperty("KuberneteScubaReaderCloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).KuberneteScubaReaderCloudRoleArn, global::System.Convert.ToString); + } + if (content.Contains("CloudWatchToKinesiCloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).CloudWatchToKinesiCloudRoleArn = (string) content.GetValueForProperty("CloudWatchToKinesiCloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).CloudWatchToKinesiCloudRoleArn, global::System.Convert.ToString); + } + if (content.Contains("KinesiToS3CloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).KinesiToS3CloudRoleArn = (string) content.GetValueForProperty("KinesiToS3CloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).KinesiToS3CloudRoleArn, global::System.Convert.ToString); + } + if (content.Contains("ContainerVulnerabilityAssessmentCloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).ContainerVulnerabilityAssessmentCloudRoleArn = (string) content.GetValueForProperty("ContainerVulnerabilityAssessmentCloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).ContainerVulnerabilityAssessmentCloudRoleArn, global::System.Convert.ToString); + } + if (content.Contains("ContainerVulnerabilityAssessmentTaskCloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).ContainerVulnerabilityAssessmentTaskCloudRoleArn = (string) content.GetValueForProperty("ContainerVulnerabilityAssessmentTaskCloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).ContainerVulnerabilityAssessmentTaskCloudRoleArn, global::System.Convert.ToString); + } + if (content.Contains("MdcContainerImageAssessmentEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).MdcContainerImageAssessmentEnabled = (bool?) content.GetValueForProperty("MdcContainerImageAssessmentEnabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).MdcContainerImageAssessmentEnabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("MdcContainerImageAssessmentCloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).MdcContainerImageAssessmentCloudRoleArn = (string) content.GetValueForProperty("MdcContainerImageAssessmentCloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).MdcContainerImageAssessmentCloudRoleArn, global::System.Convert.ToString); + } + if (content.Contains("MdcContainerAgentlessDiscoveryK8SEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).MdcContainerAgentlessDiscoveryK8SEnabled = (bool?) content.GetValueForProperty("MdcContainerAgentlessDiscoveryK8SEnabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).MdcContainerAgentlessDiscoveryK8SEnabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("MdcContainerAgentlessDiscoveryK8SCloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).MdcContainerAgentlessDiscoveryK8SCloudRoleArn = (string) content.GetValueForProperty("MdcContainerAgentlessDiscoveryK8SCloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal)this).MdcContainerAgentlessDiscoveryK8SCloudRoleArn, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOffering DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DefenderForContainersAwsOffering(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOffering DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DefenderForContainersAwsOffering(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOffering FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The Defender for Containers AWS offering + [System.ComponentModel.TypeConverter(typeof(DefenderForContainersAwsOfferingTypeConverter))] + public partial interface IDefenderForContainersAwsOffering + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOffering.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOffering.TypeConverter.cs new file mode 100644 index 000000000000..d5ef3a2234b4 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOffering.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DefenderForContainersAwsOfferingTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOffering ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOffering).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DefenderForContainersAwsOffering.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DefenderForContainersAwsOffering.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DefenderForContainersAwsOffering.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOffering.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOffering.cs new file mode 100644 index 000000000000..204b9b643306 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOffering.cs @@ -0,0 +1,412 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The Defender for Containers AWS offering + public partial class DefenderForContainersAwsOffering : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOffering, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOffering __cloudOffering = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CloudOffering(); + + /// Backing field for property. + private bool? _autoProvisioning; + + /// Is audit logs pipeline auto provisioning enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public bool? AutoProvisioning { get => this._autoProvisioning; set => this._autoProvisioning = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingCloudWatchToKinesis _cloudWatchToKinesi; + + /// The cloudwatch to kinesis connection configuration + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingCloudWatchToKinesis CloudWatchToKinesi { get => (this._cloudWatchToKinesi = this._cloudWatchToKinesi ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersAwsOfferingCloudWatchToKinesis()); set => this._cloudWatchToKinesi = value; } + + /// The cloud role ARN in AWS used by CloudWatch to transfer data into Kinesis + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string CloudWatchToKinesiCloudRoleArn { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingCloudWatchToKinesisInternal)CloudWatchToKinesi).CloudRoleArn; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingCloudWatchToKinesisInternal)CloudWatchToKinesi).CloudRoleArn = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingContainerVulnerabilityAssessment _containerVulnerabilityAssessment; + + /// The container vulnerability assessment configuration + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingContainerVulnerabilityAssessment ContainerVulnerabilityAssessment { get => (this._containerVulnerabilityAssessment = this._containerVulnerabilityAssessment ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersAwsOfferingContainerVulnerabilityAssessment()); set => this._containerVulnerabilityAssessment = value; } + + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string ContainerVulnerabilityAssessmentCloudRoleArn { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingContainerVulnerabilityAssessmentInternal)ContainerVulnerabilityAssessment).CloudRoleArn; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingContainerVulnerabilityAssessmentInternal)ContainerVulnerabilityAssessment).CloudRoleArn = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTask _containerVulnerabilityAssessmentTask; + + /// The container vulnerability assessment task configuration + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTask ContainerVulnerabilityAssessmentTask { get => (this._containerVulnerabilityAssessmentTask = this._containerVulnerabilityAssessmentTask ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTask()); set => this._containerVulnerabilityAssessmentTask = value; } + + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string ContainerVulnerabilityAssessmentTaskCloudRoleArn { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTaskInternal)ContainerVulnerabilityAssessmentTask).CloudRoleArn; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTaskInternal)ContainerVulnerabilityAssessmentTask).CloudRoleArn = value ?? null; } + + /// The offering description. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string Description { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)__cloudOffering).Description; } + + /// + /// Backing field for property. + /// + private bool? _enableContainerVulnerabilityAssessment; + + /// Enable container vulnerability assessment feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public bool? EnableContainerVulnerabilityAssessment { get => this._enableContainerVulnerabilityAssessment; set => this._enableContainerVulnerabilityAssessment = value; } + + /// The cloud role ARN in AWS used by Kinesis to transfer data into S3 + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string KinesiToS3CloudRoleArn { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingKinesisToS3Internal)KinesisToS3).CloudRoleArn; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingKinesisToS3Internal)KinesisToS3).CloudRoleArn = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingKinesisToS3 _kinesisToS3; + + /// The kinesis to s3 connection configuration + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingKinesisToS3 KinesisToS3 { get => (this._kinesisToS3 = this._kinesisToS3 ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersAwsOfferingKinesisToS3()); set => this._kinesisToS3 = value; } + + /// Backing field for property. + private long? _kubeAuditRetentionTime; + + /// The retention time in days of kube audit logs set on the CloudWatch log group + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public long? KubeAuditRetentionTime { get => this._kubeAuditRetentionTime; set => this._kubeAuditRetentionTime = value; } + + /// The cloud role ARN in AWS for this feature used for reading data + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string KuberneteScubaReaderCloudRoleArn { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingKubernetesScubaReaderInternal)KubernetesScubaReader).CloudRoleArn; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingKubernetesScubaReaderInternal)KubernetesScubaReader).CloudRoleArn = value ?? null; } + + /// The cloud role ARN in AWS for this feature used for provisioning resources + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string KuberneteServiceCloudRoleArn { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingKubernetesServiceInternal)KubernetesService).CloudRoleArn; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingKubernetesServiceInternal)KubernetesService).CloudRoleArn = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingKubernetesScubaReader _kubernetesScubaReader; + + /// The kubernetes to scuba connection configuration + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingKubernetesScubaReader KubernetesScubaReader { get => (this._kubernetesScubaReader = this._kubernetesScubaReader ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersAwsOfferingKubernetesScubaReader()); set => this._kubernetesScubaReader = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingKubernetesService _kubernetesService; + + /// The kubernetes service connection configuration + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingKubernetesService KubernetesService { get => (this._kubernetesService = this._kubernetesService ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersAwsOfferingKubernetesService()); set => this._kubernetesService = value; } + + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string MdcContainerAgentlessDiscoveryK8SCloudRoleArn { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8SInternal)MdcContainersAgentlessDiscoveryK8S).CloudRoleArn; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8SInternal)MdcContainersAgentlessDiscoveryK8S).CloudRoleArn = value ?? null; } + + /// Is Microsoft Defender container agentless discovery K8s enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public bool? MdcContainerAgentlessDiscoveryK8SEnabled { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8SInternal)MdcContainersAgentlessDiscoveryK8S).Enabled; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8SInternal)MdcContainersAgentlessDiscoveryK8S).Enabled = value ?? default(bool); } + + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string MdcContainerImageAssessmentCloudRoleArn { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingMdcContainersImageAssessmentInternal)MdcContainersImageAssessment).CloudRoleArn; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingMdcContainersImageAssessmentInternal)MdcContainersImageAssessment).CloudRoleArn = value ?? null; } + + /// Is Microsoft Defender container image assessment enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public bool? MdcContainerImageAssessmentEnabled { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingMdcContainersImageAssessmentInternal)MdcContainersImageAssessment).Enabled; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingMdcContainersImageAssessmentInternal)MdcContainersImageAssessment).Enabled = value ?? default(bool); } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S _mdcContainersAgentlessDiscoveryK8S; + + /// The Microsoft Defender container agentless discovery K8s configuration + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S MdcContainersAgentlessDiscoveryK8S { get => (this._mdcContainersAgentlessDiscoveryK8S = this._mdcContainersAgentlessDiscoveryK8S ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S()); set => this._mdcContainersAgentlessDiscoveryK8S = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingMdcContainersImageAssessment _mdcContainersImageAssessment; + + /// The Microsoft Defender container image assessment configuration + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingMdcContainersImageAssessment MdcContainersImageAssessment { get => (this._mdcContainersImageAssessment = this._mdcContainersImageAssessment ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersAwsOfferingMdcContainersImageAssessment()); set => this._mdcContainersImageAssessment = value; } + + /// Internal Acessors for Description + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal.Description { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)__cloudOffering).Description; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)__cloudOffering).Description = value; } + + /// Internal Acessors for CloudWatchToKinesi + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingCloudWatchToKinesis Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal.CloudWatchToKinesi { get => (this._cloudWatchToKinesi = this._cloudWatchToKinesi ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersAwsOfferingCloudWatchToKinesis()); set { {_cloudWatchToKinesi = value;} } } + + /// Internal Acessors for ContainerVulnerabilityAssessment + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingContainerVulnerabilityAssessment Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal.ContainerVulnerabilityAssessment { get => (this._containerVulnerabilityAssessment = this._containerVulnerabilityAssessment ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersAwsOfferingContainerVulnerabilityAssessment()); set { {_containerVulnerabilityAssessment = value;} } } + + /// Internal Acessors for ContainerVulnerabilityAssessmentTask + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTask Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal.ContainerVulnerabilityAssessmentTask { get => (this._containerVulnerabilityAssessmentTask = this._containerVulnerabilityAssessmentTask ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTask()); set { {_containerVulnerabilityAssessmentTask = value;} } } + + /// Internal Acessors for KinesisToS3 + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingKinesisToS3 Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal.KinesisToS3 { get => (this._kinesisToS3 = this._kinesisToS3 ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersAwsOfferingKinesisToS3()); set { {_kinesisToS3 = value;} } } + + /// Internal Acessors for KubernetesScubaReader + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingKubernetesScubaReader Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal.KubernetesScubaReader { get => (this._kubernetesScubaReader = this._kubernetesScubaReader ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersAwsOfferingKubernetesScubaReader()); set { {_kubernetesScubaReader = value;} } } + + /// Internal Acessors for KubernetesService + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingKubernetesService Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal.KubernetesService { get => (this._kubernetesService = this._kubernetesService ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersAwsOfferingKubernetesService()); set { {_kubernetesService = value;} } } + + /// Internal Acessors for MdcContainersAgentlessDiscoveryK8S + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal.MdcContainersAgentlessDiscoveryK8S { get => (this._mdcContainersAgentlessDiscoveryK8S = this._mdcContainersAgentlessDiscoveryK8S ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S()); set { {_mdcContainersAgentlessDiscoveryK8S = value;} } } + + /// Internal Acessors for MdcContainersImageAssessment + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingMdcContainersImageAssessment Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingInternal.MdcContainersImageAssessment { get => (this._mdcContainersImageAssessment = this._mdcContainersImageAssessment ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersAwsOfferingMdcContainersImageAssessment()); set { {_mdcContainersImageAssessment = value;} } } + + /// The type of the security offering. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Constant] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string OfferingType { get => "DefenderForContainersAws"; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)__cloudOffering).OfferingType = "DefenderForContainersAws"; } + + /// Backing field for property. + private string _scubaExternalId; + + /// The externalId used by the data reader to prevent the confused deputy attack + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string ScubaExternalId { get => this._scubaExternalId; set => this._scubaExternalId = value; } + + /// Creates an new instance. + public DefenderForContainersAwsOffering() + { + this.__cloudOffering.OfferingType = "DefenderForContainersAws"; + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__cloudOffering), __cloudOffering); + await eventListener.AssertObjectIsValid(nameof(__cloudOffering), __cloudOffering); + } + } + /// The Defender for Containers AWS offering + public partial interface IDefenderForContainersAwsOffering : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOffering + { + /// Is audit logs pipeline auto provisioning enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Is audit logs pipeline auto provisioning enabled", + SerializedName = @"autoProvisioning", + PossibleTypes = new [] { typeof(bool) })] + bool? AutoProvisioning { get; set; } + /// The cloud role ARN in AWS used by CloudWatch to transfer data into Kinesis + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The cloud role ARN in AWS used by CloudWatch to transfer data into Kinesis", + SerializedName = @"cloudRoleArn", + PossibleTypes = new [] { typeof(string) })] + string CloudWatchToKinesiCloudRoleArn { get; set; } + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The cloud role ARN in AWS for this feature", + SerializedName = @"cloudRoleArn", + PossibleTypes = new [] { typeof(string) })] + string ContainerVulnerabilityAssessmentCloudRoleArn { get; set; } + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The cloud role ARN in AWS for this feature", + SerializedName = @"cloudRoleArn", + PossibleTypes = new [] { typeof(string) })] + string ContainerVulnerabilityAssessmentTaskCloudRoleArn { get; set; } + /// Enable container vulnerability assessment feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Enable container vulnerability assessment feature", + SerializedName = @"enableContainerVulnerabilityAssessment", + PossibleTypes = new [] { typeof(bool) })] + bool? EnableContainerVulnerabilityAssessment { get; set; } + /// The cloud role ARN in AWS used by Kinesis to transfer data into S3 + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The cloud role ARN in AWS used by Kinesis to transfer data into S3", + SerializedName = @"cloudRoleArn", + PossibleTypes = new [] { typeof(string) })] + string KinesiToS3CloudRoleArn { get; set; } + /// The retention time in days of kube audit logs set on the CloudWatch log group + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The retention time in days of kube audit logs set on the CloudWatch log group", + SerializedName = @"kubeAuditRetentionTime", + PossibleTypes = new [] { typeof(long) })] + long? KubeAuditRetentionTime { get; set; } + /// The cloud role ARN in AWS for this feature used for reading data + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The cloud role ARN in AWS for this feature used for reading data", + SerializedName = @"cloudRoleArn", + PossibleTypes = new [] { typeof(string) })] + string KuberneteScubaReaderCloudRoleArn { get; set; } + /// The cloud role ARN in AWS for this feature used for provisioning resources + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The cloud role ARN in AWS for this feature used for provisioning resources", + SerializedName = @"cloudRoleArn", + PossibleTypes = new [] { typeof(string) })] + string KuberneteServiceCloudRoleArn { get; set; } + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The cloud role ARN in AWS for this feature", + SerializedName = @"cloudRoleArn", + PossibleTypes = new [] { typeof(string) })] + string MdcContainerAgentlessDiscoveryK8SCloudRoleArn { get; set; } + /// Is Microsoft Defender container agentless discovery K8s enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Is Microsoft Defender container agentless discovery K8s enabled", + SerializedName = @"enabled", + PossibleTypes = new [] { typeof(bool) })] + bool? MdcContainerAgentlessDiscoveryK8SEnabled { get; set; } + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The cloud role ARN in AWS for this feature", + SerializedName = @"cloudRoleArn", + PossibleTypes = new [] { typeof(string) })] + string MdcContainerImageAssessmentCloudRoleArn { get; set; } + /// Is Microsoft Defender container image assessment enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Is Microsoft Defender container image assessment enabled", + SerializedName = @"enabled", + PossibleTypes = new [] { typeof(bool) })] + bool? MdcContainerImageAssessmentEnabled { get; set; } + /// The externalId used by the data reader to prevent the confused deputy attack + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The externalId used by the data reader to prevent the confused deputy attack", + SerializedName = @"scubaExternalId", + PossibleTypes = new [] { typeof(string) })] + string ScubaExternalId { get; set; } + + } + /// The Defender for Containers AWS offering + internal partial interface IDefenderForContainersAwsOfferingInternal : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal + { + /// Is audit logs pipeline auto provisioning enabled + bool? AutoProvisioning { get; set; } + /// The cloudwatch to kinesis connection configuration + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingCloudWatchToKinesis CloudWatchToKinesi { get; set; } + /// The cloud role ARN in AWS used by CloudWatch to transfer data into Kinesis + string CloudWatchToKinesiCloudRoleArn { get; set; } + /// The container vulnerability assessment configuration + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingContainerVulnerabilityAssessment ContainerVulnerabilityAssessment { get; set; } + /// The cloud role ARN in AWS for this feature + string ContainerVulnerabilityAssessmentCloudRoleArn { get; set; } + /// The container vulnerability assessment task configuration + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTask ContainerVulnerabilityAssessmentTask { get; set; } + /// The cloud role ARN in AWS for this feature + string ContainerVulnerabilityAssessmentTaskCloudRoleArn { get; set; } + /// Enable container vulnerability assessment feature + bool? EnableContainerVulnerabilityAssessment { get; set; } + /// The cloud role ARN in AWS used by Kinesis to transfer data into S3 + string KinesiToS3CloudRoleArn { get; set; } + /// The kinesis to s3 connection configuration + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingKinesisToS3 KinesisToS3 { get; set; } + /// The retention time in days of kube audit logs set on the CloudWatch log group + long? KubeAuditRetentionTime { get; set; } + /// The cloud role ARN in AWS for this feature used for reading data + string KuberneteScubaReaderCloudRoleArn { get; set; } + /// The cloud role ARN in AWS for this feature used for provisioning resources + string KuberneteServiceCloudRoleArn { get; set; } + /// The kubernetes to scuba connection configuration + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingKubernetesScubaReader KubernetesScubaReader { get; set; } + /// The kubernetes service connection configuration + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingKubernetesService KubernetesService { get; set; } + /// The cloud role ARN in AWS for this feature + string MdcContainerAgentlessDiscoveryK8SCloudRoleArn { get; set; } + /// Is Microsoft Defender container agentless discovery K8s enabled + bool? MdcContainerAgentlessDiscoveryK8SEnabled { get; set; } + /// The cloud role ARN in AWS for this feature + string MdcContainerImageAssessmentCloudRoleArn { get; set; } + /// Is Microsoft Defender container image assessment enabled + bool? MdcContainerImageAssessmentEnabled { get; set; } + /// The Microsoft Defender container agentless discovery K8s configuration + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S MdcContainersAgentlessDiscoveryK8S { get; set; } + /// The Microsoft Defender container image assessment configuration + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingMdcContainersImageAssessment MdcContainersImageAssessment { get; set; } + /// The externalId used by the data reader to prevent the confused deputy attack + string ScubaExternalId { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOffering.json.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOffering.json.cs new file mode 100644 index 000000000000..5b629d12003c --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOffering.json.cs @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The Defender for Containers AWS offering + public partial class DefenderForContainersAwsOffering + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal DefenderForContainersAwsOffering(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __cloudOffering = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CloudOffering(json); + {_kubernetesService = If( json?.PropertyT("kubernetesService"), out var __jsonKubernetesService) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersAwsOfferingKubernetesService.FromJson(__jsonKubernetesService) : _kubernetesService;} + {_kubernetesScubaReader = If( json?.PropertyT("kubernetesScubaReader"), out var __jsonKubernetesScubaReader) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersAwsOfferingKubernetesScubaReader.FromJson(__jsonKubernetesScubaReader) : _kubernetesScubaReader;} + {_cloudWatchToKinesi = If( json?.PropertyT("cloudWatchToKinesis"), out var __jsonCloudWatchToKinesis) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersAwsOfferingCloudWatchToKinesis.FromJson(__jsonCloudWatchToKinesis) : _cloudWatchToKinesi;} + {_kinesisToS3 = If( json?.PropertyT("kinesisToS3"), out var __jsonKinesisToS3) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersAwsOfferingKinesisToS3.FromJson(__jsonKinesisToS3) : _kinesisToS3;} + {_containerVulnerabilityAssessment = If( json?.PropertyT("containerVulnerabilityAssessment"), out var __jsonContainerVulnerabilityAssessment) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersAwsOfferingContainerVulnerabilityAssessment.FromJson(__jsonContainerVulnerabilityAssessment) : _containerVulnerabilityAssessment;} + {_containerVulnerabilityAssessmentTask = If( json?.PropertyT("containerVulnerabilityAssessmentTask"), out var __jsonContainerVulnerabilityAssessmentTask) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTask.FromJson(__jsonContainerVulnerabilityAssessmentTask) : _containerVulnerabilityAssessmentTask;} + {_mdcContainersImageAssessment = If( json?.PropertyT("mdcContainersImageAssessment"), out var __jsonMdcContainersImageAssessment) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersAwsOfferingMdcContainersImageAssessment.FromJson(__jsonMdcContainersImageAssessment) : _mdcContainersImageAssessment;} + {_mdcContainersAgentlessDiscoveryK8S = If( json?.PropertyT("mdcContainersAgentlessDiscoveryK8s"), out var __jsonMdcContainersAgentlessDiscoveryK8S) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S.FromJson(__jsonMdcContainersAgentlessDiscoveryK8S) : _mdcContainersAgentlessDiscoveryK8S;} + {_enableContainerVulnerabilityAssessment = If( json?.PropertyT("enableContainerVulnerabilityAssessment"), out var __jsonEnableContainerVulnerabilityAssessment) ? (bool?)__jsonEnableContainerVulnerabilityAssessment : _enableContainerVulnerabilityAssessment;} + {_autoProvisioning = If( json?.PropertyT("autoProvisioning"), out var __jsonAutoProvisioning) ? (bool?)__jsonAutoProvisioning : _autoProvisioning;} + {_kubeAuditRetentionTime = If( json?.PropertyT("kubeAuditRetentionTime"), out var __jsonKubeAuditRetentionTime) ? (long?)__jsonKubeAuditRetentionTime : _kubeAuditRetentionTime;} + {_scubaExternalId = If( json?.PropertyT("scubaExternalId"), out var __jsonScubaExternalId) ? (string)__jsonScubaExternalId : (string)_scubaExternalId;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOffering. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOffering. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOffering FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DefenderForContainersAwsOffering(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __cloudOffering?.ToJson(container, serializationMode); + AddIf( null != this._kubernetesService ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._kubernetesService.ToJson(null,serializationMode) : null, "kubernetesService" ,container.Add ); + AddIf( null != this._kubernetesScubaReader ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._kubernetesScubaReader.ToJson(null,serializationMode) : null, "kubernetesScubaReader" ,container.Add ); + AddIf( null != this._cloudWatchToKinesi ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._cloudWatchToKinesi.ToJson(null,serializationMode) : null, "cloudWatchToKinesis" ,container.Add ); + AddIf( null != this._kinesisToS3 ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._kinesisToS3.ToJson(null,serializationMode) : null, "kinesisToS3" ,container.Add ); + AddIf( null != this._containerVulnerabilityAssessment ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._containerVulnerabilityAssessment.ToJson(null,serializationMode) : null, "containerVulnerabilityAssessment" ,container.Add ); + AddIf( null != this._containerVulnerabilityAssessmentTask ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._containerVulnerabilityAssessmentTask.ToJson(null,serializationMode) : null, "containerVulnerabilityAssessmentTask" ,container.Add ); + AddIf( null != this._mdcContainersImageAssessment ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._mdcContainersImageAssessment.ToJson(null,serializationMode) : null, "mdcContainersImageAssessment" ,container.Add ); + AddIf( null != this._mdcContainersAgentlessDiscoveryK8S ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._mdcContainersAgentlessDiscoveryK8S.ToJson(null,serializationMode) : null, "mdcContainersAgentlessDiscoveryK8s" ,container.Add ); + AddIf( null != this._enableContainerVulnerabilityAssessment ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonBoolean((bool)this._enableContainerVulnerabilityAssessment) : null, "enableContainerVulnerabilityAssessment" ,container.Add ); + AddIf( null != this._autoProvisioning ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonBoolean((bool)this._autoProvisioning) : null, "autoProvisioning" ,container.Add ); + AddIf( null != this._kubeAuditRetentionTime ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNumber((long)this._kubeAuditRetentionTime) : null, "kubeAuditRetentionTime" ,container.Add ); + AddIf( null != (((object)this._scubaExternalId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._scubaExternalId.ToString()) : null, "scubaExternalId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingCloudWatchToKinesis.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingCloudWatchToKinesis.PowerShell.cs new file mode 100644 index 000000000000..d041b8866441 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingCloudWatchToKinesis.PowerShell.cs @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The cloudwatch to kinesis connection configuration + [System.ComponentModel.TypeConverter(typeof(DefenderForContainersAwsOfferingCloudWatchToKinesisTypeConverter))] + public partial class DefenderForContainersAwsOfferingCloudWatchToKinesis + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DefenderForContainersAwsOfferingCloudWatchToKinesis(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingCloudWatchToKinesisInternal)this).CloudRoleArn = (string) content.GetValueForProperty("CloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingCloudWatchToKinesisInternal)this).CloudRoleArn, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DefenderForContainersAwsOfferingCloudWatchToKinesis(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingCloudWatchToKinesisInternal)this).CloudRoleArn = (string) content.GetValueForProperty("CloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingCloudWatchToKinesisInternal)this).CloudRoleArn, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingCloudWatchToKinesis DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DefenderForContainersAwsOfferingCloudWatchToKinesis(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingCloudWatchToKinesis DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DefenderForContainersAwsOfferingCloudWatchToKinesis(content); + } + + /// + /// Creates a new instance of , deserializing the content + /// from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingCloudWatchToKinesis FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The cloudwatch to kinesis connection configuration + [System.ComponentModel.TypeConverter(typeof(DefenderForContainersAwsOfferingCloudWatchToKinesisTypeConverter))] + public partial interface IDefenderForContainersAwsOfferingCloudWatchToKinesis + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingCloudWatchToKinesis.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingCloudWatchToKinesis.TypeConverter.cs new file mode 100644 index 000000000000..183292b0fe2a --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingCloudWatchToKinesis.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DefenderForContainersAwsOfferingCloudWatchToKinesisTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a + /// type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingCloudWatchToKinesis ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingCloudWatchToKinesis).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DefenderForContainersAwsOfferingCloudWatchToKinesis.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DefenderForContainersAwsOfferingCloudWatchToKinesis.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DefenderForContainersAwsOfferingCloudWatchToKinesis.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingCloudWatchToKinesis.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingCloudWatchToKinesis.cs new file mode 100644 index 000000000000..46cb353bbfed --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingCloudWatchToKinesis.cs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The cloudwatch to kinesis connection configuration + public partial class DefenderForContainersAwsOfferingCloudWatchToKinesis : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingCloudWatchToKinesis, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingCloudWatchToKinesisInternal + { + + /// Backing field for property. + private string _cloudRoleArn; + + /// The cloud role ARN in AWS used by CloudWatch to transfer data into Kinesis + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string CloudRoleArn { get => this._cloudRoleArn; set => this._cloudRoleArn = value; } + + /// + /// Creates an new instance. + /// + public DefenderForContainersAwsOfferingCloudWatchToKinesis() + { + + } + } + /// The cloudwatch to kinesis connection configuration + public partial interface IDefenderForContainersAwsOfferingCloudWatchToKinesis : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// The cloud role ARN in AWS used by CloudWatch to transfer data into Kinesis + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The cloud role ARN in AWS used by CloudWatch to transfer data into Kinesis", + SerializedName = @"cloudRoleArn", + PossibleTypes = new [] { typeof(string) })] + string CloudRoleArn { get; set; } + + } + /// The cloudwatch to kinesis connection configuration + internal partial interface IDefenderForContainersAwsOfferingCloudWatchToKinesisInternal + + { + /// The cloud role ARN in AWS used by CloudWatch to transfer data into Kinesis + string CloudRoleArn { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingCloudWatchToKinesis.json.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingCloudWatchToKinesis.json.cs new file mode 100644 index 000000000000..5039d72d799d --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingCloudWatchToKinesis.json.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The cloudwatch to kinesis connection configuration + public partial class DefenderForContainersAwsOfferingCloudWatchToKinesis + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal DefenderForContainersAwsOfferingCloudWatchToKinesis(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_cloudRoleArn = If( json?.PropertyT("cloudRoleArn"), out var __jsonCloudRoleArn) ? (string)__jsonCloudRoleArn : (string)_cloudRoleArn;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingCloudWatchToKinesis. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingCloudWatchToKinesis. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingCloudWatchToKinesis FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DefenderForContainersAwsOfferingCloudWatchToKinesis(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._cloudRoleArn)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._cloudRoleArn.ToString()) : null, "cloudRoleArn" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingContainerVulnerabilityAssessment.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingContainerVulnerabilityAssessment.PowerShell.cs new file mode 100644 index 000000000000..6d0821d8985c --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingContainerVulnerabilityAssessment.PowerShell.cs @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The container vulnerability assessment configuration + [System.ComponentModel.TypeConverter(typeof(DefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTypeConverter))] + public partial class DefenderForContainersAwsOfferingContainerVulnerabilityAssessment + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DefenderForContainersAwsOfferingContainerVulnerabilityAssessment(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingContainerVulnerabilityAssessmentInternal)this).CloudRoleArn = (string) content.GetValueForProperty("CloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingContainerVulnerabilityAssessmentInternal)this).CloudRoleArn, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DefenderForContainersAwsOfferingContainerVulnerabilityAssessment(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingContainerVulnerabilityAssessmentInternal)this).CloudRoleArn = (string) content.GetValueForProperty("CloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingContainerVulnerabilityAssessmentInternal)this).CloudRoleArn, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingContainerVulnerabilityAssessment DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DefenderForContainersAwsOfferingContainerVulnerabilityAssessment(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingContainerVulnerabilityAssessment DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DefenderForContainersAwsOfferingContainerVulnerabilityAssessment(content); + } + + /// + /// Creates a new instance of , deserializing + /// the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingContainerVulnerabilityAssessment FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The container vulnerability assessment configuration + [System.ComponentModel.TypeConverter(typeof(DefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTypeConverter))] + public partial interface IDefenderForContainersAwsOfferingContainerVulnerabilityAssessment + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingContainerVulnerabilityAssessment.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingContainerVulnerabilityAssessment.TypeConverter.cs new file mode 100644 index 000000000000..8db7e4b48a5c --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingContainerVulnerabilityAssessment.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there + /// is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there + /// is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingContainerVulnerabilityAssessment ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingContainerVulnerabilityAssessment).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DefenderForContainersAwsOfferingContainerVulnerabilityAssessment.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DefenderForContainersAwsOfferingContainerVulnerabilityAssessment.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DefenderForContainersAwsOfferingContainerVulnerabilityAssessment.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingContainerVulnerabilityAssessment.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingContainerVulnerabilityAssessment.cs new file mode 100644 index 000000000000..b39604c0db75 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingContainerVulnerabilityAssessment.cs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The container vulnerability assessment configuration + public partial class DefenderForContainersAwsOfferingContainerVulnerabilityAssessment : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingContainerVulnerabilityAssessment, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingContainerVulnerabilityAssessmentInternal + { + + /// Backing field for property. + private string _cloudRoleArn; + + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string CloudRoleArn { get => this._cloudRoleArn; set => this._cloudRoleArn = value; } + + /// + /// Creates an new instance. + /// + public DefenderForContainersAwsOfferingContainerVulnerabilityAssessment() + { + + } + } + /// The container vulnerability assessment configuration + public partial interface IDefenderForContainersAwsOfferingContainerVulnerabilityAssessment : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The cloud role ARN in AWS for this feature", + SerializedName = @"cloudRoleArn", + PossibleTypes = new [] { typeof(string) })] + string CloudRoleArn { get; set; } + + } + /// The container vulnerability assessment configuration + internal partial interface IDefenderForContainersAwsOfferingContainerVulnerabilityAssessmentInternal + + { + /// The cloud role ARN in AWS for this feature + string CloudRoleArn { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingContainerVulnerabilityAssessment.json.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingContainerVulnerabilityAssessment.json.cs new file mode 100644 index 000000000000..7a323ada383d --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingContainerVulnerabilityAssessment.json.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The container vulnerability assessment configuration + public partial class DefenderForContainersAwsOfferingContainerVulnerabilityAssessment + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal DefenderForContainersAwsOfferingContainerVulnerabilityAssessment(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_cloudRoleArn = If( json?.PropertyT("cloudRoleArn"), out var __jsonCloudRoleArn) ? (string)__jsonCloudRoleArn : (string)_cloudRoleArn;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingContainerVulnerabilityAssessment. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingContainerVulnerabilityAssessment. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingContainerVulnerabilityAssessment FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DefenderForContainersAwsOfferingContainerVulnerabilityAssessment(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._cloudRoleArn)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._cloudRoleArn.ToString()) : null, "cloudRoleArn" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTask.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTask.PowerShell.cs new file mode 100644 index 000000000000..5799b70ecfd1 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTask.PowerShell.cs @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The container vulnerability assessment task configuration + [System.ComponentModel.TypeConverter(typeof(DefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTaskTypeConverter))] + public partial class DefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTask + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTask(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTaskInternal)this).CloudRoleArn = (string) content.GetValueForProperty("CloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTaskInternal)this).CloudRoleArn, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTask(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTaskInternal)this).CloudRoleArn = (string) content.GetValueForProperty("CloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTaskInternal)this).CloudRoleArn, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTask DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTask(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTask DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTask(content); + } + + /// + /// Creates a new instance of , deserializing + /// the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTask FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The container vulnerability assessment task configuration + [System.ComponentModel.TypeConverter(typeof(DefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTaskTypeConverter))] + public partial interface IDefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTask + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTask.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTask.TypeConverter.cs new file mode 100644 index 000000000000..1f755763f1fc --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTask.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTaskTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if + /// there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if + /// there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTask ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTask).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTask.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTask.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTask.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTask.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTask.cs new file mode 100644 index 000000000000..f72f44f8b1ef --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTask.cs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The container vulnerability assessment task configuration + public partial class DefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTask : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTask, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTaskInternal + { + + /// Backing field for property. + private string _cloudRoleArn; + + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string CloudRoleArn { get => this._cloudRoleArn; set => this._cloudRoleArn = value; } + + /// + /// Creates an new instance. + /// + public DefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTask() + { + + } + } + /// The container vulnerability assessment task configuration + public partial interface IDefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTask : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The cloud role ARN in AWS for this feature", + SerializedName = @"cloudRoleArn", + PossibleTypes = new [] { typeof(string) })] + string CloudRoleArn { get; set; } + + } + /// The container vulnerability assessment task configuration + internal partial interface IDefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTaskInternal + + { + /// The cloud role ARN in AWS for this feature + string CloudRoleArn { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTask.json.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTask.json.cs new file mode 100644 index 000000000000..b8313d0d8c83 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTask.json.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The container vulnerability assessment task configuration + public partial class DefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTask + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal DefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTask(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_cloudRoleArn = If( json?.PropertyT("cloudRoleArn"), out var __jsonCloudRoleArn) ? (string)__jsonCloudRoleArn : (string)_cloudRoleArn;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTask. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTask. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTask FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTask(json) : null; + } + + /// + /// Serializes this instance of into a + /// . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._cloudRoleArn)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._cloudRoleArn.ToString()) : null, "cloudRoleArn" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingKinesisToS3.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingKinesisToS3.PowerShell.cs new file mode 100644 index 000000000000..09ad8972ee83 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingKinesisToS3.PowerShell.cs @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The kinesis to s3 connection configuration + [System.ComponentModel.TypeConverter(typeof(DefenderForContainersAwsOfferingKinesisToS3TypeConverter))] + public partial class DefenderForContainersAwsOfferingKinesisToS3 + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DefenderForContainersAwsOfferingKinesisToS3(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingKinesisToS3Internal)this).CloudRoleArn = (string) content.GetValueForProperty("CloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingKinesisToS3Internal)this).CloudRoleArn, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DefenderForContainersAwsOfferingKinesisToS3(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingKinesisToS3Internal)this).CloudRoleArn = (string) content.GetValueForProperty("CloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingKinesisToS3Internal)this).CloudRoleArn, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingKinesisToS3 DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DefenderForContainersAwsOfferingKinesisToS3(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingKinesisToS3 DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DefenderForContainersAwsOfferingKinesisToS3(content); + } + + /// + /// Creates a new instance of , deserializing the content from a + /// json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingKinesisToS3 FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The kinesis to s3 connection configuration + [System.ComponentModel.TypeConverter(typeof(DefenderForContainersAwsOfferingKinesisToS3TypeConverter))] + public partial interface IDefenderForContainersAwsOfferingKinesisToS3 + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingKinesisToS3.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingKinesisToS3.TypeConverter.cs new file mode 100644 index 000000000000..8b3a205d2b75 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingKinesisToS3.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DefenderForContainersAwsOfferingKinesisToS3TypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingKinesisToS3 ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingKinesisToS3).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DefenderForContainersAwsOfferingKinesisToS3.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DefenderForContainersAwsOfferingKinesisToS3.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DefenderForContainersAwsOfferingKinesisToS3.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingKinesisToS3.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingKinesisToS3.cs new file mode 100644 index 000000000000..0e5ecfa8d846 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingKinesisToS3.cs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The kinesis to s3 connection configuration + public partial class DefenderForContainersAwsOfferingKinesisToS3 : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingKinesisToS3, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingKinesisToS3Internal + { + + /// Backing field for property. + private string _cloudRoleArn; + + /// The cloud role ARN in AWS used by Kinesis to transfer data into S3 + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string CloudRoleArn { get => this._cloudRoleArn; set => this._cloudRoleArn = value; } + + /// + /// Creates an new instance. + /// + public DefenderForContainersAwsOfferingKinesisToS3() + { + + } + } + /// The kinesis to s3 connection configuration + public partial interface IDefenderForContainersAwsOfferingKinesisToS3 : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// The cloud role ARN in AWS used by Kinesis to transfer data into S3 + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The cloud role ARN in AWS used by Kinesis to transfer data into S3", + SerializedName = @"cloudRoleArn", + PossibleTypes = new [] { typeof(string) })] + string CloudRoleArn { get; set; } + + } + /// The kinesis to s3 connection configuration + internal partial interface IDefenderForContainersAwsOfferingKinesisToS3Internal + + { + /// The cloud role ARN in AWS used by Kinesis to transfer data into S3 + string CloudRoleArn { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingKinesisToS3.json.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingKinesisToS3.json.cs new file mode 100644 index 000000000000..82a7cafd5a4b --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingKinesisToS3.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The kinesis to s3 connection configuration + public partial class DefenderForContainersAwsOfferingKinesisToS3 + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal DefenderForContainersAwsOfferingKinesisToS3(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_cloudRoleArn = If( json?.PropertyT("cloudRoleArn"), out var __jsonCloudRoleArn) ? (string)__jsonCloudRoleArn : (string)_cloudRoleArn;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingKinesisToS3. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingKinesisToS3. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingKinesisToS3 FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DefenderForContainersAwsOfferingKinesisToS3(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._cloudRoleArn)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._cloudRoleArn.ToString()) : null, "cloudRoleArn" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingKubernetesScubaReader.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingKubernetesScubaReader.PowerShell.cs new file mode 100644 index 000000000000..ccbe73ce7129 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingKubernetesScubaReader.PowerShell.cs @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The kubernetes to scuba connection configuration + [System.ComponentModel.TypeConverter(typeof(DefenderForContainersAwsOfferingKubernetesScubaReaderTypeConverter))] + public partial class DefenderForContainersAwsOfferingKubernetesScubaReader + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DefenderForContainersAwsOfferingKubernetesScubaReader(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingKubernetesScubaReaderInternal)this).CloudRoleArn = (string) content.GetValueForProperty("CloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingKubernetesScubaReaderInternal)this).CloudRoleArn, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DefenderForContainersAwsOfferingKubernetesScubaReader(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingKubernetesScubaReaderInternal)this).CloudRoleArn = (string) content.GetValueForProperty("CloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingKubernetesScubaReaderInternal)this).CloudRoleArn, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingKubernetesScubaReader DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DefenderForContainersAwsOfferingKubernetesScubaReader(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingKubernetesScubaReader DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DefenderForContainersAwsOfferingKubernetesScubaReader(content); + } + + /// + /// Creates a new instance of , deserializing the content + /// from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingKubernetesScubaReader FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The kubernetes to scuba connection configuration + [System.ComponentModel.TypeConverter(typeof(DefenderForContainersAwsOfferingKubernetesScubaReaderTypeConverter))] + public partial interface IDefenderForContainersAwsOfferingKubernetesScubaReader + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingKubernetesScubaReader.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingKubernetesScubaReader.TypeConverter.cs new file mode 100644 index 000000000000..2eefd9a80bec --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingKubernetesScubaReader.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DefenderForContainersAwsOfferingKubernetesScubaReaderTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingKubernetesScubaReader ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingKubernetesScubaReader).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DefenderForContainersAwsOfferingKubernetesScubaReader.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DefenderForContainersAwsOfferingKubernetesScubaReader.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DefenderForContainersAwsOfferingKubernetesScubaReader.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingKubernetesScubaReader.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingKubernetesScubaReader.cs new file mode 100644 index 000000000000..bd75cdcaaac0 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingKubernetesScubaReader.cs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The kubernetes to scuba connection configuration + public partial class DefenderForContainersAwsOfferingKubernetesScubaReader : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingKubernetesScubaReader, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingKubernetesScubaReaderInternal + { + + /// Backing field for property. + private string _cloudRoleArn; + + /// The cloud role ARN in AWS for this feature used for reading data + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string CloudRoleArn { get => this._cloudRoleArn; set => this._cloudRoleArn = value; } + + /// + /// Creates an new instance. + /// + public DefenderForContainersAwsOfferingKubernetesScubaReader() + { + + } + } + /// The kubernetes to scuba connection configuration + public partial interface IDefenderForContainersAwsOfferingKubernetesScubaReader : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// The cloud role ARN in AWS for this feature used for reading data + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The cloud role ARN in AWS for this feature used for reading data", + SerializedName = @"cloudRoleArn", + PossibleTypes = new [] { typeof(string) })] + string CloudRoleArn { get; set; } + + } + /// The kubernetes to scuba connection configuration + internal partial interface IDefenderForContainersAwsOfferingKubernetesScubaReaderInternal + + { + /// The cloud role ARN in AWS for this feature used for reading data + string CloudRoleArn { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingKubernetesScubaReader.json.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingKubernetesScubaReader.json.cs new file mode 100644 index 000000000000..856c8ec9b028 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingKubernetesScubaReader.json.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The kubernetes to scuba connection configuration + public partial class DefenderForContainersAwsOfferingKubernetesScubaReader + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal DefenderForContainersAwsOfferingKubernetesScubaReader(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_cloudRoleArn = If( json?.PropertyT("cloudRoleArn"), out var __jsonCloudRoleArn) ? (string)__jsonCloudRoleArn : (string)_cloudRoleArn;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingKubernetesScubaReader. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingKubernetesScubaReader. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingKubernetesScubaReader FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DefenderForContainersAwsOfferingKubernetesScubaReader(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._cloudRoleArn)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._cloudRoleArn.ToString()) : null, "cloudRoleArn" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingKubernetesService.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingKubernetesService.PowerShell.cs new file mode 100644 index 000000000000..9f6f4a580262 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingKubernetesService.PowerShell.cs @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The kubernetes service connection configuration + [System.ComponentModel.TypeConverter(typeof(DefenderForContainersAwsOfferingKubernetesServiceTypeConverter))] + public partial class DefenderForContainersAwsOfferingKubernetesService + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DefenderForContainersAwsOfferingKubernetesService(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingKubernetesServiceInternal)this).CloudRoleArn = (string) content.GetValueForProperty("CloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingKubernetesServiceInternal)this).CloudRoleArn, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DefenderForContainersAwsOfferingKubernetesService(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingKubernetesServiceInternal)this).CloudRoleArn = (string) content.GetValueForProperty("CloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingKubernetesServiceInternal)this).CloudRoleArn, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingKubernetesService DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DefenderForContainersAwsOfferingKubernetesService(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingKubernetesService DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DefenderForContainersAwsOfferingKubernetesService(content); + } + + /// + /// Creates a new instance of , deserializing the content + /// from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingKubernetesService FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The kubernetes service connection configuration + [System.ComponentModel.TypeConverter(typeof(DefenderForContainersAwsOfferingKubernetesServiceTypeConverter))] + public partial interface IDefenderForContainersAwsOfferingKubernetesService + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingKubernetesService.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingKubernetesService.TypeConverter.cs new file mode 100644 index 000000000000..61baf3de2304 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingKubernetesService.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DefenderForContainersAwsOfferingKubernetesServiceTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, + /// otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingKubernetesService ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingKubernetesService).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DefenderForContainersAwsOfferingKubernetesService.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DefenderForContainersAwsOfferingKubernetesService.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DefenderForContainersAwsOfferingKubernetesService.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingKubernetesService.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingKubernetesService.cs new file mode 100644 index 000000000000..5e5565675e00 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingKubernetesService.cs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The kubernetes service connection configuration + public partial class DefenderForContainersAwsOfferingKubernetesService : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingKubernetesService, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingKubernetesServiceInternal + { + + /// Backing field for property. + private string _cloudRoleArn; + + /// The cloud role ARN in AWS for this feature used for provisioning resources + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string CloudRoleArn { get => this._cloudRoleArn; set => this._cloudRoleArn = value; } + + /// + /// Creates an new instance. + /// + public DefenderForContainersAwsOfferingKubernetesService() + { + + } + } + /// The kubernetes service connection configuration + public partial interface IDefenderForContainersAwsOfferingKubernetesService : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// The cloud role ARN in AWS for this feature used for provisioning resources + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The cloud role ARN in AWS for this feature used for provisioning resources", + SerializedName = @"cloudRoleArn", + PossibleTypes = new [] { typeof(string) })] + string CloudRoleArn { get; set; } + + } + /// The kubernetes service connection configuration + internal partial interface IDefenderForContainersAwsOfferingKubernetesServiceInternal + + { + /// The cloud role ARN in AWS for this feature used for provisioning resources + string CloudRoleArn { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingKubernetesService.json.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingKubernetesService.json.cs new file mode 100644 index 000000000000..1b2d71ff4ca0 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingKubernetesService.json.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The kubernetes service connection configuration + public partial class DefenderForContainersAwsOfferingKubernetesService + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal DefenderForContainersAwsOfferingKubernetesService(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_cloudRoleArn = If( json?.PropertyT("cloudRoleArn"), out var __jsonCloudRoleArn) ? (string)__jsonCloudRoleArn : (string)_cloudRoleArn;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingKubernetesService. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingKubernetesService. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingKubernetesService FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DefenderForContainersAwsOfferingKubernetesService(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._cloudRoleArn)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._cloudRoleArn.ToString()) : null, "cloudRoleArn" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S.PowerShell.cs new file mode 100644 index 000000000000..053966b4448a --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S.PowerShell.cs @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The Microsoft Defender container agentless discovery K8s configuration + [System.ComponentModel.TypeConverter(typeof(DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8STypeConverter))] + public partial class DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Enabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8SInternal)this).Enabled = (bool?) content.GetValueForProperty("Enabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8SInternal)this).Enabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("CloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8SInternal)this).CloudRoleArn = (string) content.GetValueForProperty("CloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8SInternal)this).CloudRoleArn, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Enabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8SInternal)this).Enabled = (bool?) content.GetValueForProperty("Enabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8SInternal)this).Enabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("CloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8SInternal)this).CloudRoleArn = (string) content.GetValueForProperty("CloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8SInternal)this).CloudRoleArn, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S(content); + } + + /// + /// Creates a new instance of , deserializing + /// the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The Microsoft Defender container agentless discovery K8s configuration + [System.ComponentModel.TypeConverter(typeof(DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8STypeConverter))] + public partial interface IDefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S.TypeConverter.cs new file mode 100644 index 000000000000..8b8a5321d062 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8STypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there + /// is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there + /// is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S.cs new file mode 100644 index 000000000000..619d8a722c46 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The Microsoft Defender container agentless discovery K8s configuration + public partial class DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8SInternal + { + + /// Backing field for property. + private string _cloudRoleArn; + + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string CloudRoleArn { get => this._cloudRoleArn; set => this._cloudRoleArn = value; } + + /// Backing field for property. + private bool? _enabled; + + /// Is Microsoft Defender container agentless discovery K8s enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public bool? Enabled { get => this._enabled; set => this._enabled = value; } + + /// + /// Creates an new instance. + /// + public DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S() + { + + } + } + /// The Microsoft Defender container agentless discovery K8s configuration + public partial interface IDefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The cloud role ARN in AWS for this feature", + SerializedName = @"cloudRoleArn", + PossibleTypes = new [] { typeof(string) })] + string CloudRoleArn { get; set; } + /// Is Microsoft Defender container agentless discovery K8s enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Is Microsoft Defender container agentless discovery K8s enabled", + SerializedName = @"enabled", + PossibleTypes = new [] { typeof(bool) })] + bool? Enabled { get; set; } + + } + /// The Microsoft Defender container agentless discovery K8s configuration + internal partial interface IDefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8SInternal + + { + /// The cloud role ARN in AWS for this feature + string CloudRoleArn { get; set; } + /// Is Microsoft Defender container agentless discovery K8s enabled + bool? Enabled { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S.json.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S.json.cs new file mode 100644 index 000000000000..4dffa85690de --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S.json.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The Microsoft Defender container agentless discovery K8s configuration + public partial class DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_enabled = If( json?.PropertyT("enabled"), out var __jsonEnabled) ? (bool?)__jsonEnabled : _enabled;} + {_cloudRoleArn = If( json?.PropertyT("cloudRoleArn"), out var __jsonCloudRoleArn) ? (string)__jsonCloudRoleArn : (string)_cloudRoleArn;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._enabled ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonBoolean((bool)this._enabled) : null, "enabled" ,container.Add ); + AddIf( null != (((object)this._cloudRoleArn)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._cloudRoleArn.ToString()) : null, "cloudRoleArn" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingMdcContainersImageAssessment.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingMdcContainersImageAssessment.PowerShell.cs new file mode 100644 index 000000000000..914b120a4ebb --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingMdcContainersImageAssessment.PowerShell.cs @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The Microsoft Defender container image assessment configuration + [System.ComponentModel.TypeConverter(typeof(DefenderForContainersAwsOfferingMdcContainersImageAssessmentTypeConverter))] + public partial class DefenderForContainersAwsOfferingMdcContainersImageAssessment + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DefenderForContainersAwsOfferingMdcContainersImageAssessment(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Enabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingMdcContainersImageAssessmentInternal)this).Enabled = (bool?) content.GetValueForProperty("Enabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingMdcContainersImageAssessmentInternal)this).Enabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("CloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingMdcContainersImageAssessmentInternal)this).CloudRoleArn = (string) content.GetValueForProperty("CloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingMdcContainersImageAssessmentInternal)this).CloudRoleArn, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DefenderForContainersAwsOfferingMdcContainersImageAssessment(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Enabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingMdcContainersImageAssessmentInternal)this).Enabled = (bool?) content.GetValueForProperty("Enabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingMdcContainersImageAssessmentInternal)this).Enabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("CloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingMdcContainersImageAssessmentInternal)this).CloudRoleArn = (string) content.GetValueForProperty("CloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingMdcContainersImageAssessmentInternal)this).CloudRoleArn, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingMdcContainersImageAssessment DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DefenderForContainersAwsOfferingMdcContainersImageAssessment(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingMdcContainersImageAssessment DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DefenderForContainersAwsOfferingMdcContainersImageAssessment(content); + } + + /// + /// Creates a new instance of , deserializing the + /// content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingMdcContainersImageAssessment FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The Microsoft Defender container image assessment configuration + [System.ComponentModel.TypeConverter(typeof(DefenderForContainersAwsOfferingMdcContainersImageAssessmentTypeConverter))] + public partial interface IDefenderForContainersAwsOfferingMdcContainersImageAssessment + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingMdcContainersImageAssessment.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingMdcContainersImageAssessment.TypeConverter.cs new file mode 100644 index 000000000000..9cef683e0dfe --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingMdcContainersImageAssessment.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DefenderForContainersAwsOfferingMdcContainersImageAssessmentTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is + /// no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is + /// no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingMdcContainersImageAssessment ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingMdcContainersImageAssessment).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DefenderForContainersAwsOfferingMdcContainersImageAssessment.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DefenderForContainersAwsOfferingMdcContainersImageAssessment.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DefenderForContainersAwsOfferingMdcContainersImageAssessment.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingMdcContainersImageAssessment.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingMdcContainersImageAssessment.cs new file mode 100644 index 000000000000..d513c1bc919e --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingMdcContainersImageAssessment.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The Microsoft Defender container image assessment configuration + public partial class DefenderForContainersAwsOfferingMdcContainersImageAssessment : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingMdcContainersImageAssessment, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingMdcContainersImageAssessmentInternal + { + + /// Backing field for property. + private string _cloudRoleArn; + + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string CloudRoleArn { get => this._cloudRoleArn; set => this._cloudRoleArn = value; } + + /// Backing field for property. + private bool? _enabled; + + /// Is Microsoft Defender container image assessment enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public bool? Enabled { get => this._enabled; set => this._enabled = value; } + + /// + /// Creates an new instance. + /// + public DefenderForContainersAwsOfferingMdcContainersImageAssessment() + { + + } + } + /// The Microsoft Defender container image assessment configuration + public partial interface IDefenderForContainersAwsOfferingMdcContainersImageAssessment : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The cloud role ARN in AWS for this feature", + SerializedName = @"cloudRoleArn", + PossibleTypes = new [] { typeof(string) })] + string CloudRoleArn { get; set; } + /// Is Microsoft Defender container image assessment enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Is Microsoft Defender container image assessment enabled", + SerializedName = @"enabled", + PossibleTypes = new [] { typeof(bool) })] + bool? Enabled { get; set; } + + } + /// The Microsoft Defender container image assessment configuration + internal partial interface IDefenderForContainersAwsOfferingMdcContainersImageAssessmentInternal + + { + /// The cloud role ARN in AWS for this feature + string CloudRoleArn { get; set; } + /// Is Microsoft Defender container image assessment enabled + bool? Enabled { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingMdcContainersImageAssessment.json.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingMdcContainersImageAssessment.json.cs new file mode 100644 index 000000000000..9d83f33dce5d --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersAwsOfferingMdcContainersImageAssessment.json.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The Microsoft Defender container image assessment configuration + public partial class DefenderForContainersAwsOfferingMdcContainersImageAssessment + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal DefenderForContainersAwsOfferingMdcContainersImageAssessment(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_enabled = If( json?.PropertyT("enabled"), out var __jsonEnabled) ? (bool?)__jsonEnabled : _enabled;} + {_cloudRoleArn = If( json?.PropertyT("cloudRoleArn"), out var __jsonCloudRoleArn) ? (string)__jsonCloudRoleArn : (string)_cloudRoleArn;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingMdcContainersImageAssessment. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingMdcContainersImageAssessment. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersAwsOfferingMdcContainersImageAssessment FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DefenderForContainersAwsOfferingMdcContainersImageAssessment(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._enabled ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonBoolean((bool)this._enabled) : null, "enabled" ,container.Add ); + AddIf( null != (((object)this._cloudRoleArn)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._cloudRoleArn.ToString()) : null, "cloudRoleArn" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersGcpOffering.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersGcpOffering.PowerShell.cs new file mode 100644 index 000000000000..11bd85956b08 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersGcpOffering.PowerShell.cs @@ -0,0 +1,308 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The containers GCP offering + [System.ComponentModel.TypeConverter(typeof(DefenderForContainersGcpOfferingTypeConverter))] + public partial class DefenderForContainersGcpOffering + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DefenderForContainersGcpOffering(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("NativeCloudConnection")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal)this).NativeCloudConnection = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingNativeCloudConnection) content.GetValueForProperty("NativeCloudConnection",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal)this).NativeCloudConnection, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersGcpOfferingNativeCloudConnectionTypeConverter.ConvertFrom); + } + if (content.Contains("DataPipelineNativeCloudConnection")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal)this).DataPipelineNativeCloudConnection = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingDataPipelineNativeCloudConnection) content.GetValueForProperty("DataPipelineNativeCloudConnection",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal)this).DataPipelineNativeCloudConnection, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersGcpOfferingDataPipelineNativeCloudConnectionTypeConverter.ConvertFrom); + } + if (content.Contains("MdcContainersImageAssessment")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal)this).MdcContainersImageAssessment = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingMdcContainersImageAssessment) content.GetValueForProperty("MdcContainersImageAssessment",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal)this).MdcContainersImageAssessment, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersGcpOfferingMdcContainersImageAssessmentTypeConverter.ConvertFrom); + } + if (content.Contains("MdcContainersAgentlessDiscoveryK8S")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal)this).MdcContainersAgentlessDiscoveryK8S = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S) content.GetValueForProperty("MdcContainersAgentlessDiscoveryK8S",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal)this).MdcContainersAgentlessDiscoveryK8S, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8STypeConverter.ConvertFrom); + } + if (content.Contains("AuditLogsAutoProvisioningFlag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal)this).AuditLogsAutoProvisioningFlag = (bool?) content.GetValueForProperty("AuditLogsAutoProvisioningFlag",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal)this).AuditLogsAutoProvisioningFlag, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("DefenderAgentAutoProvisioningFlag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal)this).DefenderAgentAutoProvisioningFlag = (bool?) content.GetValueForProperty("DefenderAgentAutoProvisioningFlag",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal)this).DefenderAgentAutoProvisioningFlag, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("PolicyAgentAutoProvisioningFlag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal)this).PolicyAgentAutoProvisioningFlag = (bool?) content.GetValueForProperty("PolicyAgentAutoProvisioningFlag",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal)this).PolicyAgentAutoProvisioningFlag, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("OfferingType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType = (string) content.GetValueForProperty("OfferingType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType, global::System.Convert.ToString); + } + if (content.Contains("Description")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description, global::System.Convert.ToString); + } + if (content.Contains("NativeCloudConnectionServiceAccountEmailAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal)this).NativeCloudConnectionServiceAccountEmailAddress = (string) content.GetValueForProperty("NativeCloudConnectionServiceAccountEmailAddress",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal)this).NativeCloudConnectionServiceAccountEmailAddress, global::System.Convert.ToString); + } + if (content.Contains("NativeCloudConnectionWorkloadIdentityProviderId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal)this).NativeCloudConnectionWorkloadIdentityProviderId = (string) content.GetValueForProperty("NativeCloudConnectionWorkloadIdentityProviderId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal)this).NativeCloudConnectionWorkloadIdentityProviderId, global::System.Convert.ToString); + } + if (content.Contains("DataPipelineNativeCloudConnectionServiceAccountEmailAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal)this).DataPipelineNativeCloudConnectionServiceAccountEmailAddress = (string) content.GetValueForProperty("DataPipelineNativeCloudConnectionServiceAccountEmailAddress",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal)this).DataPipelineNativeCloudConnectionServiceAccountEmailAddress, global::System.Convert.ToString); + } + if (content.Contains("DataPipelineNativeCloudConnectionWorkloadIdentityProviderId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal)this).DataPipelineNativeCloudConnectionWorkloadIdentityProviderId = (string) content.GetValueForProperty("DataPipelineNativeCloudConnectionWorkloadIdentityProviderId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal)this).DataPipelineNativeCloudConnectionWorkloadIdentityProviderId, global::System.Convert.ToString); + } + if (content.Contains("MdcContainerImageAssessmentEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal)this).MdcContainerImageAssessmentEnabled = (bool?) content.GetValueForProperty("MdcContainerImageAssessmentEnabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal)this).MdcContainerImageAssessmentEnabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("MdcContainerImageAssessmentWorkloadIdentityProviderId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal)this).MdcContainerImageAssessmentWorkloadIdentityProviderId = (string) content.GetValueForProperty("MdcContainerImageAssessmentWorkloadIdentityProviderId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal)this).MdcContainerImageAssessmentWorkloadIdentityProviderId, global::System.Convert.ToString); + } + if (content.Contains("MdcContainerImageAssessmentServiceAccountEmailAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal)this).MdcContainerImageAssessmentServiceAccountEmailAddress = (string) content.GetValueForProperty("MdcContainerImageAssessmentServiceAccountEmailAddress",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal)this).MdcContainerImageAssessmentServiceAccountEmailAddress, global::System.Convert.ToString); + } + if (content.Contains("MdcContainerAgentlessDiscoveryK8SEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal)this).MdcContainerAgentlessDiscoveryK8SEnabled = (bool?) content.GetValueForProperty("MdcContainerAgentlessDiscoveryK8SEnabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal)this).MdcContainerAgentlessDiscoveryK8SEnabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal)this).MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId = (string) content.GetValueForProperty("MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal)this).MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId, global::System.Convert.ToString); + } + if (content.Contains("MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal)this).MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress = (string) content.GetValueForProperty("MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal)this).MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DefenderForContainersGcpOffering(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("NativeCloudConnection")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal)this).NativeCloudConnection = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingNativeCloudConnection) content.GetValueForProperty("NativeCloudConnection",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal)this).NativeCloudConnection, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersGcpOfferingNativeCloudConnectionTypeConverter.ConvertFrom); + } + if (content.Contains("DataPipelineNativeCloudConnection")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal)this).DataPipelineNativeCloudConnection = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingDataPipelineNativeCloudConnection) content.GetValueForProperty("DataPipelineNativeCloudConnection",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal)this).DataPipelineNativeCloudConnection, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersGcpOfferingDataPipelineNativeCloudConnectionTypeConverter.ConvertFrom); + } + if (content.Contains("MdcContainersImageAssessment")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal)this).MdcContainersImageAssessment = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingMdcContainersImageAssessment) content.GetValueForProperty("MdcContainersImageAssessment",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal)this).MdcContainersImageAssessment, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersGcpOfferingMdcContainersImageAssessmentTypeConverter.ConvertFrom); + } + if (content.Contains("MdcContainersAgentlessDiscoveryK8S")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal)this).MdcContainersAgentlessDiscoveryK8S = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S) content.GetValueForProperty("MdcContainersAgentlessDiscoveryK8S",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal)this).MdcContainersAgentlessDiscoveryK8S, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8STypeConverter.ConvertFrom); + } + if (content.Contains("AuditLogsAutoProvisioningFlag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal)this).AuditLogsAutoProvisioningFlag = (bool?) content.GetValueForProperty("AuditLogsAutoProvisioningFlag",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal)this).AuditLogsAutoProvisioningFlag, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("DefenderAgentAutoProvisioningFlag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal)this).DefenderAgentAutoProvisioningFlag = (bool?) content.GetValueForProperty("DefenderAgentAutoProvisioningFlag",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal)this).DefenderAgentAutoProvisioningFlag, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("PolicyAgentAutoProvisioningFlag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal)this).PolicyAgentAutoProvisioningFlag = (bool?) content.GetValueForProperty("PolicyAgentAutoProvisioningFlag",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal)this).PolicyAgentAutoProvisioningFlag, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("OfferingType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType = (string) content.GetValueForProperty("OfferingType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType, global::System.Convert.ToString); + } + if (content.Contains("Description")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description, global::System.Convert.ToString); + } + if (content.Contains("NativeCloudConnectionServiceAccountEmailAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal)this).NativeCloudConnectionServiceAccountEmailAddress = (string) content.GetValueForProperty("NativeCloudConnectionServiceAccountEmailAddress",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal)this).NativeCloudConnectionServiceAccountEmailAddress, global::System.Convert.ToString); + } + if (content.Contains("NativeCloudConnectionWorkloadIdentityProviderId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal)this).NativeCloudConnectionWorkloadIdentityProviderId = (string) content.GetValueForProperty("NativeCloudConnectionWorkloadIdentityProviderId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal)this).NativeCloudConnectionWorkloadIdentityProviderId, global::System.Convert.ToString); + } + if (content.Contains("DataPipelineNativeCloudConnectionServiceAccountEmailAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal)this).DataPipelineNativeCloudConnectionServiceAccountEmailAddress = (string) content.GetValueForProperty("DataPipelineNativeCloudConnectionServiceAccountEmailAddress",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal)this).DataPipelineNativeCloudConnectionServiceAccountEmailAddress, global::System.Convert.ToString); + } + if (content.Contains("DataPipelineNativeCloudConnectionWorkloadIdentityProviderId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal)this).DataPipelineNativeCloudConnectionWorkloadIdentityProviderId = (string) content.GetValueForProperty("DataPipelineNativeCloudConnectionWorkloadIdentityProviderId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal)this).DataPipelineNativeCloudConnectionWorkloadIdentityProviderId, global::System.Convert.ToString); + } + if (content.Contains("MdcContainerImageAssessmentEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal)this).MdcContainerImageAssessmentEnabled = (bool?) content.GetValueForProperty("MdcContainerImageAssessmentEnabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal)this).MdcContainerImageAssessmentEnabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("MdcContainerImageAssessmentWorkloadIdentityProviderId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal)this).MdcContainerImageAssessmentWorkloadIdentityProviderId = (string) content.GetValueForProperty("MdcContainerImageAssessmentWorkloadIdentityProviderId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal)this).MdcContainerImageAssessmentWorkloadIdentityProviderId, global::System.Convert.ToString); + } + if (content.Contains("MdcContainerImageAssessmentServiceAccountEmailAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal)this).MdcContainerImageAssessmentServiceAccountEmailAddress = (string) content.GetValueForProperty("MdcContainerImageAssessmentServiceAccountEmailAddress",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal)this).MdcContainerImageAssessmentServiceAccountEmailAddress, global::System.Convert.ToString); + } + if (content.Contains("MdcContainerAgentlessDiscoveryK8SEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal)this).MdcContainerAgentlessDiscoveryK8SEnabled = (bool?) content.GetValueForProperty("MdcContainerAgentlessDiscoveryK8SEnabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal)this).MdcContainerAgentlessDiscoveryK8SEnabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal)this).MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId = (string) content.GetValueForProperty("MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal)this).MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId, global::System.Convert.ToString); + } + if (content.Contains("MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal)this).MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress = (string) content.GetValueForProperty("MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal)this).MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOffering DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DefenderForContainersGcpOffering(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOffering DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DefenderForContainersGcpOffering(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOffering FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The containers GCP offering + [System.ComponentModel.TypeConverter(typeof(DefenderForContainersGcpOfferingTypeConverter))] + public partial interface IDefenderForContainersGcpOffering + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersGcpOffering.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersGcpOffering.TypeConverter.cs new file mode 100644 index 000000000000..3622834120c4 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersGcpOffering.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DefenderForContainersGcpOfferingTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOffering ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOffering).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DefenderForContainersGcpOffering.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DefenderForContainersGcpOffering.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DefenderForContainersGcpOffering.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersGcpOffering.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersGcpOffering.cs new file mode 100644 index 000000000000..c58246e89518 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersGcpOffering.cs @@ -0,0 +1,342 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The containers GCP offering + public partial class DefenderForContainersGcpOffering : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOffering, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOffering __cloudOffering = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CloudOffering(); + + /// Backing field for property. + private bool? _auditLogsAutoProvisioningFlag; + + /// Is audit logs data collection enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public bool? AuditLogsAutoProvisioningFlag { get => this._auditLogsAutoProvisioningFlag; set => this._auditLogsAutoProvisioningFlag = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingDataPipelineNativeCloudConnection _dataPipelineNativeCloudConnection; + + /// The native cloud connection configuration + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingDataPipelineNativeCloudConnection DataPipelineNativeCloudConnection { get => (this._dataPipelineNativeCloudConnection = this._dataPipelineNativeCloudConnection ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection()); set => this._dataPipelineNativeCloudConnection = value; } + + /// The data collection service account email address in GCP for this offering + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string DataPipelineNativeCloudConnectionServiceAccountEmailAddress { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingDataPipelineNativeCloudConnectionInternal)DataPipelineNativeCloudConnection).ServiceAccountEmailAddress; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingDataPipelineNativeCloudConnectionInternal)DataPipelineNativeCloudConnection).ServiceAccountEmailAddress = value ?? null; } + + /// The data collection GCP workload identity provider id for this offering + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string DataPipelineNativeCloudConnectionWorkloadIdentityProviderId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingDataPipelineNativeCloudConnectionInternal)DataPipelineNativeCloudConnection).WorkloadIdentityProviderId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingDataPipelineNativeCloudConnectionInternal)DataPipelineNativeCloudConnection).WorkloadIdentityProviderId = value ?? null; } + + /// Backing field for property. + private bool? _defenderAgentAutoProvisioningFlag; + + /// Is Microsoft Defender for Cloud Kubernetes agent auto provisioning enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public bool? DefenderAgentAutoProvisioningFlag { get => this._defenderAgentAutoProvisioningFlag; set => this._defenderAgentAutoProvisioningFlag = value; } + + /// The offering description. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string Description { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)__cloudOffering).Description; } + + /// Is Microsoft Defender container agentless discovery enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public bool? MdcContainerAgentlessDiscoveryK8SEnabled { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8SInternal)MdcContainersAgentlessDiscoveryK8S).Enabled; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8SInternal)MdcContainersAgentlessDiscoveryK8S).Enabled = value ?? default(bool); } + + /// The service account email address in GCP for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8SInternal)MdcContainersAgentlessDiscoveryK8S).ServiceAccountEmailAddress; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8SInternal)MdcContainersAgentlessDiscoveryK8S).ServiceAccountEmailAddress = value ?? null; } + + /// The workload identity provider id in GCP for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8SInternal)MdcContainersAgentlessDiscoveryK8S).WorkloadIdentityProviderId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8SInternal)MdcContainersAgentlessDiscoveryK8S).WorkloadIdentityProviderId = value ?? null; } + + /// Is Microsoft Defender container image assessment enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public bool? MdcContainerImageAssessmentEnabled { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingMdcContainersImageAssessmentInternal)MdcContainersImageAssessment).Enabled; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingMdcContainersImageAssessmentInternal)MdcContainersImageAssessment).Enabled = value ?? default(bool); } + + /// The service account email address in GCP for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string MdcContainerImageAssessmentServiceAccountEmailAddress { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingMdcContainersImageAssessmentInternal)MdcContainersImageAssessment).ServiceAccountEmailAddress; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingMdcContainersImageAssessmentInternal)MdcContainersImageAssessment).ServiceAccountEmailAddress = value ?? null; } + + /// The workload identity provider id in GCP for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string MdcContainerImageAssessmentWorkloadIdentityProviderId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingMdcContainersImageAssessmentInternal)MdcContainersImageAssessment).WorkloadIdentityProviderId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingMdcContainersImageAssessmentInternal)MdcContainersImageAssessment).WorkloadIdentityProviderId = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S _mdcContainersAgentlessDiscoveryK8S; + + /// The Microsoft Defender Container agentless discovery configuration + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S MdcContainersAgentlessDiscoveryK8S { get => (this._mdcContainersAgentlessDiscoveryK8S = this._mdcContainersAgentlessDiscoveryK8S ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S()); set => this._mdcContainersAgentlessDiscoveryK8S = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingMdcContainersImageAssessment _mdcContainersImageAssessment; + + /// The Microsoft Defender Container image assessment configuration + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingMdcContainersImageAssessment MdcContainersImageAssessment { get => (this._mdcContainersImageAssessment = this._mdcContainersImageAssessment ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersGcpOfferingMdcContainersImageAssessment()); set => this._mdcContainersImageAssessment = value; } + + /// Internal Acessors for Description + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal.Description { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)__cloudOffering).Description; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)__cloudOffering).Description = value; } + + /// Internal Acessors for DataPipelineNativeCloudConnection + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingDataPipelineNativeCloudConnection Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal.DataPipelineNativeCloudConnection { get => (this._dataPipelineNativeCloudConnection = this._dataPipelineNativeCloudConnection ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection()); set { {_dataPipelineNativeCloudConnection = value;} } } + + /// Internal Acessors for MdcContainersAgentlessDiscoveryK8S + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal.MdcContainersAgentlessDiscoveryK8S { get => (this._mdcContainersAgentlessDiscoveryK8S = this._mdcContainersAgentlessDiscoveryK8S ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S()); set { {_mdcContainersAgentlessDiscoveryK8S = value;} } } + + /// Internal Acessors for MdcContainersImageAssessment + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingMdcContainersImageAssessment Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal.MdcContainersImageAssessment { get => (this._mdcContainersImageAssessment = this._mdcContainersImageAssessment ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersGcpOfferingMdcContainersImageAssessment()); set { {_mdcContainersImageAssessment = value;} } } + + /// Internal Acessors for NativeCloudConnection + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingNativeCloudConnection Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingInternal.NativeCloudConnection { get => (this._nativeCloudConnection = this._nativeCloudConnection ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersGcpOfferingNativeCloudConnection()); set { {_nativeCloudConnection = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingNativeCloudConnection _nativeCloudConnection; + + /// The native cloud connection configuration + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingNativeCloudConnection NativeCloudConnection { get => (this._nativeCloudConnection = this._nativeCloudConnection ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersGcpOfferingNativeCloudConnection()); set => this._nativeCloudConnection = value; } + + /// The service account email address in GCP for this offering + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string NativeCloudConnectionServiceAccountEmailAddress { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingNativeCloudConnectionInternal)NativeCloudConnection).ServiceAccountEmailAddress; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingNativeCloudConnectionInternal)NativeCloudConnection).ServiceAccountEmailAddress = value ?? null; } + + /// The GCP workload identity provider id for this offering + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string NativeCloudConnectionWorkloadIdentityProviderId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingNativeCloudConnectionInternal)NativeCloudConnection).WorkloadIdentityProviderId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingNativeCloudConnectionInternal)NativeCloudConnection).WorkloadIdentityProviderId = value ?? null; } + + /// The type of the security offering. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Constant] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string OfferingType { get => "DefenderForContainersGcp"; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)__cloudOffering).OfferingType = "DefenderForContainersGcp"; } + + /// Backing field for property. + private bool? _policyAgentAutoProvisioningFlag; + + /// Is Policy Kubernetes agent auto provisioning enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public bool? PolicyAgentAutoProvisioningFlag { get => this._policyAgentAutoProvisioningFlag; set => this._policyAgentAutoProvisioningFlag = value; } + + /// Creates an new instance. + public DefenderForContainersGcpOffering() + { + this.__cloudOffering.OfferingType = "DefenderForContainersGcp"; + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__cloudOffering), __cloudOffering); + await eventListener.AssertObjectIsValid(nameof(__cloudOffering), __cloudOffering); + } + } + /// The containers GCP offering + public partial interface IDefenderForContainersGcpOffering : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOffering + { + /// Is audit logs data collection enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Is audit logs data collection enabled", + SerializedName = @"auditLogsAutoProvisioningFlag", + PossibleTypes = new [] { typeof(bool) })] + bool? AuditLogsAutoProvisioningFlag { get; set; } + /// The data collection service account email address in GCP for this offering + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The data collection service account email address in GCP for this offering", + SerializedName = @"serviceAccountEmailAddress", + PossibleTypes = new [] { typeof(string) })] + string DataPipelineNativeCloudConnectionServiceAccountEmailAddress { get; set; } + /// The data collection GCP workload identity provider id for this offering + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The data collection GCP workload identity provider id for this offering", + SerializedName = @"workloadIdentityProviderId", + PossibleTypes = new [] { typeof(string) })] + string DataPipelineNativeCloudConnectionWorkloadIdentityProviderId { get; set; } + /// Is Microsoft Defender for Cloud Kubernetes agent auto provisioning enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Is Microsoft Defender for Cloud Kubernetes agent auto provisioning enabled", + SerializedName = @"defenderAgentAutoProvisioningFlag", + PossibleTypes = new [] { typeof(bool) })] + bool? DefenderAgentAutoProvisioningFlag { get; set; } + /// Is Microsoft Defender container agentless discovery enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Is Microsoft Defender container agentless discovery enabled", + SerializedName = @"enabled", + PossibleTypes = new [] { typeof(bool) })] + bool? MdcContainerAgentlessDiscoveryK8SEnabled { get; set; } + /// The service account email address in GCP for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The service account email address in GCP for this feature", + SerializedName = @"serviceAccountEmailAddress", + PossibleTypes = new [] { typeof(string) })] + string MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress { get; set; } + /// The workload identity provider id in GCP for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The workload identity provider id in GCP for this feature", + SerializedName = @"workloadIdentityProviderId", + PossibleTypes = new [] { typeof(string) })] + string MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId { get; set; } + /// Is Microsoft Defender container image assessment enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Is Microsoft Defender container image assessment enabled", + SerializedName = @"enabled", + PossibleTypes = new [] { typeof(bool) })] + bool? MdcContainerImageAssessmentEnabled { get; set; } + /// The service account email address in GCP for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The service account email address in GCP for this feature", + SerializedName = @"serviceAccountEmailAddress", + PossibleTypes = new [] { typeof(string) })] + string MdcContainerImageAssessmentServiceAccountEmailAddress { get; set; } + /// The workload identity provider id in GCP for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The workload identity provider id in GCP for this feature", + SerializedName = @"workloadIdentityProviderId", + PossibleTypes = new [] { typeof(string) })] + string MdcContainerImageAssessmentWorkloadIdentityProviderId { get; set; } + /// The service account email address in GCP for this offering + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The service account email address in GCP for this offering", + SerializedName = @"serviceAccountEmailAddress", + PossibleTypes = new [] { typeof(string) })] + string NativeCloudConnectionServiceAccountEmailAddress { get; set; } + /// The GCP workload identity provider id for this offering + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The GCP workload identity provider id for this offering", + SerializedName = @"workloadIdentityProviderId", + PossibleTypes = new [] { typeof(string) })] + string NativeCloudConnectionWorkloadIdentityProviderId { get; set; } + /// Is Policy Kubernetes agent auto provisioning enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Is Policy Kubernetes agent auto provisioning enabled", + SerializedName = @"policyAgentAutoProvisioningFlag", + PossibleTypes = new [] { typeof(bool) })] + bool? PolicyAgentAutoProvisioningFlag { get; set; } + + } + /// The containers GCP offering + internal partial interface IDefenderForContainersGcpOfferingInternal : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal + { + /// Is audit logs data collection enabled + bool? AuditLogsAutoProvisioningFlag { get; set; } + /// The native cloud connection configuration + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingDataPipelineNativeCloudConnection DataPipelineNativeCloudConnection { get; set; } + /// The data collection service account email address in GCP for this offering + string DataPipelineNativeCloudConnectionServiceAccountEmailAddress { get; set; } + /// The data collection GCP workload identity provider id for this offering + string DataPipelineNativeCloudConnectionWorkloadIdentityProviderId { get; set; } + /// Is Microsoft Defender for Cloud Kubernetes agent auto provisioning enabled + bool? DefenderAgentAutoProvisioningFlag { get; set; } + /// Is Microsoft Defender container agentless discovery enabled + bool? MdcContainerAgentlessDiscoveryK8SEnabled { get; set; } + /// The service account email address in GCP for this feature + string MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress { get; set; } + /// The workload identity provider id in GCP for this feature + string MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId { get; set; } + /// Is Microsoft Defender container image assessment enabled + bool? MdcContainerImageAssessmentEnabled { get; set; } + /// The service account email address in GCP for this feature + string MdcContainerImageAssessmentServiceAccountEmailAddress { get; set; } + /// The workload identity provider id in GCP for this feature + string MdcContainerImageAssessmentWorkloadIdentityProviderId { get; set; } + /// The Microsoft Defender Container agentless discovery configuration + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S MdcContainersAgentlessDiscoveryK8S { get; set; } + /// The Microsoft Defender Container image assessment configuration + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingMdcContainersImageAssessment MdcContainersImageAssessment { get; set; } + /// The native cloud connection configuration + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingNativeCloudConnection NativeCloudConnection { get; set; } + /// The service account email address in GCP for this offering + string NativeCloudConnectionServiceAccountEmailAddress { get; set; } + /// The GCP workload identity provider id for this offering + string NativeCloudConnectionWorkloadIdentityProviderId { get; set; } + /// Is Policy Kubernetes agent auto provisioning enabled + bool? PolicyAgentAutoProvisioningFlag { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersGcpOffering.json.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersGcpOffering.json.cs new file mode 100644 index 000000000000..7dce34bccfb7 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersGcpOffering.json.cs @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The containers GCP offering + public partial class DefenderForContainersGcpOffering + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal DefenderForContainersGcpOffering(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __cloudOffering = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CloudOffering(json); + {_nativeCloudConnection = If( json?.PropertyT("nativeCloudConnection"), out var __jsonNativeCloudConnection) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersGcpOfferingNativeCloudConnection.FromJson(__jsonNativeCloudConnection) : _nativeCloudConnection;} + {_dataPipelineNativeCloudConnection = If( json?.PropertyT("dataPipelineNativeCloudConnection"), out var __jsonDataPipelineNativeCloudConnection) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection.FromJson(__jsonDataPipelineNativeCloudConnection) : _dataPipelineNativeCloudConnection;} + {_mdcContainersImageAssessment = If( json?.PropertyT("mdcContainersImageAssessment"), out var __jsonMdcContainersImageAssessment) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersGcpOfferingMdcContainersImageAssessment.FromJson(__jsonMdcContainersImageAssessment) : _mdcContainersImageAssessment;} + {_mdcContainersAgentlessDiscoveryK8S = If( json?.PropertyT("mdcContainersAgentlessDiscoveryK8s"), out var __jsonMdcContainersAgentlessDiscoveryK8S) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S.FromJson(__jsonMdcContainersAgentlessDiscoveryK8S) : _mdcContainersAgentlessDiscoveryK8S;} + {_auditLogsAutoProvisioningFlag = If( json?.PropertyT("auditLogsAutoProvisioningFlag"), out var __jsonAuditLogsAutoProvisioningFlag) ? (bool?)__jsonAuditLogsAutoProvisioningFlag : _auditLogsAutoProvisioningFlag;} + {_defenderAgentAutoProvisioningFlag = If( json?.PropertyT("defenderAgentAutoProvisioningFlag"), out var __jsonDefenderAgentAutoProvisioningFlag) ? (bool?)__jsonDefenderAgentAutoProvisioningFlag : _defenderAgentAutoProvisioningFlag;} + {_policyAgentAutoProvisioningFlag = If( json?.PropertyT("policyAgentAutoProvisioningFlag"), out var __jsonPolicyAgentAutoProvisioningFlag) ? (bool?)__jsonPolicyAgentAutoProvisioningFlag : _policyAgentAutoProvisioningFlag;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOffering. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOffering. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOffering FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DefenderForContainersGcpOffering(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __cloudOffering?.ToJson(container, serializationMode); + AddIf( null != this._nativeCloudConnection ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._nativeCloudConnection.ToJson(null,serializationMode) : null, "nativeCloudConnection" ,container.Add ); + AddIf( null != this._dataPipelineNativeCloudConnection ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._dataPipelineNativeCloudConnection.ToJson(null,serializationMode) : null, "dataPipelineNativeCloudConnection" ,container.Add ); + AddIf( null != this._mdcContainersImageAssessment ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._mdcContainersImageAssessment.ToJson(null,serializationMode) : null, "mdcContainersImageAssessment" ,container.Add ); + AddIf( null != this._mdcContainersAgentlessDiscoveryK8S ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._mdcContainersAgentlessDiscoveryK8S.ToJson(null,serializationMode) : null, "mdcContainersAgentlessDiscoveryK8s" ,container.Add ); + AddIf( null != this._auditLogsAutoProvisioningFlag ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonBoolean((bool)this._auditLogsAutoProvisioningFlag) : null, "auditLogsAutoProvisioningFlag" ,container.Add ); + AddIf( null != this._defenderAgentAutoProvisioningFlag ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonBoolean((bool)this._defenderAgentAutoProvisioningFlag) : null, "defenderAgentAutoProvisioningFlag" ,container.Add ); + AddIf( null != this._policyAgentAutoProvisioningFlag ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonBoolean((bool)this._policyAgentAutoProvisioningFlag) : null, "policyAgentAutoProvisioningFlag" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection.PowerShell.cs new file mode 100644 index 000000000000..268f5956ee80 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection.PowerShell.cs @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The native cloud connection configuration + [System.ComponentModel.TypeConverter(typeof(DefenderForContainersGcpOfferingDataPipelineNativeCloudConnectionTypeConverter))] + public partial class DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ServiceAccountEmailAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingDataPipelineNativeCloudConnectionInternal)this).ServiceAccountEmailAddress = (string) content.GetValueForProperty("ServiceAccountEmailAddress",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingDataPipelineNativeCloudConnectionInternal)this).ServiceAccountEmailAddress, global::System.Convert.ToString); + } + if (content.Contains("WorkloadIdentityProviderId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingDataPipelineNativeCloudConnectionInternal)this).WorkloadIdentityProviderId = (string) content.GetValueForProperty("WorkloadIdentityProviderId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingDataPipelineNativeCloudConnectionInternal)this).WorkloadIdentityProviderId, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ServiceAccountEmailAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingDataPipelineNativeCloudConnectionInternal)this).ServiceAccountEmailAddress = (string) content.GetValueForProperty("ServiceAccountEmailAddress",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingDataPipelineNativeCloudConnectionInternal)this).ServiceAccountEmailAddress, global::System.Convert.ToString); + } + if (content.Contains("WorkloadIdentityProviderId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingDataPipelineNativeCloudConnectionInternal)this).WorkloadIdentityProviderId = (string) content.GetValueForProperty("WorkloadIdentityProviderId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingDataPipelineNativeCloudConnectionInternal)this).WorkloadIdentityProviderId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingDataPipelineNativeCloudConnection DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingDataPipelineNativeCloudConnection DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection(content); + } + + /// + /// Creates a new instance of , deserializing + /// the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingDataPipelineNativeCloudConnection FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The native cloud connection configuration + [System.ComponentModel.TypeConverter(typeof(DefenderForContainersGcpOfferingDataPipelineNativeCloudConnectionTypeConverter))] + public partial interface IDefenderForContainersGcpOfferingDataPipelineNativeCloudConnection + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection.TypeConverter.cs new file mode 100644 index 000000000000..a86c1788fbc1 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DefenderForContainersGcpOfferingDataPipelineNativeCloudConnectionTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there + /// is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there + /// is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingDataPipelineNativeCloudConnection ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingDataPipelineNativeCloudConnection).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection.cs new file mode 100644 index 000000000000..ed08bfb563a5 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The native cloud connection configuration + public partial class DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingDataPipelineNativeCloudConnection, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingDataPipelineNativeCloudConnectionInternal + { + + /// Backing field for property. + private string _serviceAccountEmailAddress; + + /// The data collection service account email address in GCP for this offering + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string ServiceAccountEmailAddress { get => this._serviceAccountEmailAddress; set => this._serviceAccountEmailAddress = value; } + + /// Backing field for property. + private string _workloadIdentityProviderId; + + /// The data collection GCP workload identity provider id for this offering + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string WorkloadIdentityProviderId { get => this._workloadIdentityProviderId; set => this._workloadIdentityProviderId = value; } + + /// + /// Creates an new instance. + /// + public DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection() + { + + } + } + /// The native cloud connection configuration + public partial interface IDefenderForContainersGcpOfferingDataPipelineNativeCloudConnection : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// The data collection service account email address in GCP for this offering + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The data collection service account email address in GCP for this offering", + SerializedName = @"serviceAccountEmailAddress", + PossibleTypes = new [] { typeof(string) })] + string ServiceAccountEmailAddress { get; set; } + /// The data collection GCP workload identity provider id for this offering + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The data collection GCP workload identity provider id for this offering", + SerializedName = @"workloadIdentityProviderId", + PossibleTypes = new [] { typeof(string) })] + string WorkloadIdentityProviderId { get; set; } + + } + /// The native cloud connection configuration + internal partial interface IDefenderForContainersGcpOfferingDataPipelineNativeCloudConnectionInternal + + { + /// The data collection service account email address in GCP for this offering + string ServiceAccountEmailAddress { get; set; } + /// The data collection GCP workload identity provider id for this offering + string WorkloadIdentityProviderId { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection.json.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection.json.cs new file mode 100644 index 000000000000..99aac6144940 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection.json.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The native cloud connection configuration + public partial class DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_serviceAccountEmailAddress = If( json?.PropertyT("serviceAccountEmailAddress"), out var __jsonServiceAccountEmailAddress) ? (string)__jsonServiceAccountEmailAddress : (string)_serviceAccountEmailAddress;} + {_workloadIdentityProviderId = If( json?.PropertyT("workloadIdentityProviderId"), out var __jsonWorkloadIdentityProviderId) ? (string)__jsonWorkloadIdentityProviderId : (string)_workloadIdentityProviderId;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingDataPipelineNativeCloudConnection. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingDataPipelineNativeCloudConnection. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingDataPipelineNativeCloudConnection FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._serviceAccountEmailAddress)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._serviceAccountEmailAddress.ToString()) : null, "serviceAccountEmailAddress" ,container.Add ); + AddIf( null != (((object)this._workloadIdentityProviderId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._workloadIdentityProviderId.ToString()) : null, "workloadIdentityProviderId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S.PowerShell.cs new file mode 100644 index 000000000000..7b6243a7f6eb --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S.PowerShell.cs @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The Microsoft Defender Container agentless discovery configuration + [System.ComponentModel.TypeConverter(typeof(DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8STypeConverter))] + public partial class DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Enabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8SInternal)this).Enabled = (bool?) content.GetValueForProperty("Enabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8SInternal)this).Enabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("WorkloadIdentityProviderId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8SInternal)this).WorkloadIdentityProviderId = (string) content.GetValueForProperty("WorkloadIdentityProviderId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8SInternal)this).WorkloadIdentityProviderId, global::System.Convert.ToString); + } + if (content.Contains("ServiceAccountEmailAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8SInternal)this).ServiceAccountEmailAddress = (string) content.GetValueForProperty("ServiceAccountEmailAddress",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8SInternal)this).ServiceAccountEmailAddress, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Enabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8SInternal)this).Enabled = (bool?) content.GetValueForProperty("Enabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8SInternal)this).Enabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("WorkloadIdentityProviderId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8SInternal)this).WorkloadIdentityProviderId = (string) content.GetValueForProperty("WorkloadIdentityProviderId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8SInternal)this).WorkloadIdentityProviderId, global::System.Convert.ToString); + } + if (content.Contains("ServiceAccountEmailAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8SInternal)this).ServiceAccountEmailAddress = (string) content.GetValueForProperty("ServiceAccountEmailAddress",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8SInternal)this).ServiceAccountEmailAddress, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S(content); + } + + /// + /// Creates a new instance of , deserializing + /// the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The Microsoft Defender Container agentless discovery configuration + [System.ComponentModel.TypeConverter(typeof(DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8STypeConverter))] + public partial interface IDefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S.TypeConverter.cs new file mode 100644 index 000000000000..02c45c56d6e2 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8STypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there + /// is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there + /// is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S.cs new file mode 100644 index 000000000000..386a6d6b3cd1 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S.cs @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The Microsoft Defender Container agentless discovery configuration + public partial class DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8SInternal + { + + /// Backing field for property. + private bool? _enabled; + + /// Is Microsoft Defender container agentless discovery enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public bool? Enabled { get => this._enabled; set => this._enabled = value; } + + /// Backing field for property. + private string _serviceAccountEmailAddress; + + /// The service account email address in GCP for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string ServiceAccountEmailAddress { get => this._serviceAccountEmailAddress; set => this._serviceAccountEmailAddress = value; } + + /// Backing field for property. + private string _workloadIdentityProviderId; + + /// The workload identity provider id in GCP for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string WorkloadIdentityProviderId { get => this._workloadIdentityProviderId; set => this._workloadIdentityProviderId = value; } + + /// + /// Creates an new instance. + /// + public DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S() + { + + } + } + /// The Microsoft Defender Container agentless discovery configuration + public partial interface IDefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// Is Microsoft Defender container agentless discovery enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Is Microsoft Defender container agentless discovery enabled", + SerializedName = @"enabled", + PossibleTypes = new [] { typeof(bool) })] + bool? Enabled { get; set; } + /// The service account email address in GCP for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The service account email address in GCP for this feature", + SerializedName = @"serviceAccountEmailAddress", + PossibleTypes = new [] { typeof(string) })] + string ServiceAccountEmailAddress { get; set; } + /// The workload identity provider id in GCP for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The workload identity provider id in GCP for this feature", + SerializedName = @"workloadIdentityProviderId", + PossibleTypes = new [] { typeof(string) })] + string WorkloadIdentityProviderId { get; set; } + + } + /// The Microsoft Defender Container agentless discovery configuration + internal partial interface IDefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8SInternal + + { + /// Is Microsoft Defender container agentless discovery enabled + bool? Enabled { get; set; } + /// The service account email address in GCP for this feature + string ServiceAccountEmailAddress { get; set; } + /// The workload identity provider id in GCP for this feature + string WorkloadIdentityProviderId { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S.json.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S.json.cs new file mode 100644 index 000000000000..8692211b45dd --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S.json.cs @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The Microsoft Defender Container agentless discovery configuration + public partial class DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_enabled = If( json?.PropertyT("enabled"), out var __jsonEnabled) ? (bool?)__jsonEnabled : _enabled;} + {_workloadIdentityProviderId = If( json?.PropertyT("workloadIdentityProviderId"), out var __jsonWorkloadIdentityProviderId) ? (string)__jsonWorkloadIdentityProviderId : (string)_workloadIdentityProviderId;} + {_serviceAccountEmailAddress = If( json?.PropertyT("serviceAccountEmailAddress"), out var __jsonServiceAccountEmailAddress) ? (string)__jsonServiceAccountEmailAddress : (string)_serviceAccountEmailAddress;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._enabled ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonBoolean((bool)this._enabled) : null, "enabled" ,container.Add ); + AddIf( null != (((object)this._workloadIdentityProviderId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._workloadIdentityProviderId.ToString()) : null, "workloadIdentityProviderId" ,container.Add ); + AddIf( null != (((object)this._serviceAccountEmailAddress)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._serviceAccountEmailAddress.ToString()) : null, "serviceAccountEmailAddress" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersGcpOfferingMdcContainersImageAssessment.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersGcpOfferingMdcContainersImageAssessment.PowerShell.cs new file mode 100644 index 000000000000..d39777f89d76 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersGcpOfferingMdcContainersImageAssessment.PowerShell.cs @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The Microsoft Defender Container image assessment configuration + [System.ComponentModel.TypeConverter(typeof(DefenderForContainersGcpOfferingMdcContainersImageAssessmentTypeConverter))] + public partial class DefenderForContainersGcpOfferingMdcContainersImageAssessment + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DefenderForContainersGcpOfferingMdcContainersImageAssessment(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Enabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingMdcContainersImageAssessmentInternal)this).Enabled = (bool?) content.GetValueForProperty("Enabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingMdcContainersImageAssessmentInternal)this).Enabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("WorkloadIdentityProviderId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingMdcContainersImageAssessmentInternal)this).WorkloadIdentityProviderId = (string) content.GetValueForProperty("WorkloadIdentityProviderId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingMdcContainersImageAssessmentInternal)this).WorkloadIdentityProviderId, global::System.Convert.ToString); + } + if (content.Contains("ServiceAccountEmailAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingMdcContainersImageAssessmentInternal)this).ServiceAccountEmailAddress = (string) content.GetValueForProperty("ServiceAccountEmailAddress",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingMdcContainersImageAssessmentInternal)this).ServiceAccountEmailAddress, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DefenderForContainersGcpOfferingMdcContainersImageAssessment(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Enabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingMdcContainersImageAssessmentInternal)this).Enabled = (bool?) content.GetValueForProperty("Enabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingMdcContainersImageAssessmentInternal)this).Enabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("WorkloadIdentityProviderId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingMdcContainersImageAssessmentInternal)this).WorkloadIdentityProviderId = (string) content.GetValueForProperty("WorkloadIdentityProviderId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingMdcContainersImageAssessmentInternal)this).WorkloadIdentityProviderId, global::System.Convert.ToString); + } + if (content.Contains("ServiceAccountEmailAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingMdcContainersImageAssessmentInternal)this).ServiceAccountEmailAddress = (string) content.GetValueForProperty("ServiceAccountEmailAddress",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingMdcContainersImageAssessmentInternal)this).ServiceAccountEmailAddress, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingMdcContainersImageAssessment DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DefenderForContainersGcpOfferingMdcContainersImageAssessment(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingMdcContainersImageAssessment DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DefenderForContainersGcpOfferingMdcContainersImageAssessment(content); + } + + /// + /// Creates a new instance of , deserializing the + /// content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingMdcContainersImageAssessment FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The Microsoft Defender Container image assessment configuration + [System.ComponentModel.TypeConverter(typeof(DefenderForContainersGcpOfferingMdcContainersImageAssessmentTypeConverter))] + public partial interface IDefenderForContainersGcpOfferingMdcContainersImageAssessment + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersGcpOfferingMdcContainersImageAssessment.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersGcpOfferingMdcContainersImageAssessment.TypeConverter.cs new file mode 100644 index 000000000000..f2cbd18179ba --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersGcpOfferingMdcContainersImageAssessment.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DefenderForContainersGcpOfferingMdcContainersImageAssessmentTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is + /// no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is + /// no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingMdcContainersImageAssessment ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingMdcContainersImageAssessment).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DefenderForContainersGcpOfferingMdcContainersImageAssessment.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DefenderForContainersGcpOfferingMdcContainersImageAssessment.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DefenderForContainersGcpOfferingMdcContainersImageAssessment.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersGcpOfferingMdcContainersImageAssessment.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersGcpOfferingMdcContainersImageAssessment.cs new file mode 100644 index 000000000000..3de600bbf8b4 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersGcpOfferingMdcContainersImageAssessment.cs @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The Microsoft Defender Container image assessment configuration + public partial class DefenderForContainersGcpOfferingMdcContainersImageAssessment : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingMdcContainersImageAssessment, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingMdcContainersImageAssessmentInternal + { + + /// Backing field for property. + private bool? _enabled; + + /// Is Microsoft Defender container image assessment enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public bool? Enabled { get => this._enabled; set => this._enabled = value; } + + /// Backing field for property. + private string _serviceAccountEmailAddress; + + /// The service account email address in GCP for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string ServiceAccountEmailAddress { get => this._serviceAccountEmailAddress; set => this._serviceAccountEmailAddress = value; } + + /// Backing field for property. + private string _workloadIdentityProviderId; + + /// The workload identity provider id in GCP for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string WorkloadIdentityProviderId { get => this._workloadIdentityProviderId; set => this._workloadIdentityProviderId = value; } + + /// + /// Creates an new instance. + /// + public DefenderForContainersGcpOfferingMdcContainersImageAssessment() + { + + } + } + /// The Microsoft Defender Container image assessment configuration + public partial interface IDefenderForContainersGcpOfferingMdcContainersImageAssessment : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// Is Microsoft Defender container image assessment enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Is Microsoft Defender container image assessment enabled", + SerializedName = @"enabled", + PossibleTypes = new [] { typeof(bool) })] + bool? Enabled { get; set; } + /// The service account email address in GCP for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The service account email address in GCP for this feature", + SerializedName = @"serviceAccountEmailAddress", + PossibleTypes = new [] { typeof(string) })] + string ServiceAccountEmailAddress { get; set; } + /// The workload identity provider id in GCP for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The workload identity provider id in GCP for this feature", + SerializedName = @"workloadIdentityProviderId", + PossibleTypes = new [] { typeof(string) })] + string WorkloadIdentityProviderId { get; set; } + + } + /// The Microsoft Defender Container image assessment configuration + internal partial interface IDefenderForContainersGcpOfferingMdcContainersImageAssessmentInternal + + { + /// Is Microsoft Defender container image assessment enabled + bool? Enabled { get; set; } + /// The service account email address in GCP for this feature + string ServiceAccountEmailAddress { get; set; } + /// The workload identity provider id in GCP for this feature + string WorkloadIdentityProviderId { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersGcpOfferingMdcContainersImageAssessment.json.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersGcpOfferingMdcContainersImageAssessment.json.cs new file mode 100644 index 000000000000..1d70d9f78b87 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersGcpOfferingMdcContainersImageAssessment.json.cs @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The Microsoft Defender Container image assessment configuration + public partial class DefenderForContainersGcpOfferingMdcContainersImageAssessment + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal DefenderForContainersGcpOfferingMdcContainersImageAssessment(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_enabled = If( json?.PropertyT("enabled"), out var __jsonEnabled) ? (bool?)__jsonEnabled : _enabled;} + {_workloadIdentityProviderId = If( json?.PropertyT("workloadIdentityProviderId"), out var __jsonWorkloadIdentityProviderId) ? (string)__jsonWorkloadIdentityProviderId : (string)_workloadIdentityProviderId;} + {_serviceAccountEmailAddress = If( json?.PropertyT("serviceAccountEmailAddress"), out var __jsonServiceAccountEmailAddress) ? (string)__jsonServiceAccountEmailAddress : (string)_serviceAccountEmailAddress;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingMdcContainersImageAssessment. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingMdcContainersImageAssessment. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingMdcContainersImageAssessment FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DefenderForContainersGcpOfferingMdcContainersImageAssessment(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._enabled ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonBoolean((bool)this._enabled) : null, "enabled" ,container.Add ); + AddIf( null != (((object)this._workloadIdentityProviderId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._workloadIdentityProviderId.ToString()) : null, "workloadIdentityProviderId" ,container.Add ); + AddIf( null != (((object)this._serviceAccountEmailAddress)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._serviceAccountEmailAddress.ToString()) : null, "serviceAccountEmailAddress" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersGcpOfferingNativeCloudConnection.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersGcpOfferingNativeCloudConnection.PowerShell.cs new file mode 100644 index 000000000000..575cdd789d58 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersGcpOfferingNativeCloudConnection.PowerShell.cs @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The native cloud connection configuration + [System.ComponentModel.TypeConverter(typeof(DefenderForContainersGcpOfferingNativeCloudConnectionTypeConverter))] + public partial class DefenderForContainersGcpOfferingNativeCloudConnection + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DefenderForContainersGcpOfferingNativeCloudConnection(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ServiceAccountEmailAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingNativeCloudConnectionInternal)this).ServiceAccountEmailAddress = (string) content.GetValueForProperty("ServiceAccountEmailAddress",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingNativeCloudConnectionInternal)this).ServiceAccountEmailAddress, global::System.Convert.ToString); + } + if (content.Contains("WorkloadIdentityProviderId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingNativeCloudConnectionInternal)this).WorkloadIdentityProviderId = (string) content.GetValueForProperty("WorkloadIdentityProviderId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingNativeCloudConnectionInternal)this).WorkloadIdentityProviderId, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DefenderForContainersGcpOfferingNativeCloudConnection(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ServiceAccountEmailAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingNativeCloudConnectionInternal)this).ServiceAccountEmailAddress = (string) content.GetValueForProperty("ServiceAccountEmailAddress",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingNativeCloudConnectionInternal)this).ServiceAccountEmailAddress, global::System.Convert.ToString); + } + if (content.Contains("WorkloadIdentityProviderId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingNativeCloudConnectionInternal)this).WorkloadIdentityProviderId = (string) content.GetValueForProperty("WorkloadIdentityProviderId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingNativeCloudConnectionInternal)this).WorkloadIdentityProviderId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingNativeCloudConnection DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DefenderForContainersGcpOfferingNativeCloudConnection(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingNativeCloudConnection DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DefenderForContainersGcpOfferingNativeCloudConnection(content); + } + + /// + /// Creates a new instance of , deserializing the content + /// from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingNativeCloudConnection FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The native cloud connection configuration + [System.ComponentModel.TypeConverter(typeof(DefenderForContainersGcpOfferingNativeCloudConnectionTypeConverter))] + public partial interface IDefenderForContainersGcpOfferingNativeCloudConnection + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersGcpOfferingNativeCloudConnection.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersGcpOfferingNativeCloudConnection.TypeConverter.cs new file mode 100644 index 000000000000..324824dda945 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersGcpOfferingNativeCloudConnection.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DefenderForContainersGcpOfferingNativeCloudConnectionTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingNativeCloudConnection ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingNativeCloudConnection).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DefenderForContainersGcpOfferingNativeCloudConnection.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DefenderForContainersGcpOfferingNativeCloudConnection.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DefenderForContainersGcpOfferingNativeCloudConnection.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersGcpOfferingNativeCloudConnection.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersGcpOfferingNativeCloudConnection.cs new file mode 100644 index 000000000000..5ff2d85708a4 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersGcpOfferingNativeCloudConnection.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The native cloud connection configuration + public partial class DefenderForContainersGcpOfferingNativeCloudConnection : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingNativeCloudConnection, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingNativeCloudConnectionInternal + { + + /// Backing field for property. + private string _serviceAccountEmailAddress; + + /// The service account email address in GCP for this offering + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string ServiceAccountEmailAddress { get => this._serviceAccountEmailAddress; set => this._serviceAccountEmailAddress = value; } + + /// Backing field for property. + private string _workloadIdentityProviderId; + + /// The GCP workload identity provider id for this offering + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string WorkloadIdentityProviderId { get => this._workloadIdentityProviderId; set => this._workloadIdentityProviderId = value; } + + /// + /// Creates an new instance. + /// + public DefenderForContainersGcpOfferingNativeCloudConnection() + { + + } + } + /// The native cloud connection configuration + public partial interface IDefenderForContainersGcpOfferingNativeCloudConnection : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// The service account email address in GCP for this offering + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The service account email address in GCP for this offering", + SerializedName = @"serviceAccountEmailAddress", + PossibleTypes = new [] { typeof(string) })] + string ServiceAccountEmailAddress { get; set; } + /// The GCP workload identity provider id for this offering + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The GCP workload identity provider id for this offering", + SerializedName = @"workloadIdentityProviderId", + PossibleTypes = new [] { typeof(string) })] + string WorkloadIdentityProviderId { get; set; } + + } + /// The native cloud connection configuration + internal partial interface IDefenderForContainersGcpOfferingNativeCloudConnectionInternal + + { + /// The service account email address in GCP for this offering + string ServiceAccountEmailAddress { get; set; } + /// The GCP workload identity provider id for this offering + string WorkloadIdentityProviderId { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersGcpOfferingNativeCloudConnection.json.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersGcpOfferingNativeCloudConnection.json.cs new file mode 100644 index 000000000000..d321cd5146f5 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForContainersGcpOfferingNativeCloudConnection.json.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The native cloud connection configuration + public partial class DefenderForContainersGcpOfferingNativeCloudConnection + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal DefenderForContainersGcpOfferingNativeCloudConnection(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_serviceAccountEmailAddress = If( json?.PropertyT("serviceAccountEmailAddress"), out var __jsonServiceAccountEmailAddress) ? (string)__jsonServiceAccountEmailAddress : (string)_serviceAccountEmailAddress;} + {_workloadIdentityProviderId = If( json?.PropertyT("workloadIdentityProviderId"), out var __jsonWorkloadIdentityProviderId) ? (string)__jsonWorkloadIdentityProviderId : (string)_workloadIdentityProviderId;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingNativeCloudConnection. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingNativeCloudConnection. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForContainersGcpOfferingNativeCloudConnection FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DefenderForContainersGcpOfferingNativeCloudConnection(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._serviceAccountEmailAddress)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._serviceAccountEmailAddress.ToString()) : null, "serviceAccountEmailAddress" ,container.Add ); + AddIf( null != (((object)this._workloadIdentityProviderId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._workloadIdentityProviderId.ToString()) : null, "workloadIdentityProviderId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForDatabasesAwsOffering.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForDatabasesAwsOffering.PowerShell.cs new file mode 100644 index 000000000000..8516c85c4386 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForDatabasesAwsOffering.PowerShell.cs @@ -0,0 +1,268 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The Defender for Databases AWS offering + [System.ComponentModel.TypeConverter(typeof(DefenderForDatabasesAwsOfferingTypeConverter))] + public partial class DefenderForDatabasesAwsOffering + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DefenderForDatabasesAwsOffering(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ArcAutoProvisioning")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesAwsOfferingInternal)this).ArcAutoProvisioning = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioning) content.GetValueForProperty("ArcAutoProvisioning",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesAwsOfferingInternal)this).ArcAutoProvisioning, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderFoDatabasesAwsOfferingArcAutoProvisioningTypeConverter.ConvertFrom); + } + if (content.Contains("Rd")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesAwsOfferingInternal)this).Rd = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingRds) content.GetValueForProperty("Rd",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesAwsOfferingInternal)this).Rd, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderFoDatabasesAwsOfferingRdsTypeConverter.ConvertFrom); + } + if (content.Contains("DatabasesDspm")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesAwsOfferingInternal)this).DatabasesDspm = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingDatabasesDspm) content.GetValueForProperty("DatabasesDspm",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesAwsOfferingInternal)this).DatabasesDspm, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderFoDatabasesAwsOfferingDatabasesDspmTypeConverter.ConvertFrom); + } + if (content.Contains("OfferingType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType = (string) content.GetValueForProperty("OfferingType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType, global::System.Convert.ToString); + } + if (content.Contains("Description")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description, global::System.Convert.ToString); + } + if (content.Contains("ArcAutoProvisioningConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesAwsOfferingInternal)this).ArcAutoProvisioningConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioningConfiguration) content.GetValueForProperty("ArcAutoProvisioningConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesAwsOfferingInternal)this).ArcAutoProvisioningConfiguration, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderFoDatabasesAwsOfferingArcAutoProvisioningConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("ArcAutoProvisioningEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesAwsOfferingInternal)this).ArcAutoProvisioningEnabled = (bool?) content.GetValueForProperty("ArcAutoProvisioningEnabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesAwsOfferingInternal)this).ArcAutoProvisioningEnabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ArcAutoProvisioningCloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesAwsOfferingInternal)this).ArcAutoProvisioningCloudRoleArn = (string) content.GetValueForProperty("ArcAutoProvisioningCloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesAwsOfferingInternal)this).ArcAutoProvisioningCloudRoleArn, global::System.Convert.ToString); + } + if (content.Contains("RdEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesAwsOfferingInternal)this).RdEnabled = (bool?) content.GetValueForProperty("RdEnabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesAwsOfferingInternal)this).RdEnabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("RdCloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesAwsOfferingInternal)this).RdCloudRoleArn = (string) content.GetValueForProperty("RdCloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesAwsOfferingInternal)this).RdCloudRoleArn, global::System.Convert.ToString); + } + if (content.Contains("DatabaseDspmEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesAwsOfferingInternal)this).DatabaseDspmEnabled = (bool?) content.GetValueForProperty("DatabaseDspmEnabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesAwsOfferingInternal)this).DatabaseDspmEnabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("DatabaseDspmCloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesAwsOfferingInternal)this).DatabaseDspmCloudRoleArn = (string) content.GetValueForProperty("DatabaseDspmCloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesAwsOfferingInternal)this).DatabaseDspmCloudRoleArn, global::System.Convert.ToString); + } + if (content.Contains("ConfigurationProxy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesAwsOfferingInternal)this).ConfigurationProxy = (string) content.GetValueForProperty("ConfigurationProxy",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesAwsOfferingInternal)this).ConfigurationProxy, global::System.Convert.ToString); + } + if (content.Contains("ConfigurationPrivateLinkScope")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesAwsOfferingInternal)this).ConfigurationPrivateLinkScope = (string) content.GetValueForProperty("ConfigurationPrivateLinkScope",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesAwsOfferingInternal)this).ConfigurationPrivateLinkScope, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DefenderForDatabasesAwsOffering(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ArcAutoProvisioning")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesAwsOfferingInternal)this).ArcAutoProvisioning = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioning) content.GetValueForProperty("ArcAutoProvisioning",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesAwsOfferingInternal)this).ArcAutoProvisioning, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderFoDatabasesAwsOfferingArcAutoProvisioningTypeConverter.ConvertFrom); + } + if (content.Contains("Rd")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesAwsOfferingInternal)this).Rd = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingRds) content.GetValueForProperty("Rd",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesAwsOfferingInternal)this).Rd, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderFoDatabasesAwsOfferingRdsTypeConverter.ConvertFrom); + } + if (content.Contains("DatabasesDspm")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesAwsOfferingInternal)this).DatabasesDspm = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingDatabasesDspm) content.GetValueForProperty("DatabasesDspm",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesAwsOfferingInternal)this).DatabasesDspm, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderFoDatabasesAwsOfferingDatabasesDspmTypeConverter.ConvertFrom); + } + if (content.Contains("OfferingType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType = (string) content.GetValueForProperty("OfferingType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType, global::System.Convert.ToString); + } + if (content.Contains("Description")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description, global::System.Convert.ToString); + } + if (content.Contains("ArcAutoProvisioningConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesAwsOfferingInternal)this).ArcAutoProvisioningConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioningConfiguration) content.GetValueForProperty("ArcAutoProvisioningConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesAwsOfferingInternal)this).ArcAutoProvisioningConfiguration, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderFoDatabasesAwsOfferingArcAutoProvisioningConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("ArcAutoProvisioningEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesAwsOfferingInternal)this).ArcAutoProvisioningEnabled = (bool?) content.GetValueForProperty("ArcAutoProvisioningEnabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesAwsOfferingInternal)this).ArcAutoProvisioningEnabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ArcAutoProvisioningCloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesAwsOfferingInternal)this).ArcAutoProvisioningCloudRoleArn = (string) content.GetValueForProperty("ArcAutoProvisioningCloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesAwsOfferingInternal)this).ArcAutoProvisioningCloudRoleArn, global::System.Convert.ToString); + } + if (content.Contains("RdEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesAwsOfferingInternal)this).RdEnabled = (bool?) content.GetValueForProperty("RdEnabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesAwsOfferingInternal)this).RdEnabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("RdCloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesAwsOfferingInternal)this).RdCloudRoleArn = (string) content.GetValueForProperty("RdCloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesAwsOfferingInternal)this).RdCloudRoleArn, global::System.Convert.ToString); + } + if (content.Contains("DatabaseDspmEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesAwsOfferingInternal)this).DatabaseDspmEnabled = (bool?) content.GetValueForProperty("DatabaseDspmEnabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesAwsOfferingInternal)this).DatabaseDspmEnabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("DatabaseDspmCloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesAwsOfferingInternal)this).DatabaseDspmCloudRoleArn = (string) content.GetValueForProperty("DatabaseDspmCloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesAwsOfferingInternal)this).DatabaseDspmCloudRoleArn, global::System.Convert.ToString); + } + if (content.Contains("ConfigurationProxy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesAwsOfferingInternal)this).ConfigurationProxy = (string) content.GetValueForProperty("ConfigurationProxy",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesAwsOfferingInternal)this).ConfigurationProxy, global::System.Convert.ToString); + } + if (content.Contains("ConfigurationPrivateLinkScope")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesAwsOfferingInternal)this).ConfigurationPrivateLinkScope = (string) content.GetValueForProperty("ConfigurationPrivateLinkScope",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesAwsOfferingInternal)this).ConfigurationPrivateLinkScope, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesAwsOffering DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DefenderForDatabasesAwsOffering(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesAwsOffering DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DefenderForDatabasesAwsOffering(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesAwsOffering FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The Defender for Databases AWS offering + [System.ComponentModel.TypeConverter(typeof(DefenderForDatabasesAwsOfferingTypeConverter))] + public partial interface IDefenderForDatabasesAwsOffering + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForDatabasesAwsOffering.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForDatabasesAwsOffering.TypeConverter.cs new file mode 100644 index 000000000000..15f03803af20 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForDatabasesAwsOffering.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DefenderForDatabasesAwsOfferingTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesAwsOffering ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesAwsOffering).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DefenderForDatabasesAwsOffering.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DefenderForDatabasesAwsOffering.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DefenderForDatabasesAwsOffering.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForDatabasesAwsOffering.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForDatabasesAwsOffering.cs new file mode 100644 index 000000000000..6edc9de3d3f5 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForDatabasesAwsOffering.cs @@ -0,0 +1,241 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The Defender for Databases AWS offering + public partial class DefenderForDatabasesAwsOffering : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesAwsOffering, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesAwsOfferingInternal, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOffering __cloudOffering = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CloudOffering(); + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioning _arcAutoProvisioning; + + /// The ARC autoprovisioning configuration + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioning ArcAutoProvisioning { get => (this._arcAutoProvisioning = this._arcAutoProvisioning ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderFoDatabasesAwsOfferingArcAutoProvisioning()); set => this._arcAutoProvisioning = value; } + + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string ArcAutoProvisioningCloudRoleArn { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioningInternal)ArcAutoProvisioning).CloudRoleArn; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioningInternal)ArcAutoProvisioning).CloudRoleArn = value ?? null; } + + /// Is arc auto provisioning enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public bool? ArcAutoProvisioningEnabled { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioningInternal)ArcAutoProvisioning).Enabled; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioningInternal)ArcAutoProvisioning).Enabled = value ?? default(bool); } + + /// Optional Arc private link scope resource id to link the Arc agent + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string ConfigurationPrivateLinkScope { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioningInternal)ArcAutoProvisioning).ConfigurationPrivateLinkScope; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioningInternal)ArcAutoProvisioning).ConfigurationPrivateLinkScope = value ?? null; } + + /// Optional http proxy endpoint to use for the Arc agent + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string ConfigurationProxy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioningInternal)ArcAutoProvisioning).ConfigurationProxy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioningInternal)ArcAutoProvisioning).ConfigurationProxy = value ?? null; } + + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string DatabaseDspmCloudRoleArn { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingDatabasesDspmInternal)DatabasesDspm).CloudRoleArn; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingDatabasesDspmInternal)DatabasesDspm).CloudRoleArn = value ?? null; } + + /// Is databases data security posture management (DSPM) protection enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public bool? DatabaseDspmEnabled { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingDatabasesDspmInternal)DatabasesDspm).Enabled; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingDatabasesDspmInternal)DatabasesDspm).Enabled = value ?? default(bool); } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingDatabasesDspm _databasesDspm; + + /// The databases data security posture management (DSPM) configuration + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingDatabasesDspm DatabasesDspm { get => (this._databasesDspm = this._databasesDspm ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderFoDatabasesAwsOfferingDatabasesDspm()); set => this._databasesDspm = value; } + + /// The offering description. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string Description { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)__cloudOffering).Description; } + + /// Internal Acessors for Description + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal.Description { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)__cloudOffering).Description; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)__cloudOffering).Description = value; } + + /// Internal Acessors for ArcAutoProvisioning + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioning Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesAwsOfferingInternal.ArcAutoProvisioning { get => (this._arcAutoProvisioning = this._arcAutoProvisioning ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderFoDatabasesAwsOfferingArcAutoProvisioning()); set { {_arcAutoProvisioning = value;} } } + + /// Internal Acessors for ArcAutoProvisioningConfiguration + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioningConfiguration Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesAwsOfferingInternal.ArcAutoProvisioningConfiguration { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioningInternal)ArcAutoProvisioning).Configuration; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioningInternal)ArcAutoProvisioning).Configuration = value; } + + /// Internal Acessors for DatabasesDspm + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingDatabasesDspm Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesAwsOfferingInternal.DatabasesDspm { get => (this._databasesDspm = this._databasesDspm ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderFoDatabasesAwsOfferingDatabasesDspm()); set { {_databasesDspm = value;} } } + + /// Internal Acessors for Rd + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingRds Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesAwsOfferingInternal.Rd { get => (this._rd = this._rd ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderFoDatabasesAwsOfferingRds()); set { {_rd = value;} } } + + /// The type of the security offering. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Constant] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string OfferingType { get => "DefenderForDatabasesAws"; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)__cloudOffering).OfferingType = "DefenderForDatabasesAws"; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingRds _rd; + + /// The RDS configuration + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingRds Rd { get => (this._rd = this._rd ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderFoDatabasesAwsOfferingRds()); set => this._rd = value; } + + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string RdCloudRoleArn { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingRdsInternal)Rd).CloudRoleArn; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingRdsInternal)Rd).CloudRoleArn = value ?? null; } + + /// Is RDS protection enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public bool? RdEnabled { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingRdsInternal)Rd).Enabled; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingRdsInternal)Rd).Enabled = value ?? default(bool); } + + /// Creates an new instance. + public DefenderForDatabasesAwsOffering() + { + this.__cloudOffering.OfferingType = "DefenderForDatabasesAws"; + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__cloudOffering), __cloudOffering); + await eventListener.AssertObjectIsValid(nameof(__cloudOffering), __cloudOffering); + } + } + /// The Defender for Databases AWS offering + public partial interface IDefenderForDatabasesAwsOffering : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOffering + { + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The cloud role ARN in AWS for this feature", + SerializedName = @"cloudRoleArn", + PossibleTypes = new [] { typeof(string) })] + string ArcAutoProvisioningCloudRoleArn { get; set; } + /// Is arc auto provisioning enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Is arc auto provisioning enabled", + SerializedName = @"enabled", + PossibleTypes = new [] { typeof(bool) })] + bool? ArcAutoProvisioningEnabled { get; set; } + /// Optional Arc private link scope resource id to link the Arc agent + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Optional Arc private link scope resource id to link the Arc agent", + SerializedName = @"privateLinkScope", + PossibleTypes = new [] { typeof(string) })] + string ConfigurationPrivateLinkScope { get; set; } + /// Optional http proxy endpoint to use for the Arc agent + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Optional http proxy endpoint to use for the Arc agent", + SerializedName = @"proxy", + PossibleTypes = new [] { typeof(string) })] + string ConfigurationProxy { get; set; } + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The cloud role ARN in AWS for this feature", + SerializedName = @"cloudRoleArn", + PossibleTypes = new [] { typeof(string) })] + string DatabaseDspmCloudRoleArn { get; set; } + /// Is databases data security posture management (DSPM) protection enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Is databases data security posture management (DSPM) protection enabled", + SerializedName = @"enabled", + PossibleTypes = new [] { typeof(bool) })] + bool? DatabaseDspmEnabled { get; set; } + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The cloud role ARN in AWS for this feature", + SerializedName = @"cloudRoleArn", + PossibleTypes = new [] { typeof(string) })] + string RdCloudRoleArn { get; set; } + /// Is RDS protection enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Is RDS protection enabled", + SerializedName = @"enabled", + PossibleTypes = new [] { typeof(bool) })] + bool? RdEnabled { get; set; } + + } + /// The Defender for Databases AWS offering + internal partial interface IDefenderForDatabasesAwsOfferingInternal : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal + { + /// The ARC autoprovisioning configuration + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioning ArcAutoProvisioning { get; set; } + /// The cloud role ARN in AWS for this feature + string ArcAutoProvisioningCloudRoleArn { get; set; } + /// Configuration for servers Arc auto provisioning + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingArcAutoProvisioningConfiguration ArcAutoProvisioningConfiguration { get; set; } + /// Is arc auto provisioning enabled + bool? ArcAutoProvisioningEnabled { get; set; } + /// Optional Arc private link scope resource id to link the Arc agent + string ConfigurationPrivateLinkScope { get; set; } + /// Optional http proxy endpoint to use for the Arc agent + string ConfigurationProxy { get; set; } + /// The cloud role ARN in AWS for this feature + string DatabaseDspmCloudRoleArn { get; set; } + /// Is databases data security posture management (DSPM) protection enabled + bool? DatabaseDspmEnabled { get; set; } + /// The databases data security posture management (DSPM) configuration + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingDatabasesDspm DatabasesDspm { get; set; } + /// The RDS configuration + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderFoDatabasesAwsOfferingRds Rd { get; set; } + /// The cloud role ARN in AWS for this feature + string RdCloudRoleArn { get; set; } + /// Is RDS protection enabled + bool? RdEnabled { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForDatabasesAwsOffering.json.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForDatabasesAwsOffering.json.cs new file mode 100644 index 000000000000..9a8cf34b3142 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForDatabasesAwsOffering.json.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The Defender for Databases AWS offering + public partial class DefenderForDatabasesAwsOffering + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal DefenderForDatabasesAwsOffering(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __cloudOffering = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CloudOffering(json); + {_arcAutoProvisioning = If( json?.PropertyT("arcAutoProvisioning"), out var __jsonArcAutoProvisioning) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderFoDatabasesAwsOfferingArcAutoProvisioning.FromJson(__jsonArcAutoProvisioning) : _arcAutoProvisioning;} + {_rd = If( json?.PropertyT("rds"), out var __jsonRds) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderFoDatabasesAwsOfferingRds.FromJson(__jsonRds) : _rd;} + {_databasesDspm = If( json?.PropertyT("databasesDspm"), out var __jsonDatabasesDspm) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderFoDatabasesAwsOfferingDatabasesDspm.FromJson(__jsonDatabasesDspm) : _databasesDspm;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesAwsOffering. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesAwsOffering. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesAwsOffering FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DefenderForDatabasesAwsOffering(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __cloudOffering?.ToJson(container, serializationMode); + AddIf( null != this._arcAutoProvisioning ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._arcAutoProvisioning.ToJson(null,serializationMode) : null, "arcAutoProvisioning" ,container.Add ); + AddIf( null != this._rd ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._rd.ToJson(null,serializationMode) : null, "rds" ,container.Add ); + AddIf( null != this._databasesDspm ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._databasesDspm.ToJson(null,serializationMode) : null, "databasesDspm" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForDatabasesGcpOffering.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForDatabasesGcpOffering.PowerShell.cs new file mode 100644 index 000000000000..35cf97ee6531 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForDatabasesGcpOffering.PowerShell.cs @@ -0,0 +1,236 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The Defender for Databases GCP offering configurations + [System.ComponentModel.TypeConverter(typeof(DefenderForDatabasesGcpOfferingTypeConverter))] + public partial class DefenderForDatabasesGcpOffering + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DefenderForDatabasesGcpOffering(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ArcAutoProvisioning")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingInternal)this).ArcAutoProvisioning = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioning) content.GetValueForProperty("ArcAutoProvisioning",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingInternal)this).ArcAutoProvisioning, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForDatabasesGcpOfferingArcAutoProvisioningTypeConverter.ConvertFrom); + } + if (content.Contains("DefenderForDatabasesArcAutoProvisioning")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingInternal)this).DefenderForDatabasesArcAutoProvisioning = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning) content.GetValueForProperty("DefenderForDatabasesArcAutoProvisioning",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingInternal)this).DefenderForDatabasesArcAutoProvisioning, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioningTypeConverter.ConvertFrom); + } + if (content.Contains("OfferingType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType = (string) content.GetValueForProperty("OfferingType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType, global::System.Convert.ToString); + } + if (content.Contains("Description")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description, global::System.Convert.ToString); + } + if (content.Contains("ArcAutoProvisioningConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingInternal)this).ArcAutoProvisioningConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration) content.GetValueForProperty("ArcAutoProvisioningConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingInternal)this).ArcAutoProvisioningConfiguration, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForDatabasesGcpOfferingArcAutoProvisioningConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("ArcAutoProvisioningEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingInternal)this).ArcAutoProvisioningEnabled = (bool?) content.GetValueForProperty("ArcAutoProvisioningEnabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingInternal)this).ArcAutoProvisioningEnabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("DefenderForDatabaseArcAutoProvisioningServiceAccountEmailAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingInternal)this).DefenderForDatabaseArcAutoProvisioningServiceAccountEmailAddress = (string) content.GetValueForProperty("DefenderForDatabaseArcAutoProvisioningServiceAccountEmailAddress",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingInternal)this).DefenderForDatabaseArcAutoProvisioningServiceAccountEmailAddress, global::System.Convert.ToString); + } + if (content.Contains("DefenderForDatabaseArcAutoProvisioningWorkloadIdentityProviderId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingInternal)this).DefenderForDatabaseArcAutoProvisioningWorkloadIdentityProviderId = (string) content.GetValueForProperty("DefenderForDatabaseArcAutoProvisioningWorkloadIdentityProviderId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingInternal)this).DefenderForDatabaseArcAutoProvisioningWorkloadIdentityProviderId, global::System.Convert.ToString); + } + if (content.Contains("ConfigurationProxy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingInternal)this).ConfigurationProxy = (string) content.GetValueForProperty("ConfigurationProxy",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingInternal)this).ConfigurationProxy, global::System.Convert.ToString); + } + if (content.Contains("ConfigurationPrivateLinkScope")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingInternal)this).ConfigurationPrivateLinkScope = (string) content.GetValueForProperty("ConfigurationPrivateLinkScope",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingInternal)this).ConfigurationPrivateLinkScope, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DefenderForDatabasesGcpOffering(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ArcAutoProvisioning")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingInternal)this).ArcAutoProvisioning = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioning) content.GetValueForProperty("ArcAutoProvisioning",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingInternal)this).ArcAutoProvisioning, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForDatabasesGcpOfferingArcAutoProvisioningTypeConverter.ConvertFrom); + } + if (content.Contains("DefenderForDatabasesArcAutoProvisioning")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingInternal)this).DefenderForDatabasesArcAutoProvisioning = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning) content.GetValueForProperty("DefenderForDatabasesArcAutoProvisioning",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingInternal)this).DefenderForDatabasesArcAutoProvisioning, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioningTypeConverter.ConvertFrom); + } + if (content.Contains("OfferingType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType = (string) content.GetValueForProperty("OfferingType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType, global::System.Convert.ToString); + } + if (content.Contains("Description")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description, global::System.Convert.ToString); + } + if (content.Contains("ArcAutoProvisioningConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingInternal)this).ArcAutoProvisioningConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration) content.GetValueForProperty("ArcAutoProvisioningConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingInternal)this).ArcAutoProvisioningConfiguration, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForDatabasesGcpOfferingArcAutoProvisioningConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("ArcAutoProvisioningEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingInternal)this).ArcAutoProvisioningEnabled = (bool?) content.GetValueForProperty("ArcAutoProvisioningEnabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingInternal)this).ArcAutoProvisioningEnabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("DefenderForDatabaseArcAutoProvisioningServiceAccountEmailAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingInternal)this).DefenderForDatabaseArcAutoProvisioningServiceAccountEmailAddress = (string) content.GetValueForProperty("DefenderForDatabaseArcAutoProvisioningServiceAccountEmailAddress",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingInternal)this).DefenderForDatabaseArcAutoProvisioningServiceAccountEmailAddress, global::System.Convert.ToString); + } + if (content.Contains("DefenderForDatabaseArcAutoProvisioningWorkloadIdentityProviderId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingInternal)this).DefenderForDatabaseArcAutoProvisioningWorkloadIdentityProviderId = (string) content.GetValueForProperty("DefenderForDatabaseArcAutoProvisioningWorkloadIdentityProviderId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingInternal)this).DefenderForDatabaseArcAutoProvisioningWorkloadIdentityProviderId, global::System.Convert.ToString); + } + if (content.Contains("ConfigurationProxy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingInternal)this).ConfigurationProxy = (string) content.GetValueForProperty("ConfigurationProxy",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingInternal)this).ConfigurationProxy, global::System.Convert.ToString); + } + if (content.Contains("ConfigurationPrivateLinkScope")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingInternal)this).ConfigurationPrivateLinkScope = (string) content.GetValueForProperty("ConfigurationPrivateLinkScope",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingInternal)this).ConfigurationPrivateLinkScope, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOffering DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DefenderForDatabasesGcpOffering(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOffering DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DefenderForDatabasesGcpOffering(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOffering FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The Defender for Databases GCP offering configurations + [System.ComponentModel.TypeConverter(typeof(DefenderForDatabasesGcpOfferingTypeConverter))] + public partial interface IDefenderForDatabasesGcpOffering + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForDatabasesGcpOffering.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForDatabasesGcpOffering.TypeConverter.cs new file mode 100644 index 000000000000..16c0a3583f10 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForDatabasesGcpOffering.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DefenderForDatabasesGcpOfferingTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOffering ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOffering).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DefenderForDatabasesGcpOffering.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DefenderForDatabasesGcpOffering.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DefenderForDatabasesGcpOffering.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForDatabasesGcpOffering.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForDatabasesGcpOffering.cs new file mode 100644 index 000000000000..374cf8afdbd4 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForDatabasesGcpOffering.cs @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The Defender for Databases GCP offering configurations + public partial class DefenderForDatabasesGcpOffering : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOffering, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingInternal, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOffering __cloudOffering = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CloudOffering(); + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioning _arcAutoProvisioning; + + /// The ARC autoprovisioning configuration + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioning ArcAutoProvisioning { get => (this._arcAutoProvisioning = this._arcAutoProvisioning ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForDatabasesGcpOfferingArcAutoProvisioning()); set => this._arcAutoProvisioning = value; } + + /// Is arc auto provisioning enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public bool? ArcAutoProvisioningEnabled { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioningInternal)ArcAutoProvisioning).Enabled; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioningInternal)ArcAutoProvisioning).Enabled = value ?? default(bool); } + + /// Optional Arc private link scope resource id to link the Arc agent + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string ConfigurationPrivateLinkScope { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioningInternal)ArcAutoProvisioning).ConfigurationPrivateLinkScope; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioningInternal)ArcAutoProvisioning).ConfigurationPrivateLinkScope = value ?? null; } + + /// Optional http proxy endpoint to use for the Arc agent + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string ConfigurationProxy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioningInternal)ArcAutoProvisioning).ConfigurationProxy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioningInternal)ArcAutoProvisioning).ConfigurationProxy = value ?? null; } + + /// The service account email address in GCP for this offering + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string DefenderForDatabaseArcAutoProvisioningServiceAccountEmailAddress { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioningInternal)DefenderForDatabasesArcAutoProvisioning).ServiceAccountEmailAddress; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioningInternal)DefenderForDatabasesArcAutoProvisioning).ServiceAccountEmailAddress = value ?? null; } + + /// The GCP workload identity provider id for this offering + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string DefenderForDatabaseArcAutoProvisioningWorkloadIdentityProviderId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioningInternal)DefenderForDatabasesArcAutoProvisioning).WorkloadIdentityProviderId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioningInternal)DefenderForDatabasesArcAutoProvisioning).WorkloadIdentityProviderId = value ?? null; } + + /// + /// Backing field for property. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning _defenderForDatabasesArcAutoProvisioning; + + /// The native cloud connection configuration + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning DefenderForDatabasesArcAutoProvisioning { get => (this._defenderForDatabasesArcAutoProvisioning = this._defenderForDatabasesArcAutoProvisioning ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning()); set => this._defenderForDatabasesArcAutoProvisioning = value; } + + /// The offering description. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string Description { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)__cloudOffering).Description; } + + /// Internal Acessors for Description + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal.Description { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)__cloudOffering).Description; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)__cloudOffering).Description = value; } + + /// Internal Acessors for ArcAutoProvisioning + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioning Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingInternal.ArcAutoProvisioning { get => (this._arcAutoProvisioning = this._arcAutoProvisioning ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForDatabasesGcpOfferingArcAutoProvisioning()); set { {_arcAutoProvisioning = value;} } } + + /// Internal Acessors for ArcAutoProvisioningConfiguration + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingInternal.ArcAutoProvisioningConfiguration { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioningInternal)ArcAutoProvisioning).Configuration; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioningInternal)ArcAutoProvisioning).Configuration = value; } + + /// Internal Acessors for DefenderForDatabasesArcAutoProvisioning + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingInternal.DefenderForDatabasesArcAutoProvisioning { get => (this._defenderForDatabasesArcAutoProvisioning = this._defenderForDatabasesArcAutoProvisioning ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning()); set { {_defenderForDatabasesArcAutoProvisioning = value;} } } + + /// The type of the security offering. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Constant] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string OfferingType { get => "DefenderForDatabasesGcp"; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)__cloudOffering).OfferingType = "DefenderForDatabasesGcp"; } + + /// Creates an new instance. + public DefenderForDatabasesGcpOffering() + { + this.__cloudOffering.OfferingType = "DefenderForDatabasesGcp"; + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__cloudOffering), __cloudOffering); + await eventListener.AssertObjectIsValid(nameof(__cloudOffering), __cloudOffering); + } + } + /// The Defender for Databases GCP offering configurations + public partial interface IDefenderForDatabasesGcpOffering : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOffering + { + /// Is arc auto provisioning enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Is arc auto provisioning enabled", + SerializedName = @"enabled", + PossibleTypes = new [] { typeof(bool) })] + bool? ArcAutoProvisioningEnabled { get; set; } + /// Optional Arc private link scope resource id to link the Arc agent + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Optional Arc private link scope resource id to link the Arc agent", + SerializedName = @"privateLinkScope", + PossibleTypes = new [] { typeof(string) })] + string ConfigurationPrivateLinkScope { get; set; } + /// Optional http proxy endpoint to use for the Arc agent + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Optional http proxy endpoint to use for the Arc agent", + SerializedName = @"proxy", + PossibleTypes = new [] { typeof(string) })] + string ConfigurationProxy { get; set; } + /// The service account email address in GCP for this offering + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The service account email address in GCP for this offering", + SerializedName = @"serviceAccountEmailAddress", + PossibleTypes = new [] { typeof(string) })] + string DefenderForDatabaseArcAutoProvisioningServiceAccountEmailAddress { get; set; } + /// The GCP workload identity provider id for this offering + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The GCP workload identity provider id for this offering", + SerializedName = @"workloadIdentityProviderId", + PossibleTypes = new [] { typeof(string) })] + string DefenderForDatabaseArcAutoProvisioningWorkloadIdentityProviderId { get; set; } + + } + /// The Defender for Databases GCP offering configurations + internal partial interface IDefenderForDatabasesGcpOfferingInternal : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal + { + /// The ARC autoprovisioning configuration + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioning ArcAutoProvisioning { get; set; } + /// Configuration for servers Arc auto provisioning + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration ArcAutoProvisioningConfiguration { get; set; } + /// Is arc auto provisioning enabled + bool? ArcAutoProvisioningEnabled { get; set; } + /// Optional Arc private link scope resource id to link the Arc agent + string ConfigurationPrivateLinkScope { get; set; } + /// Optional http proxy endpoint to use for the Arc agent + string ConfigurationProxy { get; set; } + /// The service account email address in GCP for this offering + string DefenderForDatabaseArcAutoProvisioningServiceAccountEmailAddress { get; set; } + /// The GCP workload identity provider id for this offering + string DefenderForDatabaseArcAutoProvisioningWorkloadIdentityProviderId { get; set; } + /// The native cloud connection configuration + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning DefenderForDatabasesArcAutoProvisioning { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForDatabasesGcpOffering.json.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForDatabasesGcpOffering.json.cs new file mode 100644 index 000000000000..2822e472e4f4 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForDatabasesGcpOffering.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The Defender for Databases GCP offering configurations + public partial class DefenderForDatabasesGcpOffering + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal DefenderForDatabasesGcpOffering(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __cloudOffering = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CloudOffering(json); + {_arcAutoProvisioning = If( json?.PropertyT("arcAutoProvisioning"), out var __jsonArcAutoProvisioning) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForDatabasesGcpOfferingArcAutoProvisioning.FromJson(__jsonArcAutoProvisioning) : _arcAutoProvisioning;} + {_defenderForDatabasesArcAutoProvisioning = If( json?.PropertyT("defenderForDatabasesArcAutoProvisioning"), out var __jsonDefenderForDatabasesArcAutoProvisioning) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning.FromJson(__jsonDefenderForDatabasesArcAutoProvisioning) : _defenderForDatabasesArcAutoProvisioning;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOffering. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOffering. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOffering FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DefenderForDatabasesGcpOffering(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __cloudOffering?.ToJson(container, serializationMode); + AddIf( null != this._arcAutoProvisioning ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._arcAutoProvisioning.ToJson(null,serializationMode) : null, "arcAutoProvisioning" ,container.Add ); + AddIf( null != this._defenderForDatabasesArcAutoProvisioning ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._defenderForDatabasesArcAutoProvisioning.ToJson(null,serializationMode) : null, "defenderForDatabasesArcAutoProvisioning" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForDatabasesGcpOfferingArcAutoProvisioning.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForDatabasesGcpOfferingArcAutoProvisioning.PowerShell.cs new file mode 100644 index 000000000000..1090ed50dc59 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForDatabasesGcpOfferingArcAutoProvisioning.PowerShell.cs @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The ARC autoprovisioning configuration + [System.ComponentModel.TypeConverter(typeof(DefenderForDatabasesGcpOfferingArcAutoProvisioningTypeConverter))] + public partial class DefenderForDatabasesGcpOfferingArcAutoProvisioning + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DefenderForDatabasesGcpOfferingArcAutoProvisioning(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Configuration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioningInternal)this).Configuration = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration) content.GetValueForProperty("Configuration",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioningInternal)this).Configuration, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForDatabasesGcpOfferingArcAutoProvisioningConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("Enabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioningInternal)this).Enabled = (bool?) content.GetValueForProperty("Enabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioningInternal)this).Enabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ConfigurationProxy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioningInternal)this).ConfigurationProxy = (string) content.GetValueForProperty("ConfigurationProxy",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioningInternal)this).ConfigurationProxy, global::System.Convert.ToString); + } + if (content.Contains("ConfigurationPrivateLinkScope")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioningInternal)this).ConfigurationPrivateLinkScope = (string) content.GetValueForProperty("ConfigurationPrivateLinkScope",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioningInternal)this).ConfigurationPrivateLinkScope, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DefenderForDatabasesGcpOfferingArcAutoProvisioning(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Configuration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioningInternal)this).Configuration = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration) content.GetValueForProperty("Configuration",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioningInternal)this).Configuration, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForDatabasesGcpOfferingArcAutoProvisioningConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("Enabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioningInternal)this).Enabled = (bool?) content.GetValueForProperty("Enabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioningInternal)this).Enabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ConfigurationProxy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioningInternal)this).ConfigurationProxy = (string) content.GetValueForProperty("ConfigurationProxy",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioningInternal)this).ConfigurationProxy, global::System.Convert.ToString); + } + if (content.Contains("ConfigurationPrivateLinkScope")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioningInternal)this).ConfigurationPrivateLinkScope = (string) content.GetValueForProperty("ConfigurationPrivateLinkScope",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioningInternal)this).ConfigurationPrivateLinkScope, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioning DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DefenderForDatabasesGcpOfferingArcAutoProvisioning(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioning DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DefenderForDatabasesGcpOfferingArcAutoProvisioning(content); + } + + /// + /// Creates a new instance of , deserializing the content + /// from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioning FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The ARC autoprovisioning configuration + [System.ComponentModel.TypeConverter(typeof(DefenderForDatabasesGcpOfferingArcAutoProvisioningTypeConverter))] + public partial interface IDefenderForDatabasesGcpOfferingArcAutoProvisioning + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForDatabasesGcpOfferingArcAutoProvisioning.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForDatabasesGcpOfferingArcAutoProvisioning.TypeConverter.cs new file mode 100644 index 000000000000..140a971eb1d0 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForDatabasesGcpOfferingArcAutoProvisioning.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DefenderForDatabasesGcpOfferingArcAutoProvisioningTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a + /// type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioning ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioning).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DefenderForDatabasesGcpOfferingArcAutoProvisioning.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DefenderForDatabasesGcpOfferingArcAutoProvisioning.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DefenderForDatabasesGcpOfferingArcAutoProvisioning.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForDatabasesGcpOfferingArcAutoProvisioning.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForDatabasesGcpOfferingArcAutoProvisioning.cs new file mode 100644 index 000000000000..c92200062dcd --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForDatabasesGcpOfferingArcAutoProvisioning.cs @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The ARC autoprovisioning configuration + public partial class DefenderForDatabasesGcpOfferingArcAutoProvisioning : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioning, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioningInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration _configuration; + + /// Configuration for servers Arc auto provisioning + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration Configuration { get => (this._configuration = this._configuration ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration()); set => this._configuration = value; } + + /// Optional Arc private link scope resource id to link the Arc agent + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string ConfigurationPrivateLinkScope { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioningConfigurationInternal)Configuration).PrivateLinkScope; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioningConfigurationInternal)Configuration).PrivateLinkScope = value ?? null; } + + /// Optional http proxy endpoint to use for the Arc agent + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string ConfigurationProxy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioningConfigurationInternal)Configuration).Proxy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioningConfigurationInternal)Configuration).Proxy = value ?? null; } + + /// Backing field for property. + private bool? _enabled; + + /// Is arc auto provisioning enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public bool? Enabled { get => this._enabled; set => this._enabled = value; } + + /// Internal Acessors for Configuration + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioningInternal.Configuration { get => (this._configuration = this._configuration ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration()); set { {_configuration = value;} } } + + /// + /// Creates an new instance. + /// + public DefenderForDatabasesGcpOfferingArcAutoProvisioning() + { + + } + } + /// The ARC autoprovisioning configuration + public partial interface IDefenderForDatabasesGcpOfferingArcAutoProvisioning : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// Optional Arc private link scope resource id to link the Arc agent + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Optional Arc private link scope resource id to link the Arc agent", + SerializedName = @"privateLinkScope", + PossibleTypes = new [] { typeof(string) })] + string ConfigurationPrivateLinkScope { get; set; } + /// Optional http proxy endpoint to use for the Arc agent + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Optional http proxy endpoint to use for the Arc agent", + SerializedName = @"proxy", + PossibleTypes = new [] { typeof(string) })] + string ConfigurationProxy { get; set; } + /// Is arc auto provisioning enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Is arc auto provisioning enabled", + SerializedName = @"enabled", + PossibleTypes = new [] { typeof(bool) })] + bool? Enabled { get; set; } + + } + /// The ARC autoprovisioning configuration + internal partial interface IDefenderForDatabasesGcpOfferingArcAutoProvisioningInternal + + { + /// Configuration for servers Arc auto provisioning + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration Configuration { get; set; } + /// Optional Arc private link scope resource id to link the Arc agent + string ConfigurationPrivateLinkScope { get; set; } + /// Optional http proxy endpoint to use for the Arc agent + string ConfigurationProxy { get; set; } + /// Is arc auto provisioning enabled + bool? Enabled { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForDatabasesGcpOfferingArcAutoProvisioning.json.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForDatabasesGcpOfferingArcAutoProvisioning.json.cs new file mode 100644 index 000000000000..d35e99864fe8 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForDatabasesGcpOfferingArcAutoProvisioning.json.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The ARC autoprovisioning configuration + public partial class DefenderForDatabasesGcpOfferingArcAutoProvisioning + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal DefenderForDatabasesGcpOfferingArcAutoProvisioning(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_configuration = If( json?.PropertyT("configuration"), out var __jsonConfiguration) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration.FromJson(__jsonConfiguration) : _configuration;} + {_enabled = If( json?.PropertyT("enabled"), out var __jsonEnabled) ? (bool?)__jsonEnabled : _enabled;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioning. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioning. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioning FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DefenderForDatabasesGcpOfferingArcAutoProvisioning(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._configuration ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._configuration.ToJson(null,serializationMode) : null, "configuration" ,container.Add ); + AddIf( null != this._enabled ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonBoolean((bool)this._enabled) : null, "enabled" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration.PowerShell.cs new file mode 100644 index 000000000000..a8d7a319f365 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration.PowerShell.cs @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// Configuration for servers Arc auto provisioning + [System.ComponentModel.TypeConverter(typeof(DefenderForDatabasesGcpOfferingArcAutoProvisioningConfigurationTypeConverter))] + public partial class DefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Proxy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioningConfigurationInternal)this).Proxy = (string) content.GetValueForProperty("Proxy",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioningConfigurationInternal)this).Proxy, global::System.Convert.ToString); + } + if (content.Contains("PrivateLinkScope")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioningConfigurationInternal)this).PrivateLinkScope = (string) content.GetValueForProperty("PrivateLinkScope",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioningConfigurationInternal)this).PrivateLinkScope, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Proxy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioningConfigurationInternal)this).Proxy = (string) content.GetValueForProperty("Proxy",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioningConfigurationInternal)this).Proxy, global::System.Convert.ToString); + } + if (content.Contains("PrivateLinkScope")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioningConfigurationInternal)this).PrivateLinkScope = (string) content.GetValueForProperty("PrivateLinkScope",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioningConfigurationInternal)this).PrivateLinkScope, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration(content); + } + + /// + /// Creates a new instance of , deserializing + /// the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// Configuration for servers Arc auto provisioning + [System.ComponentModel.TypeConverter(typeof(DefenderForDatabasesGcpOfferingArcAutoProvisioningConfigurationTypeConverter))] + public partial interface IDefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration.TypeConverter.cs new file mode 100644 index 000000000000..52331e1a1ae0 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DefenderForDatabasesGcpOfferingArcAutoProvisioningConfigurationTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there + /// is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there + /// is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration.cs new file mode 100644 index 000000000000..97f74633b282 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// Configuration for servers Arc auto provisioning + public partial class DefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioningConfigurationInternal + { + + /// Backing field for property. + private string _privateLinkScope; + + /// Optional Arc private link scope resource id to link the Arc agent + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string PrivateLinkScope { get => this._privateLinkScope; set => this._privateLinkScope = value; } + + /// Backing field for property. + private string _proxy; + + /// Optional http proxy endpoint to use for the Arc agent + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string Proxy { get => this._proxy; set => this._proxy = value; } + + /// + /// Creates an new instance. + /// + public DefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration() + { + + } + } + /// Configuration for servers Arc auto provisioning + public partial interface IDefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// Optional Arc private link scope resource id to link the Arc agent + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Optional Arc private link scope resource id to link the Arc agent", + SerializedName = @"privateLinkScope", + PossibleTypes = new [] { typeof(string) })] + string PrivateLinkScope { get; set; } + /// Optional http proxy endpoint to use for the Arc agent + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Optional http proxy endpoint to use for the Arc agent", + SerializedName = @"proxy", + PossibleTypes = new [] { typeof(string) })] + string Proxy { get; set; } + + } + /// Configuration for servers Arc auto provisioning + internal partial interface IDefenderForDatabasesGcpOfferingArcAutoProvisioningConfigurationInternal + + { + /// Optional Arc private link scope resource id to link the Arc agent + string PrivateLinkScope { get; set; } + /// Optional http proxy endpoint to use for the Arc agent + string Proxy { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration.json.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration.json.cs new file mode 100644 index 000000000000..d8f6004fdf55 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration.json.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// Configuration for servers Arc auto provisioning + public partial class DefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal DefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_proxy = If( json?.PropertyT("proxy"), out var __jsonProxy) ? (string)__jsonProxy : (string)_proxy;} + {_privateLinkScope = If( json?.PropertyT("privateLinkScope"), out var __jsonPrivateLinkScope) ? (string)__jsonPrivateLinkScope : (string)_privateLinkScope;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._proxy)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._proxy.ToString()) : null, "proxy" ,container.Add ); + AddIf( null != (((object)this._privateLinkScope)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._privateLinkScope.ToString()) : null, "privateLinkScope" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning.PowerShell.cs new file mode 100644 index 000000000000..55855ed4bb87 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning.PowerShell.cs @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The native cloud connection configuration + [System.ComponentModel.TypeConverter(typeof(DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioningTypeConverter))] + public partial class DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ServiceAccountEmailAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioningInternal)this).ServiceAccountEmailAddress = (string) content.GetValueForProperty("ServiceAccountEmailAddress",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioningInternal)this).ServiceAccountEmailAddress, global::System.Convert.ToString); + } + if (content.Contains("WorkloadIdentityProviderId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioningInternal)this).WorkloadIdentityProviderId = (string) content.GetValueForProperty("WorkloadIdentityProviderId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioningInternal)this).WorkloadIdentityProviderId, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ServiceAccountEmailAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioningInternal)this).ServiceAccountEmailAddress = (string) content.GetValueForProperty("ServiceAccountEmailAddress",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioningInternal)this).ServiceAccountEmailAddress, global::System.Convert.ToString); + } + if (content.Contains("WorkloadIdentityProviderId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioningInternal)this).WorkloadIdentityProviderId = (string) content.GetValueForProperty("WorkloadIdentityProviderId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioningInternal)this).WorkloadIdentityProviderId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning(content); + } + + /// + /// Creates a new instance of , deserializing + /// the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The native cloud connection configuration + [System.ComponentModel.TypeConverter(typeof(DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioningTypeConverter))] + public partial interface IDefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning.TypeConverter.cs new file mode 100644 index 000000000000..e435f2fc84bc --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioningTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if + /// there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if + /// there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning.cs new file mode 100644 index 000000000000..e6f7d595e4a4 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The native cloud connection configuration + public partial class DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioningInternal + { + + /// Backing field for property. + private string _serviceAccountEmailAddress; + + /// The service account email address in GCP for this offering + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string ServiceAccountEmailAddress { get => this._serviceAccountEmailAddress; set => this._serviceAccountEmailAddress = value; } + + /// Backing field for property. + private string _workloadIdentityProviderId; + + /// The GCP workload identity provider id for this offering + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string WorkloadIdentityProviderId { get => this._workloadIdentityProviderId; set => this._workloadIdentityProviderId = value; } + + /// + /// Creates an new instance. + /// + public DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning() + { + + } + } + /// The native cloud connection configuration + public partial interface IDefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// The service account email address in GCP for this offering + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The service account email address in GCP for this offering", + SerializedName = @"serviceAccountEmailAddress", + PossibleTypes = new [] { typeof(string) })] + string ServiceAccountEmailAddress { get; set; } + /// The GCP workload identity provider id for this offering + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The GCP workload identity provider id for this offering", + SerializedName = @"workloadIdentityProviderId", + PossibleTypes = new [] { typeof(string) })] + string WorkloadIdentityProviderId { get; set; } + + } + /// The native cloud connection configuration + internal partial interface IDefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioningInternal + + { + /// The service account email address in GCP for this offering + string ServiceAccountEmailAddress { get; set; } + /// The GCP workload identity provider id for this offering + string WorkloadIdentityProviderId { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning.json.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning.json.cs new file mode 100644 index 000000000000..76191a29eaa8 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning.json.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The native cloud connection configuration + public partial class DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_serviceAccountEmailAddress = If( json?.PropertyT("serviceAccountEmailAddress"), out var __jsonServiceAccountEmailAddress) ? (string)__jsonServiceAccountEmailAddress : (string)_serviceAccountEmailAddress;} + {_workloadIdentityProviderId = If( json?.PropertyT("workloadIdentityProviderId"), out var __jsonWorkloadIdentityProviderId) ? (string)__jsonWorkloadIdentityProviderId : (string)_workloadIdentityProviderId;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning(json) : null; + } + + /// + /// Serializes this instance of into + /// a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._serviceAccountEmailAddress)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._serviceAccountEmailAddress.ToString()) : null, "serviceAccountEmailAddress" ,container.Add ); + AddIf( null != (((object)this._workloadIdentityProviderId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._workloadIdentityProviderId.ToString()) : null, "workloadIdentityProviderId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForDevOpsAzureDevOpsOffering.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForDevOpsAzureDevOpsOffering.PowerShell.cs new file mode 100644 index 000000000000..1987db271c1e --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForDevOpsAzureDevOpsOffering.PowerShell.cs @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The Defender for DevOps for Azure DevOps offering + [System.ComponentModel.TypeConverter(typeof(DefenderForDevOpsAzureDevOpsOfferingTypeConverter))] + public partial class DefenderForDevOpsAzureDevOpsOffering + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DefenderForDevOpsAzureDevOpsOffering(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("OfferingType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType = (string) content.GetValueForProperty("OfferingType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType, global::System.Convert.ToString); + } + if (content.Contains("Description")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DefenderForDevOpsAzureDevOpsOffering(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("OfferingType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType = (string) content.GetValueForProperty("OfferingType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType, global::System.Convert.ToString); + } + if (content.Contains("Description")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDevOpsAzureDevOpsOffering DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DefenderForDevOpsAzureDevOpsOffering(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDevOpsAzureDevOpsOffering DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DefenderForDevOpsAzureDevOpsOffering(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDevOpsAzureDevOpsOffering FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The Defender for DevOps for Azure DevOps offering + [System.ComponentModel.TypeConverter(typeof(DefenderForDevOpsAzureDevOpsOfferingTypeConverter))] + public partial interface IDefenderForDevOpsAzureDevOpsOffering + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForDevOpsAzureDevOpsOffering.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForDevOpsAzureDevOpsOffering.TypeConverter.cs new file mode 100644 index 000000000000..e15fec414379 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForDevOpsAzureDevOpsOffering.TypeConverter.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DefenderForDevOpsAzureDevOpsOfferingTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDevOpsAzureDevOpsOffering ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDevOpsAzureDevOpsOffering).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DefenderForDevOpsAzureDevOpsOffering.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DefenderForDevOpsAzureDevOpsOffering.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DefenderForDevOpsAzureDevOpsOffering.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForDevOpsAzureDevOpsOffering.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForDevOpsAzureDevOpsOffering.cs new file mode 100644 index 000000000000..65e470ca376f --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForDevOpsAzureDevOpsOffering.cs @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The Defender for DevOps for Azure DevOps offering + public partial class DefenderForDevOpsAzureDevOpsOffering : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDevOpsAzureDevOpsOffering, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDevOpsAzureDevOpsOfferingInternal, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOffering __cloudOffering = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CloudOffering(); + + /// The offering description. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string Description { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)__cloudOffering).Description; } + + /// Internal Acessors for Description + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal.Description { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)__cloudOffering).Description; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)__cloudOffering).Description = value; } + + /// The type of the security offering. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Constant] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string OfferingType { get => "DefenderForDevOpsAzureDevOps"; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)__cloudOffering).OfferingType = "DefenderForDevOpsAzureDevOps"; } + + /// Creates an new instance. + public DefenderForDevOpsAzureDevOpsOffering() + { + this.__cloudOffering.OfferingType = "DefenderForDevOpsAzureDevOps"; + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__cloudOffering), __cloudOffering); + await eventListener.AssertObjectIsValid(nameof(__cloudOffering), __cloudOffering); + } + } + /// The Defender for DevOps for Azure DevOps offering + public partial interface IDefenderForDevOpsAzureDevOpsOffering : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOffering + { + + } + /// The Defender for DevOps for Azure DevOps offering + internal partial interface IDefenderForDevOpsAzureDevOpsOfferingInternal : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForDevOpsAzureDevOpsOffering.json.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForDevOpsAzureDevOpsOffering.json.cs new file mode 100644 index 000000000000..d76cd8d15f55 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForDevOpsAzureDevOpsOffering.json.cs @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The Defender for DevOps for Azure DevOps offering + public partial class DefenderForDevOpsAzureDevOpsOffering + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal DefenderForDevOpsAzureDevOpsOffering(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __cloudOffering = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CloudOffering(json); + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDevOpsAzureDevOpsOffering. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDevOpsAzureDevOpsOffering. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDevOpsAzureDevOpsOffering FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DefenderForDevOpsAzureDevOpsOffering(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __cloudOffering?.ToJson(container, serializationMode); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForDevOpsGitLabOffering.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForDevOpsGitLabOffering.PowerShell.cs new file mode 100644 index 000000000000..4479653ccbfd --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForDevOpsGitLabOffering.PowerShell.cs @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The Defender for DevOps for Gitlab offering + [System.ComponentModel.TypeConverter(typeof(DefenderForDevOpsGitLabOfferingTypeConverter))] + public partial class DefenderForDevOpsGitLabOffering + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DefenderForDevOpsGitLabOffering(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("OfferingType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType = (string) content.GetValueForProperty("OfferingType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType, global::System.Convert.ToString); + } + if (content.Contains("Description")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DefenderForDevOpsGitLabOffering(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("OfferingType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType = (string) content.GetValueForProperty("OfferingType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType, global::System.Convert.ToString); + } + if (content.Contains("Description")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDevOpsGitLabOffering DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DefenderForDevOpsGitLabOffering(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDevOpsGitLabOffering DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DefenderForDevOpsGitLabOffering(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDevOpsGitLabOffering FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The Defender for DevOps for Gitlab offering + [System.ComponentModel.TypeConverter(typeof(DefenderForDevOpsGitLabOfferingTypeConverter))] + public partial interface IDefenderForDevOpsGitLabOffering + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForDevOpsGitLabOffering.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForDevOpsGitLabOffering.TypeConverter.cs new file mode 100644 index 000000000000..f0fd61b52fe0 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForDevOpsGitLabOffering.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DefenderForDevOpsGitLabOfferingTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDevOpsGitLabOffering ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDevOpsGitLabOffering).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DefenderForDevOpsGitLabOffering.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DefenderForDevOpsGitLabOffering.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DefenderForDevOpsGitLabOffering.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForDevOpsGitLabOffering.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForDevOpsGitLabOffering.cs new file mode 100644 index 000000000000..a81e4a14514c --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForDevOpsGitLabOffering.cs @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The Defender for DevOps for Gitlab offering + public partial class DefenderForDevOpsGitLabOffering : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDevOpsGitLabOffering, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDevOpsGitLabOfferingInternal, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOffering __cloudOffering = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CloudOffering(); + + /// The offering description. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string Description { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)__cloudOffering).Description; } + + /// Internal Acessors for Description + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal.Description { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)__cloudOffering).Description; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)__cloudOffering).Description = value; } + + /// The type of the security offering. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Constant] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string OfferingType { get => "DefenderForDevOpsGitLab"; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)__cloudOffering).OfferingType = "DefenderForDevOpsGitLab"; } + + /// Creates an new instance. + public DefenderForDevOpsGitLabOffering() + { + this.__cloudOffering.OfferingType = "DefenderForDevOpsGitLab"; + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__cloudOffering), __cloudOffering); + await eventListener.AssertObjectIsValid(nameof(__cloudOffering), __cloudOffering); + } + } + /// The Defender for DevOps for Gitlab offering + public partial interface IDefenderForDevOpsGitLabOffering : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOffering + { + + } + /// The Defender for DevOps for Gitlab offering + internal partial interface IDefenderForDevOpsGitLabOfferingInternal : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForDevOpsGitLabOffering.json.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForDevOpsGitLabOffering.json.cs new file mode 100644 index 000000000000..212670c45a86 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForDevOpsGitLabOffering.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The Defender for DevOps for Gitlab offering + public partial class DefenderForDevOpsGitLabOffering + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal DefenderForDevOpsGitLabOffering(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __cloudOffering = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CloudOffering(json); + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDevOpsGitLabOffering. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDevOpsGitLabOffering. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDevOpsGitLabOffering FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DefenderForDevOpsGitLabOffering(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __cloudOffering?.ToJson(container, serializationMode); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForDevOpsGithubOffering.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForDevOpsGithubOffering.PowerShell.cs new file mode 100644 index 000000000000..75290e55cdc2 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForDevOpsGithubOffering.PowerShell.cs @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The Defender for DevOps for Github offering + [System.ComponentModel.TypeConverter(typeof(DefenderForDevOpsGithubOfferingTypeConverter))] + public partial class DefenderForDevOpsGithubOffering + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DefenderForDevOpsGithubOffering(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("OfferingType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType = (string) content.GetValueForProperty("OfferingType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType, global::System.Convert.ToString); + } + if (content.Contains("Description")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DefenderForDevOpsGithubOffering(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("OfferingType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType = (string) content.GetValueForProperty("OfferingType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType, global::System.Convert.ToString); + } + if (content.Contains("Description")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDevOpsGithubOffering DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DefenderForDevOpsGithubOffering(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDevOpsGithubOffering DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DefenderForDevOpsGithubOffering(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDevOpsGithubOffering FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The Defender for DevOps for Github offering + [System.ComponentModel.TypeConverter(typeof(DefenderForDevOpsGithubOfferingTypeConverter))] + public partial interface IDefenderForDevOpsGithubOffering + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForDevOpsGithubOffering.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForDevOpsGithubOffering.TypeConverter.cs new file mode 100644 index 000000000000..cbde230f4316 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForDevOpsGithubOffering.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DefenderForDevOpsGithubOfferingTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDevOpsGithubOffering ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDevOpsGithubOffering).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DefenderForDevOpsGithubOffering.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DefenderForDevOpsGithubOffering.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DefenderForDevOpsGithubOffering.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForDevOpsGithubOffering.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForDevOpsGithubOffering.cs new file mode 100644 index 000000000000..662b9d310db7 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForDevOpsGithubOffering.cs @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The Defender for DevOps for Github offering + public partial class DefenderForDevOpsGithubOffering : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDevOpsGithubOffering, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDevOpsGithubOfferingInternal, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOffering __cloudOffering = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CloudOffering(); + + /// The offering description. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string Description { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)__cloudOffering).Description; } + + /// Internal Acessors for Description + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal.Description { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)__cloudOffering).Description; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)__cloudOffering).Description = value; } + + /// The type of the security offering. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Constant] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string OfferingType { get => "DefenderForDevOpsGithub"; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)__cloudOffering).OfferingType = "DefenderForDevOpsGithub"; } + + /// Creates an new instance. + public DefenderForDevOpsGithubOffering() + { + this.__cloudOffering.OfferingType = "DefenderForDevOpsGithub"; + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__cloudOffering), __cloudOffering); + await eventListener.AssertObjectIsValid(nameof(__cloudOffering), __cloudOffering); + } + } + /// The Defender for DevOps for Github offering + public partial interface IDefenderForDevOpsGithubOffering : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOffering + { + + } + /// The Defender for DevOps for Github offering + internal partial interface IDefenderForDevOpsGithubOfferingInternal : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForDevOpsGithubOffering.json.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForDevOpsGithubOffering.json.cs new file mode 100644 index 000000000000..18f626ad9bad --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForDevOpsGithubOffering.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The Defender for DevOps for Github offering + public partial class DefenderForDevOpsGithubOffering + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal DefenderForDevOpsGithubOffering(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __cloudOffering = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CloudOffering(json); + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDevOpsGithubOffering. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDevOpsGithubOffering. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForDevOpsGithubOffering FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DefenderForDevOpsGithubOffering(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __cloudOffering?.ToJson(container, serializationMode); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOffering.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOffering.PowerShell.cs new file mode 100644 index 000000000000..a0a270fa6a1c --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOffering.PowerShell.cs @@ -0,0 +1,356 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The Defender for Servers AWS offering + [System.ComponentModel.TypeConverter(typeof(DefenderForServersAwsOfferingTypeConverter))] + public partial class DefenderForServersAwsOffering + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DefenderForServersAwsOffering(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DefenderForServer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).DefenderForServer = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingDefenderForServers) content.GetValueForProperty("DefenderForServer",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).DefenderForServer, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingDefenderForServersTypeConverter.ConvertFrom); + } + if (content.Contains("ArcAutoProvisioning")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).ArcAutoProvisioning = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioning) content.GetValueForProperty("ArcAutoProvisioning",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).ArcAutoProvisioning, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingArcAutoProvisioningTypeConverter.ConvertFrom); + } + if (content.Contains("VaAutoProvisioning")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).VaAutoProvisioning = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVaAutoProvisioning) content.GetValueForProperty("VaAutoProvisioning",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).VaAutoProvisioning, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingVaAutoProvisioningTypeConverter.ConvertFrom); + } + if (content.Contains("MdeAutoProvisioning")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).MdeAutoProvisioning = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingMdeAutoProvisioning) content.GetValueForProperty("MdeAutoProvisioning",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).MdeAutoProvisioning, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingMdeAutoProvisioningTypeConverter.ConvertFrom); + } + if (content.Contains("SubPlan")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).SubPlan = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingSubPlan) content.GetValueForProperty("SubPlan",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).SubPlan, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingSubPlanTypeConverter.ConvertFrom); + } + if (content.Contains("VMScanner")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).VMScanner = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScanners) content.GetValueForProperty("VMScanner",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).VMScanner, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingVMScannersTypeConverter.ConvertFrom); + } + if (content.Contains("OfferingType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType = (string) content.GetValueForProperty("OfferingType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType, global::System.Convert.ToString); + } + if (content.Contains("Description")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description, global::System.Convert.ToString); + } + if (content.Contains("SubPlanType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).SubPlanType = (string) content.GetValueForProperty("SubPlanType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).SubPlanType, global::System.Convert.ToString); + } + if (content.Contains("DefenderForServerCloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).DefenderForServerCloudRoleArn = (string) content.GetValueForProperty("DefenderForServerCloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).DefenderForServerCloudRoleArn, global::System.Convert.ToString); + } + if (content.Contains("ArcAutoProvisioningConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).ArcAutoProvisioningConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioningConfiguration) content.GetValueForProperty("ArcAutoProvisioningConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).ArcAutoProvisioningConfiguration, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingArcAutoProvisioningConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("ArcAutoProvisioningEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).ArcAutoProvisioningEnabled = (bool?) content.GetValueForProperty("ArcAutoProvisioningEnabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).ArcAutoProvisioningEnabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ArcAutoProvisioningCloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).ArcAutoProvisioningCloudRoleArn = (string) content.GetValueForProperty("ArcAutoProvisioningCloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).ArcAutoProvisioningCloudRoleArn, global::System.Convert.ToString); + } + if (content.Contains("VaAutoProvisioningConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).VaAutoProvisioningConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVaAutoProvisioningConfiguration) content.GetValueForProperty("VaAutoProvisioningConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).VaAutoProvisioningConfiguration, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingVaAutoProvisioningConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("VaAutoProvisioningEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).VaAutoProvisioningEnabled = (bool?) content.GetValueForProperty("VaAutoProvisioningEnabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).VaAutoProvisioningEnabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ConfigurationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).ConfigurationType = (string) content.GetValueForProperty("ConfigurationType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).ConfigurationType, global::System.Convert.ToString); + } + if (content.Contains("MdeAutoProvisioningEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).MdeAutoProvisioningEnabled = (bool?) content.GetValueForProperty("MdeAutoProvisioningEnabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).MdeAutoProvisioningEnabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("MdeAutoProvisioningConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).MdeAutoProvisioningConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAny) content.GetValueForProperty("MdeAutoProvisioningConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).MdeAutoProvisioningConfiguration, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AnyTypeConverter.ConvertFrom); + } + if (content.Contains("VMScannerConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).VMScannerConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfiguration) content.GetValueForProperty("VMScannerConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).VMScannerConfiguration, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingVMScannersConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("VMScannerEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).VMScannerEnabled = (bool?) content.GetValueForProperty("VMScannerEnabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).VMScannerEnabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ConfigurationScanningMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).ConfigurationScanningMode = (string) content.GetValueForProperty("ConfigurationScanningMode",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).ConfigurationScanningMode, global::System.Convert.ToString); + } + if (content.Contains("ConfigurationProxy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).ConfigurationProxy = (string) content.GetValueForProperty("ConfigurationProxy",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).ConfigurationProxy, global::System.Convert.ToString); + } + if (content.Contains("ConfigurationPrivateLinkScope")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).ConfigurationPrivateLinkScope = (string) content.GetValueForProperty("ConfigurationPrivateLinkScope",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).ConfigurationPrivateLinkScope, global::System.Convert.ToString); + } + if (content.Contains("ConfigurationCloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).ConfigurationCloudRoleArn = (string) content.GetValueForProperty("ConfigurationCloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).ConfigurationCloudRoleArn, global::System.Convert.ToString); + } + if (content.Contains("ConfigurationExclusionTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).ConfigurationExclusionTag = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfigurationExclusionTags) content.GetValueForProperty("ConfigurationExclusionTag",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).ConfigurationExclusionTag, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingVMScannersConfigurationExclusionTagsTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DefenderForServersAwsOffering(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DefenderForServer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).DefenderForServer = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingDefenderForServers) content.GetValueForProperty("DefenderForServer",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).DefenderForServer, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingDefenderForServersTypeConverter.ConvertFrom); + } + if (content.Contains("ArcAutoProvisioning")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).ArcAutoProvisioning = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioning) content.GetValueForProperty("ArcAutoProvisioning",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).ArcAutoProvisioning, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingArcAutoProvisioningTypeConverter.ConvertFrom); + } + if (content.Contains("VaAutoProvisioning")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).VaAutoProvisioning = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVaAutoProvisioning) content.GetValueForProperty("VaAutoProvisioning",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).VaAutoProvisioning, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingVaAutoProvisioningTypeConverter.ConvertFrom); + } + if (content.Contains("MdeAutoProvisioning")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).MdeAutoProvisioning = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingMdeAutoProvisioning) content.GetValueForProperty("MdeAutoProvisioning",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).MdeAutoProvisioning, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingMdeAutoProvisioningTypeConverter.ConvertFrom); + } + if (content.Contains("SubPlan")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).SubPlan = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingSubPlan) content.GetValueForProperty("SubPlan",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).SubPlan, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingSubPlanTypeConverter.ConvertFrom); + } + if (content.Contains("VMScanner")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).VMScanner = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScanners) content.GetValueForProperty("VMScanner",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).VMScanner, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingVMScannersTypeConverter.ConvertFrom); + } + if (content.Contains("OfferingType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType = (string) content.GetValueForProperty("OfferingType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType, global::System.Convert.ToString); + } + if (content.Contains("Description")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description, global::System.Convert.ToString); + } + if (content.Contains("SubPlanType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).SubPlanType = (string) content.GetValueForProperty("SubPlanType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).SubPlanType, global::System.Convert.ToString); + } + if (content.Contains("DefenderForServerCloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).DefenderForServerCloudRoleArn = (string) content.GetValueForProperty("DefenderForServerCloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).DefenderForServerCloudRoleArn, global::System.Convert.ToString); + } + if (content.Contains("ArcAutoProvisioningConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).ArcAutoProvisioningConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioningConfiguration) content.GetValueForProperty("ArcAutoProvisioningConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).ArcAutoProvisioningConfiguration, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingArcAutoProvisioningConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("ArcAutoProvisioningEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).ArcAutoProvisioningEnabled = (bool?) content.GetValueForProperty("ArcAutoProvisioningEnabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).ArcAutoProvisioningEnabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ArcAutoProvisioningCloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).ArcAutoProvisioningCloudRoleArn = (string) content.GetValueForProperty("ArcAutoProvisioningCloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).ArcAutoProvisioningCloudRoleArn, global::System.Convert.ToString); + } + if (content.Contains("VaAutoProvisioningConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).VaAutoProvisioningConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVaAutoProvisioningConfiguration) content.GetValueForProperty("VaAutoProvisioningConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).VaAutoProvisioningConfiguration, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingVaAutoProvisioningConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("VaAutoProvisioningEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).VaAutoProvisioningEnabled = (bool?) content.GetValueForProperty("VaAutoProvisioningEnabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).VaAutoProvisioningEnabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ConfigurationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).ConfigurationType = (string) content.GetValueForProperty("ConfigurationType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).ConfigurationType, global::System.Convert.ToString); + } + if (content.Contains("MdeAutoProvisioningEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).MdeAutoProvisioningEnabled = (bool?) content.GetValueForProperty("MdeAutoProvisioningEnabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).MdeAutoProvisioningEnabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("MdeAutoProvisioningConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).MdeAutoProvisioningConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAny) content.GetValueForProperty("MdeAutoProvisioningConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).MdeAutoProvisioningConfiguration, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AnyTypeConverter.ConvertFrom); + } + if (content.Contains("VMScannerConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).VMScannerConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfiguration) content.GetValueForProperty("VMScannerConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).VMScannerConfiguration, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingVMScannersConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("VMScannerEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).VMScannerEnabled = (bool?) content.GetValueForProperty("VMScannerEnabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).VMScannerEnabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ConfigurationScanningMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).ConfigurationScanningMode = (string) content.GetValueForProperty("ConfigurationScanningMode",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).ConfigurationScanningMode, global::System.Convert.ToString); + } + if (content.Contains("ConfigurationProxy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).ConfigurationProxy = (string) content.GetValueForProperty("ConfigurationProxy",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).ConfigurationProxy, global::System.Convert.ToString); + } + if (content.Contains("ConfigurationPrivateLinkScope")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).ConfigurationPrivateLinkScope = (string) content.GetValueForProperty("ConfigurationPrivateLinkScope",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).ConfigurationPrivateLinkScope, global::System.Convert.ToString); + } + if (content.Contains("ConfigurationCloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).ConfigurationCloudRoleArn = (string) content.GetValueForProperty("ConfigurationCloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).ConfigurationCloudRoleArn, global::System.Convert.ToString); + } + if (content.Contains("ConfigurationExclusionTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).ConfigurationExclusionTag = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfigurationExclusionTags) content.GetValueForProperty("ConfigurationExclusionTag",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal)this).ConfigurationExclusionTag, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingVMScannersConfigurationExclusionTagsTypeConverter.ConvertFrom); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOffering DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DefenderForServersAwsOffering(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOffering DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DefenderForServersAwsOffering(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOffering FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The Defender for Servers AWS offering + [System.ComponentModel.TypeConverter(typeof(DefenderForServersAwsOfferingTypeConverter))] + public partial interface IDefenderForServersAwsOffering + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOffering.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOffering.TypeConverter.cs new file mode 100644 index 000000000000..89bdbc0b0639 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOffering.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DefenderForServersAwsOfferingTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOffering ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOffering).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DefenderForServersAwsOffering.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DefenderForServersAwsOffering.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DefenderForServersAwsOffering.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOffering.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOffering.cs new file mode 100644 index 000000000000..0f711382ef7b --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOffering.cs @@ -0,0 +1,401 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The Defender for Servers AWS offering + public partial class DefenderForServersAwsOffering : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOffering, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOffering __cloudOffering = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CloudOffering(); + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioning _arcAutoProvisioning; + + /// The ARC autoprovisioning configuration + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioning ArcAutoProvisioning { get => (this._arcAutoProvisioning = this._arcAutoProvisioning ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingArcAutoProvisioning()); set => this._arcAutoProvisioning = value; } + + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string ArcAutoProvisioningCloudRoleArn { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioningInternal)ArcAutoProvisioning).CloudRoleArn; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioningInternal)ArcAutoProvisioning).CloudRoleArn = value ?? null; } + + /// Is arc auto provisioning enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public bool? ArcAutoProvisioningEnabled { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioningInternal)ArcAutoProvisioning).Enabled; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioningInternal)ArcAutoProvisioning).Enabled = value ?? default(bool); } + + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string ConfigurationCloudRoleArn { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersInternal)VMScanner).ConfigurationCloudRoleArn; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersInternal)VMScanner).ConfigurationCloudRoleArn = value ?? null; } + + /// VM tags that indicates that VM should not be scanned + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfigurationExclusionTags ConfigurationExclusionTag { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersInternal)VMScanner).ConfigurationExclusionTag; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersInternal)VMScanner).ConfigurationExclusionTag = value ?? null /* model class */; } + + /// Optional Arc private link scope resource id to link the Arc agent + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string ConfigurationPrivateLinkScope { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioningInternal)ArcAutoProvisioning).ConfigurationPrivateLinkScope; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioningInternal)ArcAutoProvisioning).ConfigurationPrivateLinkScope = value ?? null; } + + /// Optional HTTP proxy endpoint to use for the Arc agent + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string ConfigurationProxy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioningInternal)ArcAutoProvisioning).ConfigurationProxy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioningInternal)ArcAutoProvisioning).ConfigurationProxy = value ?? null; } + + /// The scanning mode for the VM scan. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string ConfigurationScanningMode { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersInternal)VMScanner).ConfigurationScanningMode; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersInternal)VMScanner).ConfigurationScanningMode = value ?? null; } + + /// + /// The Vulnerability Assessment solution to be provisioned. Can be either 'TVM' or 'Qualys' + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string ConfigurationType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVaAutoProvisioningInternal)VaAutoProvisioning).ConfigurationType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVaAutoProvisioningInternal)VaAutoProvisioning).ConfigurationType = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingDefenderForServers _defenderForServer; + + /// The Defender for servers connection configuration + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingDefenderForServers DefenderForServer { get => (this._defenderForServer = this._defenderForServer ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingDefenderForServers()); set => this._defenderForServer = value; } + + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string DefenderForServerCloudRoleArn { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingDefenderForServersInternal)DefenderForServer).CloudRoleArn; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingDefenderForServersInternal)DefenderForServer).CloudRoleArn = value ?? null; } + + /// The offering description. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string Description { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)__cloudOffering).Description; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingMdeAutoProvisioning _mdeAutoProvisioning; + + /// The Microsoft Defender for Endpoint autoprovisioning configuration + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingMdeAutoProvisioning MdeAutoProvisioning { get => (this._mdeAutoProvisioning = this._mdeAutoProvisioning ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingMdeAutoProvisioning()); set => this._mdeAutoProvisioning = value; } + + /// configuration for Microsoft Defender for Endpoint autoprovisioning + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAny MdeAutoProvisioningConfiguration { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingMdeAutoProvisioningInternal)MdeAutoProvisioning).Configuration; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingMdeAutoProvisioningInternal)MdeAutoProvisioning).Configuration = value ?? null /* model class */; } + + /// Is Microsoft Defender for Endpoint auto provisioning enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public bool? MdeAutoProvisioningEnabled { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingMdeAutoProvisioningInternal)MdeAutoProvisioning).Enabled; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingMdeAutoProvisioningInternal)MdeAutoProvisioning).Enabled = value ?? default(bool); } + + /// Internal Acessors for Description + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal.Description { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)__cloudOffering).Description; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)__cloudOffering).Description = value; } + + /// Internal Acessors for ArcAutoProvisioning + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioning Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal.ArcAutoProvisioning { get => (this._arcAutoProvisioning = this._arcAutoProvisioning ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingArcAutoProvisioning()); set { {_arcAutoProvisioning = value;} } } + + /// Internal Acessors for ArcAutoProvisioningConfiguration + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioningConfiguration Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal.ArcAutoProvisioningConfiguration { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioningInternal)ArcAutoProvisioning).Configuration; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioningInternal)ArcAutoProvisioning).Configuration = value; } + + /// Internal Acessors for DefenderForServer + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingDefenderForServers Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal.DefenderForServer { get => (this._defenderForServer = this._defenderForServer ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingDefenderForServers()); set { {_defenderForServer = value;} } } + + /// Internal Acessors for MdeAutoProvisioning + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingMdeAutoProvisioning Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal.MdeAutoProvisioning { get => (this._mdeAutoProvisioning = this._mdeAutoProvisioning ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingMdeAutoProvisioning()); set { {_mdeAutoProvisioning = value;} } } + + /// Internal Acessors for SubPlan + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingSubPlan Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal.SubPlan { get => (this._subPlan = this._subPlan ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingSubPlan()); set { {_subPlan = value;} } } + + /// Internal Acessors for VMScanner + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScanners Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal.VMScanner { get => (this._vMScanner = this._vMScanner ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingVMScanners()); set { {_vMScanner = value;} } } + + /// Internal Acessors for VMScannerConfiguration + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfiguration Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal.VMScannerConfiguration { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersInternal)VMScanner).Configuration; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersInternal)VMScanner).Configuration = value; } + + /// Internal Acessors for VaAutoProvisioning + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVaAutoProvisioning Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal.VaAutoProvisioning { get => (this._vaAutoProvisioning = this._vaAutoProvisioning ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingVaAutoProvisioning()); set { {_vaAutoProvisioning = value;} } } + + /// Internal Acessors for VaAutoProvisioningConfiguration + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVaAutoProvisioningConfiguration Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingInternal.VaAutoProvisioningConfiguration { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVaAutoProvisioningInternal)VaAutoProvisioning).Configuration; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVaAutoProvisioningInternal)VaAutoProvisioning).Configuration = value; } + + /// The type of the security offering. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Constant] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string OfferingType { get => "DefenderForServersAws"; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)__cloudOffering).OfferingType = "DefenderForServersAws"; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingSubPlan _subPlan; + + /// configuration for the servers offering subPlan + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingSubPlan SubPlan { get => (this._subPlan = this._subPlan ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingSubPlan()); set => this._subPlan = value; } + + /// The available sub plans + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string SubPlanType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingSubPlanInternal)SubPlan).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingSubPlanInternal)SubPlan).Type = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScanners _vMScanner; + + /// The Microsoft Defender for Server VM scanning configuration + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScanners VMScanner { get => (this._vMScanner = this._vMScanner ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingVMScanners()); set => this._vMScanner = value; } + + /// Is Microsoft Defender for Server VM scanning enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public bool? VMScannerEnabled { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersInternal)VMScanner).Enabled; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersInternal)VMScanner).Enabled = value ?? default(bool); } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVaAutoProvisioning _vaAutoProvisioning; + + /// The Vulnerability Assessment autoprovisioning configuration + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVaAutoProvisioning VaAutoProvisioning { get => (this._vaAutoProvisioning = this._vaAutoProvisioning ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingVaAutoProvisioning()); set => this._vaAutoProvisioning = value; } + + /// Is Vulnerability Assessment auto provisioning enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public bool? VaAutoProvisioningEnabled { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVaAutoProvisioningInternal)VaAutoProvisioning).Enabled; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVaAutoProvisioningInternal)VaAutoProvisioning).Enabled = value ?? default(bool); } + + /// Creates an new instance. + public DefenderForServersAwsOffering() + { + this.__cloudOffering.OfferingType = "DefenderForServersAws"; + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__cloudOffering), __cloudOffering); + await eventListener.AssertObjectIsValid(nameof(__cloudOffering), __cloudOffering); + } + } + /// The Defender for Servers AWS offering + public partial interface IDefenderForServersAwsOffering : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOffering + { + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The cloud role ARN in AWS for this feature", + SerializedName = @"cloudRoleArn", + PossibleTypes = new [] { typeof(string) })] + string ArcAutoProvisioningCloudRoleArn { get; set; } + /// Is arc auto provisioning enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Is arc auto provisioning enabled", + SerializedName = @"enabled", + PossibleTypes = new [] { typeof(bool) })] + bool? ArcAutoProvisioningEnabled { get; set; } + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The cloud role ARN in AWS for this feature", + SerializedName = @"cloudRoleArn", + PossibleTypes = new [] { typeof(string) })] + string ConfigurationCloudRoleArn { get; set; } + /// VM tags that indicates that VM should not be scanned + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"VM tags that indicates that VM should not be scanned", + SerializedName = @"exclusionTags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfigurationExclusionTags) })] + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfigurationExclusionTags ConfigurationExclusionTag { get; set; } + /// Optional Arc private link scope resource id to link the Arc agent + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Optional Arc private link scope resource id to link the Arc agent", + SerializedName = @"privateLinkScope", + PossibleTypes = new [] { typeof(string) })] + string ConfigurationPrivateLinkScope { get; set; } + /// Optional HTTP proxy endpoint to use for the Arc agent + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Optional HTTP proxy endpoint to use for the Arc agent", + SerializedName = @"proxy", + PossibleTypes = new [] { typeof(string) })] + string ConfigurationProxy { get; set; } + /// The scanning mode for the VM scan. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The scanning mode for the VM scan.", + SerializedName = @"scanningMode", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Default")] + string ConfigurationScanningMode { get; set; } + /// + /// The Vulnerability Assessment solution to be provisioned. Can be either 'TVM' or 'Qualys' + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The Vulnerability Assessment solution to be provisioned. Can be either 'TVM' or 'Qualys'", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Qualys", "TVM")] + string ConfigurationType { get; set; } + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The cloud role ARN in AWS for this feature", + SerializedName = @"cloudRoleArn", + PossibleTypes = new [] { typeof(string) })] + string DefenderForServerCloudRoleArn { get; set; } + /// configuration for Microsoft Defender for Endpoint autoprovisioning + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"configuration for Microsoft Defender for Endpoint autoprovisioning", + SerializedName = @"configuration", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAny) })] + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAny MdeAutoProvisioningConfiguration { get; set; } + /// Is Microsoft Defender for Endpoint auto provisioning enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Is Microsoft Defender for Endpoint auto provisioning enabled", + SerializedName = @"enabled", + PossibleTypes = new [] { typeof(bool) })] + bool? MdeAutoProvisioningEnabled { get; set; } + /// The available sub plans + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The available sub plans", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("P1", "P2")] + string SubPlanType { get; set; } + /// Is Microsoft Defender for Server VM scanning enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Is Microsoft Defender for Server VM scanning enabled", + SerializedName = @"enabled", + PossibleTypes = new [] { typeof(bool) })] + bool? VMScannerEnabled { get; set; } + /// Is Vulnerability Assessment auto provisioning enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Is Vulnerability Assessment auto provisioning enabled", + SerializedName = @"enabled", + PossibleTypes = new [] { typeof(bool) })] + bool? VaAutoProvisioningEnabled { get; set; } + + } + /// The Defender for Servers AWS offering + internal partial interface IDefenderForServersAwsOfferingInternal : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal + { + /// The ARC autoprovisioning configuration + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioning ArcAutoProvisioning { get; set; } + /// The cloud role ARN in AWS for this feature + string ArcAutoProvisioningCloudRoleArn { get; set; } + /// Configuration for servers Arc auto provisioning + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioningConfiguration ArcAutoProvisioningConfiguration { get; set; } + /// Is arc auto provisioning enabled + bool? ArcAutoProvisioningEnabled { get; set; } + /// The cloud role ARN in AWS for this feature + string ConfigurationCloudRoleArn { get; set; } + /// VM tags that indicates that VM should not be scanned + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfigurationExclusionTags ConfigurationExclusionTag { get; set; } + /// Optional Arc private link scope resource id to link the Arc agent + string ConfigurationPrivateLinkScope { get; set; } + /// Optional HTTP proxy endpoint to use for the Arc agent + string ConfigurationProxy { get; set; } + /// The scanning mode for the VM scan. + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Default")] + string ConfigurationScanningMode { get; set; } + /// + /// The Vulnerability Assessment solution to be provisioned. Can be either 'TVM' or 'Qualys' + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Qualys", "TVM")] + string ConfigurationType { get; set; } + /// The Defender for servers connection configuration + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingDefenderForServers DefenderForServer { get; set; } + /// The cloud role ARN in AWS for this feature + string DefenderForServerCloudRoleArn { get; set; } + /// The Microsoft Defender for Endpoint autoprovisioning configuration + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingMdeAutoProvisioning MdeAutoProvisioning { get; set; } + /// configuration for Microsoft Defender for Endpoint autoprovisioning + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAny MdeAutoProvisioningConfiguration { get; set; } + /// Is Microsoft Defender for Endpoint auto provisioning enabled + bool? MdeAutoProvisioningEnabled { get; set; } + /// configuration for the servers offering subPlan + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingSubPlan SubPlan { get; set; } + /// The available sub plans + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("P1", "P2")] + string SubPlanType { get; set; } + /// The Microsoft Defender for Server VM scanning configuration + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScanners VMScanner { get; set; } + /// configuration for Microsoft Defender for Server VM scanning + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfiguration VMScannerConfiguration { get; set; } + /// Is Microsoft Defender for Server VM scanning enabled + bool? VMScannerEnabled { get; set; } + /// The Vulnerability Assessment autoprovisioning configuration + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVaAutoProvisioning VaAutoProvisioning { get; set; } + /// configuration for Vulnerability Assessment autoprovisioning + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVaAutoProvisioningConfiguration VaAutoProvisioningConfiguration { get; set; } + /// Is Vulnerability Assessment auto provisioning enabled + bool? VaAutoProvisioningEnabled { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOffering.json.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOffering.json.cs new file mode 100644 index 000000000000..02e2b20d3bff --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOffering.json.cs @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The Defender for Servers AWS offering + public partial class DefenderForServersAwsOffering + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal DefenderForServersAwsOffering(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __cloudOffering = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CloudOffering(json); + {_defenderForServer = If( json?.PropertyT("defenderForServers"), out var __jsonDefenderForServers) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingDefenderForServers.FromJson(__jsonDefenderForServers) : _defenderForServer;} + {_arcAutoProvisioning = If( json?.PropertyT("arcAutoProvisioning"), out var __jsonArcAutoProvisioning) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingArcAutoProvisioning.FromJson(__jsonArcAutoProvisioning) : _arcAutoProvisioning;} + {_vaAutoProvisioning = If( json?.PropertyT("vaAutoProvisioning"), out var __jsonVaAutoProvisioning) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingVaAutoProvisioning.FromJson(__jsonVaAutoProvisioning) : _vaAutoProvisioning;} + {_mdeAutoProvisioning = If( json?.PropertyT("mdeAutoProvisioning"), out var __jsonMdeAutoProvisioning) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingMdeAutoProvisioning.FromJson(__jsonMdeAutoProvisioning) : _mdeAutoProvisioning;} + {_subPlan = If( json?.PropertyT("subPlan"), out var __jsonSubPlan) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingSubPlan.FromJson(__jsonSubPlan) : _subPlan;} + {_vMScanner = If( json?.PropertyT("vmScanners"), out var __jsonVMScanners) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingVMScanners.FromJson(__jsonVMScanners) : _vMScanner;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOffering. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOffering. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOffering FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DefenderForServersAwsOffering(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __cloudOffering?.ToJson(container, serializationMode); + AddIf( null != this._defenderForServer ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._defenderForServer.ToJson(null,serializationMode) : null, "defenderForServers" ,container.Add ); + AddIf( null != this._arcAutoProvisioning ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._arcAutoProvisioning.ToJson(null,serializationMode) : null, "arcAutoProvisioning" ,container.Add ); + AddIf( null != this._vaAutoProvisioning ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._vaAutoProvisioning.ToJson(null,serializationMode) : null, "vaAutoProvisioning" ,container.Add ); + AddIf( null != this._mdeAutoProvisioning ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._mdeAutoProvisioning.ToJson(null,serializationMode) : null, "mdeAutoProvisioning" ,container.Add ); + AddIf( null != this._subPlan ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._subPlan.ToJson(null,serializationMode) : null, "subPlan" ,container.Add ); + AddIf( null != this._vMScanner ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._vMScanner.ToJson(null,serializationMode) : null, "vmScanners" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingArcAutoProvisioning.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingArcAutoProvisioning.PowerShell.cs new file mode 100644 index 000000000000..96d66804ad15 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingArcAutoProvisioning.PowerShell.cs @@ -0,0 +1,201 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The ARC autoprovisioning configuration + [System.ComponentModel.TypeConverter(typeof(DefenderForServersAwsOfferingArcAutoProvisioningTypeConverter))] + public partial class DefenderForServersAwsOfferingArcAutoProvisioning + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DefenderForServersAwsOfferingArcAutoProvisioning(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Configuration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioningInternal)this).Configuration = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioningConfiguration) content.GetValueForProperty("Configuration",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioningInternal)this).Configuration, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingArcAutoProvisioningConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("Enabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioningInternal)this).Enabled = (bool?) content.GetValueForProperty("Enabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioningInternal)this).Enabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("CloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioningInternal)this).CloudRoleArn = (string) content.GetValueForProperty("CloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioningInternal)this).CloudRoleArn, global::System.Convert.ToString); + } + if (content.Contains("ConfigurationProxy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioningInternal)this).ConfigurationProxy = (string) content.GetValueForProperty("ConfigurationProxy",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioningInternal)this).ConfigurationProxy, global::System.Convert.ToString); + } + if (content.Contains("ConfigurationPrivateLinkScope")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioningInternal)this).ConfigurationPrivateLinkScope = (string) content.GetValueForProperty("ConfigurationPrivateLinkScope",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioningInternal)this).ConfigurationPrivateLinkScope, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DefenderForServersAwsOfferingArcAutoProvisioning(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Configuration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioningInternal)this).Configuration = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioningConfiguration) content.GetValueForProperty("Configuration",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioningInternal)this).Configuration, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingArcAutoProvisioningConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("Enabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioningInternal)this).Enabled = (bool?) content.GetValueForProperty("Enabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioningInternal)this).Enabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("CloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioningInternal)this).CloudRoleArn = (string) content.GetValueForProperty("CloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioningInternal)this).CloudRoleArn, global::System.Convert.ToString); + } + if (content.Contains("ConfigurationProxy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioningInternal)this).ConfigurationProxy = (string) content.GetValueForProperty("ConfigurationProxy",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioningInternal)this).ConfigurationProxy, global::System.Convert.ToString); + } + if (content.Contains("ConfigurationPrivateLinkScope")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioningInternal)this).ConfigurationPrivateLinkScope = (string) content.GetValueForProperty("ConfigurationPrivateLinkScope",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioningInternal)this).ConfigurationPrivateLinkScope, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioning DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DefenderForServersAwsOfferingArcAutoProvisioning(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioning DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DefenderForServersAwsOfferingArcAutoProvisioning(content); + } + + /// + /// Creates a new instance of , deserializing the content from + /// a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioning FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The ARC autoprovisioning configuration + [System.ComponentModel.TypeConverter(typeof(DefenderForServersAwsOfferingArcAutoProvisioningTypeConverter))] + public partial interface IDefenderForServersAwsOfferingArcAutoProvisioning + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingArcAutoProvisioning.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingArcAutoProvisioning.TypeConverter.cs new file mode 100644 index 000000000000..81ea7a3d055a --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingArcAutoProvisioning.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DefenderForServersAwsOfferingArcAutoProvisioningTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, + /// otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioning ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioning).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DefenderForServersAwsOfferingArcAutoProvisioning.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DefenderForServersAwsOfferingArcAutoProvisioning.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DefenderForServersAwsOfferingArcAutoProvisioning.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingArcAutoProvisioning.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingArcAutoProvisioning.cs new file mode 100644 index 000000000000..f6bc5de60764 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingArcAutoProvisioning.cs @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The ARC autoprovisioning configuration + public partial class DefenderForServersAwsOfferingArcAutoProvisioning : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioning, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioningInternal + { + + /// Backing field for property. + private string _cloudRoleArn; + + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string CloudRoleArn { get => this._cloudRoleArn; set => this._cloudRoleArn = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioningConfiguration _configuration; + + /// Configuration for servers Arc auto provisioning + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioningConfiguration Configuration { get => (this._configuration = this._configuration ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingArcAutoProvisioningConfiguration()); set => this._configuration = value; } + + /// Optional Arc private link scope resource id to link the Arc agent + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string ConfigurationPrivateLinkScope { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioningConfigurationInternal)Configuration).PrivateLinkScope; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioningConfigurationInternal)Configuration).PrivateLinkScope = value ?? null; } + + /// Optional HTTP proxy endpoint to use for the Arc agent + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string ConfigurationProxy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioningConfigurationInternal)Configuration).Proxy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioningConfigurationInternal)Configuration).Proxy = value ?? null; } + + /// Backing field for property. + private bool? _enabled; + + /// Is arc auto provisioning enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public bool? Enabled { get => this._enabled; set => this._enabled = value; } + + /// Internal Acessors for Configuration + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioningConfiguration Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioningInternal.Configuration { get => (this._configuration = this._configuration ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingArcAutoProvisioningConfiguration()); set { {_configuration = value;} } } + + /// + /// Creates an new instance. + /// + public DefenderForServersAwsOfferingArcAutoProvisioning() + { + + } + } + /// The ARC autoprovisioning configuration + public partial interface IDefenderForServersAwsOfferingArcAutoProvisioning : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The cloud role ARN in AWS for this feature", + SerializedName = @"cloudRoleArn", + PossibleTypes = new [] { typeof(string) })] + string CloudRoleArn { get; set; } + /// Optional Arc private link scope resource id to link the Arc agent + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Optional Arc private link scope resource id to link the Arc agent", + SerializedName = @"privateLinkScope", + PossibleTypes = new [] { typeof(string) })] + string ConfigurationPrivateLinkScope { get; set; } + /// Optional HTTP proxy endpoint to use for the Arc agent + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Optional HTTP proxy endpoint to use for the Arc agent", + SerializedName = @"proxy", + PossibleTypes = new [] { typeof(string) })] + string ConfigurationProxy { get; set; } + /// Is arc auto provisioning enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Is arc auto provisioning enabled", + SerializedName = @"enabled", + PossibleTypes = new [] { typeof(bool) })] + bool? Enabled { get; set; } + + } + /// The ARC autoprovisioning configuration + internal partial interface IDefenderForServersAwsOfferingArcAutoProvisioningInternal + + { + /// The cloud role ARN in AWS for this feature + string CloudRoleArn { get; set; } + /// Configuration for servers Arc auto provisioning + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioningConfiguration Configuration { get; set; } + /// Optional Arc private link scope resource id to link the Arc agent + string ConfigurationPrivateLinkScope { get; set; } + /// Optional HTTP proxy endpoint to use for the Arc agent + string ConfigurationProxy { get; set; } + /// Is arc auto provisioning enabled + bool? Enabled { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingArcAutoProvisioning.json.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingArcAutoProvisioning.json.cs new file mode 100644 index 000000000000..8193dfef7ba4 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingArcAutoProvisioning.json.cs @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The ARC autoprovisioning configuration + public partial class DefenderForServersAwsOfferingArcAutoProvisioning + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal DefenderForServersAwsOfferingArcAutoProvisioning(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_configuration = If( json?.PropertyT("configuration"), out var __jsonConfiguration) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingArcAutoProvisioningConfiguration.FromJson(__jsonConfiguration) : _configuration;} + {_enabled = If( json?.PropertyT("enabled"), out var __jsonEnabled) ? (bool?)__jsonEnabled : _enabled;} + {_cloudRoleArn = If( json?.PropertyT("cloudRoleArn"), out var __jsonCloudRoleArn) ? (string)__jsonCloudRoleArn : (string)_cloudRoleArn;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioning. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioning. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioning FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DefenderForServersAwsOfferingArcAutoProvisioning(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._configuration ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._configuration.ToJson(null,serializationMode) : null, "configuration" ,container.Add ); + AddIf( null != this._enabled ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonBoolean((bool)this._enabled) : null, "enabled" ,container.Add ); + AddIf( null != (((object)this._cloudRoleArn)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._cloudRoleArn.ToString()) : null, "cloudRoleArn" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingArcAutoProvisioningConfiguration.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingArcAutoProvisioningConfiguration.PowerShell.cs new file mode 100644 index 000000000000..93aba789b114 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingArcAutoProvisioningConfiguration.PowerShell.cs @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// Configuration for servers Arc auto provisioning + [System.ComponentModel.TypeConverter(typeof(DefenderForServersAwsOfferingArcAutoProvisioningConfigurationTypeConverter))] + public partial class DefenderForServersAwsOfferingArcAutoProvisioningConfiguration + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DefenderForServersAwsOfferingArcAutoProvisioningConfiguration(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Proxy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioningConfigurationInternal)this).Proxy = (string) content.GetValueForProperty("Proxy",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioningConfigurationInternal)this).Proxy, global::System.Convert.ToString); + } + if (content.Contains("PrivateLinkScope")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioningConfigurationInternal)this).PrivateLinkScope = (string) content.GetValueForProperty("PrivateLinkScope",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioningConfigurationInternal)this).PrivateLinkScope, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DefenderForServersAwsOfferingArcAutoProvisioningConfiguration(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Proxy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioningConfigurationInternal)this).Proxy = (string) content.GetValueForProperty("Proxy",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioningConfigurationInternal)this).Proxy, global::System.Convert.ToString); + } + if (content.Contains("PrivateLinkScope")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioningConfigurationInternal)this).PrivateLinkScope = (string) content.GetValueForProperty("PrivateLinkScope",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioningConfigurationInternal)this).PrivateLinkScope, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioningConfiguration DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DefenderForServersAwsOfferingArcAutoProvisioningConfiguration(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioningConfiguration DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DefenderForServersAwsOfferingArcAutoProvisioningConfiguration(content); + } + + /// + /// Creates a new instance of , deserializing + /// the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioningConfiguration FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// Configuration for servers Arc auto provisioning + [System.ComponentModel.TypeConverter(typeof(DefenderForServersAwsOfferingArcAutoProvisioningConfigurationTypeConverter))] + public partial interface IDefenderForServersAwsOfferingArcAutoProvisioningConfiguration + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingArcAutoProvisioningConfiguration.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingArcAutoProvisioningConfiguration.TypeConverter.cs new file mode 100644 index 000000000000..9b088915c48b --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingArcAutoProvisioningConfiguration.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DefenderForServersAwsOfferingArcAutoProvisioningConfigurationTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is + /// no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is + /// no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioningConfiguration ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioningConfiguration).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DefenderForServersAwsOfferingArcAutoProvisioningConfiguration.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DefenderForServersAwsOfferingArcAutoProvisioningConfiguration.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DefenderForServersAwsOfferingArcAutoProvisioningConfiguration.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingArcAutoProvisioningConfiguration.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingArcAutoProvisioningConfiguration.cs new file mode 100644 index 000000000000..d69693915b43 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingArcAutoProvisioningConfiguration.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// Configuration for servers Arc auto provisioning + public partial class DefenderForServersAwsOfferingArcAutoProvisioningConfiguration : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioningConfiguration, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioningConfigurationInternal + { + + /// Backing field for property. + private string _privateLinkScope; + + /// Optional Arc private link scope resource id to link the Arc agent + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string PrivateLinkScope { get => this._privateLinkScope; set => this._privateLinkScope = value; } + + /// Backing field for property. + private string _proxy; + + /// Optional HTTP proxy endpoint to use for the Arc agent + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string Proxy { get => this._proxy; set => this._proxy = value; } + + /// + /// Creates an new instance. + /// + public DefenderForServersAwsOfferingArcAutoProvisioningConfiguration() + { + + } + } + /// Configuration for servers Arc auto provisioning + public partial interface IDefenderForServersAwsOfferingArcAutoProvisioningConfiguration : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// Optional Arc private link scope resource id to link the Arc agent + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Optional Arc private link scope resource id to link the Arc agent", + SerializedName = @"privateLinkScope", + PossibleTypes = new [] { typeof(string) })] + string PrivateLinkScope { get; set; } + /// Optional HTTP proxy endpoint to use for the Arc agent + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Optional HTTP proxy endpoint to use for the Arc agent", + SerializedName = @"proxy", + PossibleTypes = new [] { typeof(string) })] + string Proxy { get; set; } + + } + /// Configuration for servers Arc auto provisioning + internal partial interface IDefenderForServersAwsOfferingArcAutoProvisioningConfigurationInternal + + { + /// Optional Arc private link scope resource id to link the Arc agent + string PrivateLinkScope { get; set; } + /// Optional HTTP proxy endpoint to use for the Arc agent + string Proxy { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingArcAutoProvisioningConfiguration.json.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingArcAutoProvisioningConfiguration.json.cs new file mode 100644 index 000000000000..2b5ebbe9457c --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingArcAutoProvisioningConfiguration.json.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// Configuration for servers Arc auto provisioning + public partial class DefenderForServersAwsOfferingArcAutoProvisioningConfiguration + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal DefenderForServersAwsOfferingArcAutoProvisioningConfiguration(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_proxy = If( json?.PropertyT("proxy"), out var __jsonProxy) ? (string)__jsonProxy : (string)_proxy;} + {_privateLinkScope = If( json?.PropertyT("privateLinkScope"), out var __jsonPrivateLinkScope) ? (string)__jsonPrivateLinkScope : (string)_privateLinkScope;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioningConfiguration. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioningConfiguration. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingArcAutoProvisioningConfiguration FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DefenderForServersAwsOfferingArcAutoProvisioningConfiguration(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._proxy)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._proxy.ToString()) : null, "proxy" ,container.Add ); + AddIf( null != (((object)this._privateLinkScope)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._privateLinkScope.ToString()) : null, "privateLinkScope" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingDefenderForServers.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingDefenderForServers.PowerShell.cs new file mode 100644 index 000000000000..ecd3ccf73686 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingDefenderForServers.PowerShell.cs @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The Defender for servers connection configuration + [System.ComponentModel.TypeConverter(typeof(DefenderForServersAwsOfferingDefenderForServersTypeConverter))] + public partial class DefenderForServersAwsOfferingDefenderForServers + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DefenderForServersAwsOfferingDefenderForServers(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingDefenderForServersInternal)this).CloudRoleArn = (string) content.GetValueForProperty("CloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingDefenderForServersInternal)this).CloudRoleArn, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DefenderForServersAwsOfferingDefenderForServers(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingDefenderForServersInternal)this).CloudRoleArn = (string) content.GetValueForProperty("CloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingDefenderForServersInternal)this).CloudRoleArn, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingDefenderForServers DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DefenderForServersAwsOfferingDefenderForServers(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingDefenderForServers DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DefenderForServersAwsOfferingDefenderForServers(content); + } + + /// + /// Creates a new instance of , deserializing the content from + /// a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingDefenderForServers FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The Defender for servers connection configuration + [System.ComponentModel.TypeConverter(typeof(DefenderForServersAwsOfferingDefenderForServersTypeConverter))] + public partial interface IDefenderForServersAwsOfferingDefenderForServers + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingDefenderForServers.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingDefenderForServers.TypeConverter.cs new file mode 100644 index 000000000000..d114b794cd05 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingDefenderForServers.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DefenderForServersAwsOfferingDefenderForServersTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, + /// otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingDefenderForServers ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingDefenderForServers).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DefenderForServersAwsOfferingDefenderForServers.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DefenderForServersAwsOfferingDefenderForServers.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DefenderForServersAwsOfferingDefenderForServers.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingDefenderForServers.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingDefenderForServers.cs new file mode 100644 index 000000000000..ee4b241c653b --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingDefenderForServers.cs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The Defender for servers connection configuration + public partial class DefenderForServersAwsOfferingDefenderForServers : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingDefenderForServers, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingDefenderForServersInternal + { + + /// Backing field for property. + private string _cloudRoleArn; + + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string CloudRoleArn { get => this._cloudRoleArn; set => this._cloudRoleArn = value; } + + /// + /// Creates an new instance. + /// + public DefenderForServersAwsOfferingDefenderForServers() + { + + } + } + /// The Defender for servers connection configuration + public partial interface IDefenderForServersAwsOfferingDefenderForServers : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The cloud role ARN in AWS for this feature", + SerializedName = @"cloudRoleArn", + PossibleTypes = new [] { typeof(string) })] + string CloudRoleArn { get; set; } + + } + /// The Defender for servers connection configuration + internal partial interface IDefenderForServersAwsOfferingDefenderForServersInternal + + { + /// The cloud role ARN in AWS for this feature + string CloudRoleArn { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingDefenderForServers.json.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingDefenderForServers.json.cs new file mode 100644 index 000000000000..0ca17042fc86 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingDefenderForServers.json.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The Defender for servers connection configuration + public partial class DefenderForServersAwsOfferingDefenderForServers + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal DefenderForServersAwsOfferingDefenderForServers(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_cloudRoleArn = If( json?.PropertyT("cloudRoleArn"), out var __jsonCloudRoleArn) ? (string)__jsonCloudRoleArn : (string)_cloudRoleArn;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingDefenderForServers. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingDefenderForServers. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingDefenderForServers FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DefenderForServersAwsOfferingDefenderForServers(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._cloudRoleArn)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._cloudRoleArn.ToString()) : null, "cloudRoleArn" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingMdeAutoProvisioning.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingMdeAutoProvisioning.PowerShell.cs new file mode 100644 index 000000000000..d53de380ccbd --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingMdeAutoProvisioning.PowerShell.cs @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The Microsoft Defender for Endpoint autoprovisioning configuration + [System.ComponentModel.TypeConverter(typeof(DefenderForServersAwsOfferingMdeAutoProvisioningTypeConverter))] + public partial class DefenderForServersAwsOfferingMdeAutoProvisioning + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DefenderForServersAwsOfferingMdeAutoProvisioning(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Enabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingMdeAutoProvisioningInternal)this).Enabled = (bool?) content.GetValueForProperty("Enabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingMdeAutoProvisioningInternal)this).Enabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("Configuration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingMdeAutoProvisioningInternal)this).Configuration = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAny) content.GetValueForProperty("Configuration",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingMdeAutoProvisioningInternal)this).Configuration, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AnyTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DefenderForServersAwsOfferingMdeAutoProvisioning(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Enabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingMdeAutoProvisioningInternal)this).Enabled = (bool?) content.GetValueForProperty("Enabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingMdeAutoProvisioningInternal)this).Enabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("Configuration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingMdeAutoProvisioningInternal)this).Configuration = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAny) content.GetValueForProperty("Configuration",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingMdeAutoProvisioningInternal)this).Configuration, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AnyTypeConverter.ConvertFrom); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingMdeAutoProvisioning DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DefenderForServersAwsOfferingMdeAutoProvisioning(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingMdeAutoProvisioning DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DefenderForServersAwsOfferingMdeAutoProvisioning(content); + } + + /// + /// Creates a new instance of , deserializing the content from + /// a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingMdeAutoProvisioning FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The Microsoft Defender for Endpoint autoprovisioning configuration + [System.ComponentModel.TypeConverter(typeof(DefenderForServersAwsOfferingMdeAutoProvisioningTypeConverter))] + public partial interface IDefenderForServersAwsOfferingMdeAutoProvisioning + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingMdeAutoProvisioning.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingMdeAutoProvisioning.TypeConverter.cs new file mode 100644 index 000000000000..29b141134a0b --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingMdeAutoProvisioning.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DefenderForServersAwsOfferingMdeAutoProvisioningTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, + /// otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingMdeAutoProvisioning ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingMdeAutoProvisioning).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DefenderForServersAwsOfferingMdeAutoProvisioning.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DefenderForServersAwsOfferingMdeAutoProvisioning.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DefenderForServersAwsOfferingMdeAutoProvisioning.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingMdeAutoProvisioning.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingMdeAutoProvisioning.cs new file mode 100644 index 000000000000..a470d0ec9cbf --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingMdeAutoProvisioning.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The Microsoft Defender for Endpoint autoprovisioning configuration + public partial class DefenderForServersAwsOfferingMdeAutoProvisioning : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingMdeAutoProvisioning, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingMdeAutoProvisioningInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAny _configuration; + + /// configuration for Microsoft Defender for Endpoint autoprovisioning + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAny Configuration { get => (this._configuration = this._configuration ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.Any()); set => this._configuration = value; } + + /// Backing field for property. + private bool? _enabled; + + /// Is Microsoft Defender for Endpoint auto provisioning enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public bool? Enabled { get => this._enabled; set => this._enabled = value; } + + /// + /// Creates an new instance. + /// + public DefenderForServersAwsOfferingMdeAutoProvisioning() + { + + } + } + /// The Microsoft Defender for Endpoint autoprovisioning configuration + public partial interface IDefenderForServersAwsOfferingMdeAutoProvisioning : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// configuration for Microsoft Defender for Endpoint autoprovisioning + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"configuration for Microsoft Defender for Endpoint autoprovisioning", + SerializedName = @"configuration", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAny) })] + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAny Configuration { get; set; } + /// Is Microsoft Defender for Endpoint auto provisioning enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Is Microsoft Defender for Endpoint auto provisioning enabled", + SerializedName = @"enabled", + PossibleTypes = new [] { typeof(bool) })] + bool? Enabled { get; set; } + + } + /// The Microsoft Defender for Endpoint autoprovisioning configuration + internal partial interface IDefenderForServersAwsOfferingMdeAutoProvisioningInternal + + { + /// configuration for Microsoft Defender for Endpoint autoprovisioning + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAny Configuration { get; set; } + /// Is Microsoft Defender for Endpoint auto provisioning enabled + bool? Enabled { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingMdeAutoProvisioning.json.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingMdeAutoProvisioning.json.cs new file mode 100644 index 000000000000..2364f93a2c5f --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingMdeAutoProvisioning.json.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The Microsoft Defender for Endpoint autoprovisioning configuration + public partial class DefenderForServersAwsOfferingMdeAutoProvisioning + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal DefenderForServersAwsOfferingMdeAutoProvisioning(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_enabled = If( json?.PropertyT("enabled"), out var __jsonEnabled) ? (bool?)__jsonEnabled : _enabled;} + {_configuration = If( json?.PropertyT("configuration"), out var __jsonConfiguration) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.Any.FromJson(__jsonConfiguration) : _configuration;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingMdeAutoProvisioning. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingMdeAutoProvisioning. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingMdeAutoProvisioning FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DefenderForServersAwsOfferingMdeAutoProvisioning(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._enabled ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonBoolean((bool)this._enabled) : null, "enabled" ,container.Add ); + AddIf( null != this._configuration ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._configuration.ToJson(null,serializationMode) : null, "configuration" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingSubPlan.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingSubPlan.PowerShell.cs new file mode 100644 index 000000000000..b291bb7ec39f --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingSubPlan.PowerShell.cs @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// configuration for the servers offering subPlan + [System.ComponentModel.TypeConverter(typeof(DefenderForServersAwsOfferingSubPlanTypeConverter))] + public partial class DefenderForServersAwsOfferingSubPlan + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DefenderForServersAwsOfferingSubPlan(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingSubPlanInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingSubPlanInternal)this).Type, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DefenderForServersAwsOfferingSubPlan(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingSubPlanInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingSubPlanInternal)this).Type, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingSubPlan DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DefenderForServersAwsOfferingSubPlan(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingSubPlan DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DefenderForServersAwsOfferingSubPlan(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingSubPlan FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// configuration for the servers offering subPlan + [System.ComponentModel.TypeConverter(typeof(DefenderForServersAwsOfferingSubPlanTypeConverter))] + public partial interface IDefenderForServersAwsOfferingSubPlan + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingSubPlan.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingSubPlan.TypeConverter.cs new file mode 100644 index 000000000000..e3308c8fd1da --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingSubPlan.TypeConverter.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DefenderForServersAwsOfferingSubPlanTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingSubPlan ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingSubPlan).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DefenderForServersAwsOfferingSubPlan.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DefenderForServersAwsOfferingSubPlan.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DefenderForServersAwsOfferingSubPlan.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingSubPlan.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingSubPlan.cs new file mode 100644 index 000000000000..449bd5806bac --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingSubPlan.cs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// configuration for the servers offering subPlan + public partial class DefenderForServersAwsOfferingSubPlan : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingSubPlan, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingSubPlanInternal + { + + /// Backing field for property. + private string _type; + + /// The available sub plans + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string Type { get => this._type; set => this._type = value; } + + /// Creates an new instance. + public DefenderForServersAwsOfferingSubPlan() + { + + } + } + /// configuration for the servers offering subPlan + public partial interface IDefenderForServersAwsOfferingSubPlan : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// The available sub plans + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The available sub plans", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("P1", "P2")] + string Type { get; set; } + + } + /// configuration for the servers offering subPlan + internal partial interface IDefenderForServersAwsOfferingSubPlanInternal + + { + /// The available sub plans + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("P1", "P2")] + string Type { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingSubPlan.json.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingSubPlan.json.cs new file mode 100644 index 000000000000..427688198a1a --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingSubPlan.json.cs @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// configuration for the servers offering subPlan + public partial class DefenderForServersAwsOfferingSubPlan + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal DefenderForServersAwsOfferingSubPlan(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_type = If( json?.PropertyT("type"), out var __jsonType) ? (string)__jsonType : (string)_type;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingSubPlan. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingSubPlan. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingSubPlan FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DefenderForServersAwsOfferingSubPlan(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._type.ToString()) : null, "type" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingVMScanners.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingVMScanners.PowerShell.cs new file mode 100644 index 000000000000..2ce738da1165 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingVMScanners.PowerShell.cs @@ -0,0 +1,201 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The Microsoft Defender for Server VM scanning configuration + [System.ComponentModel.TypeConverter(typeof(DefenderForServersAwsOfferingVMScannersTypeConverter))] + public partial class DefenderForServersAwsOfferingVMScanners + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DefenderForServersAwsOfferingVMScanners(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Configuration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersInternal)this).Configuration = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfiguration) content.GetValueForProperty("Configuration",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersInternal)this).Configuration, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingVMScannersConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("Enabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersInternal)this).Enabled = (bool?) content.GetValueForProperty("Enabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersInternal)this).Enabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ConfigurationScanningMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersInternal)this).ConfigurationScanningMode = (string) content.GetValueForProperty("ConfigurationScanningMode",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersInternal)this).ConfigurationScanningMode, global::System.Convert.ToString); + } + if (content.Contains("ConfigurationCloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersInternal)this).ConfigurationCloudRoleArn = (string) content.GetValueForProperty("ConfigurationCloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersInternal)this).ConfigurationCloudRoleArn, global::System.Convert.ToString); + } + if (content.Contains("ConfigurationExclusionTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersInternal)this).ConfigurationExclusionTag = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfigurationExclusionTags) content.GetValueForProperty("ConfigurationExclusionTag",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersInternal)this).ConfigurationExclusionTag, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingVMScannersConfigurationExclusionTagsTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DefenderForServersAwsOfferingVMScanners(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Configuration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersInternal)this).Configuration = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfiguration) content.GetValueForProperty("Configuration",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersInternal)this).Configuration, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingVMScannersConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("Enabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersInternal)this).Enabled = (bool?) content.GetValueForProperty("Enabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersInternal)this).Enabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ConfigurationScanningMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersInternal)this).ConfigurationScanningMode = (string) content.GetValueForProperty("ConfigurationScanningMode",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersInternal)this).ConfigurationScanningMode, global::System.Convert.ToString); + } + if (content.Contains("ConfigurationCloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersInternal)this).ConfigurationCloudRoleArn = (string) content.GetValueForProperty("ConfigurationCloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersInternal)this).ConfigurationCloudRoleArn, global::System.Convert.ToString); + } + if (content.Contains("ConfigurationExclusionTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersInternal)this).ConfigurationExclusionTag = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfigurationExclusionTags) content.GetValueForProperty("ConfigurationExclusionTag",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersInternal)this).ConfigurationExclusionTag, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingVMScannersConfigurationExclusionTagsTypeConverter.ConvertFrom); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScanners DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DefenderForServersAwsOfferingVMScanners(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScanners DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DefenderForServersAwsOfferingVMScanners(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScanners FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The Microsoft Defender for Server VM scanning configuration + [System.ComponentModel.TypeConverter(typeof(DefenderForServersAwsOfferingVMScannersTypeConverter))] + public partial interface IDefenderForServersAwsOfferingVMScanners + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingVMScanners.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingVMScanners.TypeConverter.cs new file mode 100644 index 000000000000..bae6b9406ecc --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingVMScanners.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DefenderForServersAwsOfferingVMScannersTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScanners ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScanners).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DefenderForServersAwsOfferingVMScanners.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DefenderForServersAwsOfferingVMScanners.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DefenderForServersAwsOfferingVMScanners.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingVMScanners.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingVMScanners.cs new file mode 100644 index 000000000000..6e0b64b7cd06 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingVMScanners.cs @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The Microsoft Defender for Server VM scanning configuration + public partial class DefenderForServersAwsOfferingVMScanners : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScanners, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfiguration _configuration; + + /// configuration for Microsoft Defender for Server VM scanning + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfiguration Configuration { get => (this._configuration = this._configuration ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingVMScannersConfiguration()); set => this._configuration = value; } + + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string ConfigurationCloudRoleArn { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfigurationInternal)Configuration).CloudRoleArn; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfigurationInternal)Configuration).CloudRoleArn = value ?? null; } + + /// VM tags that indicates that VM should not be scanned + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfigurationExclusionTags ConfigurationExclusionTag { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfigurationInternal)Configuration).ExclusionTag; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfigurationInternal)Configuration).ExclusionTag = value ?? null /* model class */; } + + /// The scanning mode for the VM scan. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string ConfigurationScanningMode { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfigurationInternal)Configuration).ScanningMode; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfigurationInternal)Configuration).ScanningMode = value ?? null; } + + /// Backing field for property. + private bool? _enabled; + + /// Is Microsoft Defender for Server VM scanning enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public bool? Enabled { get => this._enabled; set => this._enabled = value; } + + /// Internal Acessors for Configuration + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfiguration Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersInternal.Configuration { get => (this._configuration = this._configuration ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingVMScannersConfiguration()); set { {_configuration = value;} } } + + /// Creates an new instance. + public DefenderForServersAwsOfferingVMScanners() + { + + } + } + /// The Microsoft Defender for Server VM scanning configuration + public partial interface IDefenderForServersAwsOfferingVMScanners : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The cloud role ARN in AWS for this feature", + SerializedName = @"cloudRoleArn", + PossibleTypes = new [] { typeof(string) })] + string ConfigurationCloudRoleArn { get; set; } + /// VM tags that indicates that VM should not be scanned + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"VM tags that indicates that VM should not be scanned", + SerializedName = @"exclusionTags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfigurationExclusionTags) })] + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfigurationExclusionTags ConfigurationExclusionTag { get; set; } + /// The scanning mode for the VM scan. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The scanning mode for the VM scan.", + SerializedName = @"scanningMode", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Default")] + string ConfigurationScanningMode { get; set; } + /// Is Microsoft Defender for Server VM scanning enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Is Microsoft Defender for Server VM scanning enabled", + SerializedName = @"enabled", + PossibleTypes = new [] { typeof(bool) })] + bool? Enabled { get; set; } + + } + /// The Microsoft Defender for Server VM scanning configuration + internal partial interface IDefenderForServersAwsOfferingVMScannersInternal + + { + /// configuration for Microsoft Defender for Server VM scanning + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfiguration Configuration { get; set; } + /// The cloud role ARN in AWS for this feature + string ConfigurationCloudRoleArn { get; set; } + /// VM tags that indicates that VM should not be scanned + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfigurationExclusionTags ConfigurationExclusionTag { get; set; } + /// The scanning mode for the VM scan. + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Default")] + string ConfigurationScanningMode { get; set; } + /// Is Microsoft Defender for Server VM scanning enabled + bool? Enabled { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingVMScanners.json.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingVMScanners.json.cs new file mode 100644 index 000000000000..6bf9d1a22555 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingVMScanners.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The Microsoft Defender for Server VM scanning configuration + public partial class DefenderForServersAwsOfferingVMScanners + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal DefenderForServersAwsOfferingVMScanners(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_configuration = If( json?.PropertyT("configuration"), out var __jsonConfiguration) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingVMScannersConfiguration.FromJson(__jsonConfiguration) : _configuration;} + {_enabled = If( json?.PropertyT("enabled"), out var __jsonEnabled) ? (bool?)__jsonEnabled : _enabled;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScanners. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScanners. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScanners FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DefenderForServersAwsOfferingVMScanners(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._configuration ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._configuration.ToJson(null,serializationMode) : null, "configuration" ,container.Add ); + AddIf( null != this._enabled ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonBoolean((bool)this._enabled) : null, "enabled" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingVMScannersConfiguration.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingVMScannersConfiguration.PowerShell.cs new file mode 100644 index 000000000000..d65f55d88c07 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingVMScannersConfiguration.PowerShell.cs @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// configuration for Microsoft Defender for Server VM scanning + [System.ComponentModel.TypeConverter(typeof(DefenderForServersAwsOfferingVMScannersConfigurationTypeConverter))] + public partial class DefenderForServersAwsOfferingVMScannersConfiguration + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DefenderForServersAwsOfferingVMScannersConfiguration(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfigurationInternal)this).CloudRoleArn = (string) content.GetValueForProperty("CloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfigurationInternal)this).CloudRoleArn, global::System.Convert.ToString); + } + if (content.Contains("ScanningMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfigurationInternal)this).ScanningMode = (string) content.GetValueForProperty("ScanningMode",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfigurationInternal)this).ScanningMode, global::System.Convert.ToString); + } + if (content.Contains("ExclusionTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfigurationInternal)this).ExclusionTag = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfigurationExclusionTags) content.GetValueForProperty("ExclusionTag",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfigurationInternal)this).ExclusionTag, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingVMScannersConfigurationExclusionTagsTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DefenderForServersAwsOfferingVMScannersConfiguration(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfigurationInternal)this).CloudRoleArn = (string) content.GetValueForProperty("CloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfigurationInternal)this).CloudRoleArn, global::System.Convert.ToString); + } + if (content.Contains("ScanningMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfigurationInternal)this).ScanningMode = (string) content.GetValueForProperty("ScanningMode",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfigurationInternal)this).ScanningMode, global::System.Convert.ToString); + } + if (content.Contains("ExclusionTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfigurationInternal)this).ExclusionTag = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfigurationExclusionTags) content.GetValueForProperty("ExclusionTag",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfigurationInternal)this).ExclusionTag, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingVMScannersConfigurationExclusionTagsTypeConverter.ConvertFrom); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfiguration DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DefenderForServersAwsOfferingVMScannersConfiguration(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfiguration DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DefenderForServersAwsOfferingVMScannersConfiguration(content); + } + + /// + /// Creates a new instance of , deserializing the content + /// from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfiguration FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// configuration for Microsoft Defender for Server VM scanning + [System.ComponentModel.TypeConverter(typeof(DefenderForServersAwsOfferingVMScannersConfigurationTypeConverter))] + public partial interface IDefenderForServersAwsOfferingVMScannersConfiguration + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingVMScannersConfiguration.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingVMScannersConfiguration.TypeConverter.cs new file mode 100644 index 000000000000..960abc3ed75f --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingVMScannersConfiguration.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DefenderForServersAwsOfferingVMScannersConfigurationTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a + /// type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfiguration ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfiguration).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DefenderForServersAwsOfferingVMScannersConfiguration.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DefenderForServersAwsOfferingVMScannersConfiguration.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DefenderForServersAwsOfferingVMScannersConfiguration.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingVMScannersConfiguration.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingVMScannersConfiguration.cs new file mode 100644 index 000000000000..c52909474aba --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingVMScannersConfiguration.cs @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// configuration for Microsoft Defender for Server VM scanning + public partial class DefenderForServersAwsOfferingVMScannersConfiguration : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfiguration, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfigurationInternal + { + + /// Backing field for property. + private string _cloudRoleArn; + + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string CloudRoleArn { get => this._cloudRoleArn; set => this._cloudRoleArn = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfigurationExclusionTags _exclusionTag; + + /// VM tags that indicates that VM should not be scanned + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfigurationExclusionTags ExclusionTag { get => (this._exclusionTag = this._exclusionTag ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingVMScannersConfigurationExclusionTags()); set => this._exclusionTag = value; } + + /// Backing field for property. + private string _scanningMode; + + /// The scanning mode for the VM scan. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string ScanningMode { get => this._scanningMode; set => this._scanningMode = value; } + + /// + /// Creates an new instance. + /// + public DefenderForServersAwsOfferingVMScannersConfiguration() + { + + } + } + /// configuration for Microsoft Defender for Server VM scanning + public partial interface IDefenderForServersAwsOfferingVMScannersConfiguration : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The cloud role ARN in AWS for this feature", + SerializedName = @"cloudRoleArn", + PossibleTypes = new [] { typeof(string) })] + string CloudRoleArn { get; set; } + /// VM tags that indicates that VM should not be scanned + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"VM tags that indicates that VM should not be scanned", + SerializedName = @"exclusionTags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfigurationExclusionTags) })] + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfigurationExclusionTags ExclusionTag { get; set; } + /// The scanning mode for the VM scan. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The scanning mode for the VM scan.", + SerializedName = @"scanningMode", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Default")] + string ScanningMode { get; set; } + + } + /// configuration for Microsoft Defender for Server VM scanning + internal partial interface IDefenderForServersAwsOfferingVMScannersConfigurationInternal + + { + /// The cloud role ARN in AWS for this feature + string CloudRoleArn { get; set; } + /// VM tags that indicates that VM should not be scanned + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfigurationExclusionTags ExclusionTag { get; set; } + /// The scanning mode for the VM scan. + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Default")] + string ScanningMode { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingVMScannersConfiguration.json.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingVMScannersConfiguration.json.cs new file mode 100644 index 000000000000..a748953a7595 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingVMScannersConfiguration.json.cs @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// configuration for Microsoft Defender for Server VM scanning + public partial class DefenderForServersAwsOfferingVMScannersConfiguration + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal DefenderForServersAwsOfferingVMScannersConfiguration(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_cloudRoleArn = If( json?.PropertyT("cloudRoleArn"), out var __jsonCloudRoleArn) ? (string)__jsonCloudRoleArn : (string)_cloudRoleArn;} + {_scanningMode = If( json?.PropertyT("scanningMode"), out var __jsonScanningMode) ? (string)__jsonScanningMode : (string)_scanningMode;} + {_exclusionTag = If( json?.PropertyT("exclusionTags"), out var __jsonExclusionTags) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingVMScannersConfigurationExclusionTags.FromJson(__jsonExclusionTags) : _exclusionTag;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfiguration. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfiguration. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfiguration FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DefenderForServersAwsOfferingVMScannersConfiguration(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._cloudRoleArn)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._cloudRoleArn.ToString()) : null, "cloudRoleArn" ,container.Add ); + AddIf( null != (((object)this._scanningMode)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._scanningMode.ToString()) : null, "scanningMode" ,container.Add ); + AddIf( null != this._exclusionTag ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._exclusionTag.ToJson(null,serializationMode) : null, "exclusionTags" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingVMScannersConfigurationExclusionTags.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingVMScannersConfigurationExclusionTags.PowerShell.cs new file mode 100644 index 000000000000..8041dd6f64f0 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingVMScannersConfigurationExclusionTags.PowerShell.cs @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// VM tags that indicates that VM should not be scanned + [System.ComponentModel.TypeConverter(typeof(DefenderForServersAwsOfferingVMScannersConfigurationExclusionTagsTypeConverter))] + public partial class DefenderForServersAwsOfferingVMScannersConfigurationExclusionTags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DefenderForServersAwsOfferingVMScannersConfigurationExclusionTags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DefenderForServersAwsOfferingVMScannersConfigurationExclusionTags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfigurationExclusionTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DefenderForServersAwsOfferingVMScannersConfigurationExclusionTags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfigurationExclusionTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DefenderForServersAwsOfferingVMScannersConfigurationExclusionTags(content); + } + + /// + /// Creates a new instance of , deserializing + /// the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfigurationExclusionTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// VM tags that indicates that VM should not be scanned + [System.ComponentModel.TypeConverter(typeof(DefenderForServersAwsOfferingVMScannersConfigurationExclusionTagsTypeConverter))] + public partial interface IDefenderForServersAwsOfferingVMScannersConfigurationExclusionTags + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingVMScannersConfigurationExclusionTags.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingVMScannersConfigurationExclusionTags.TypeConverter.cs new file mode 100644 index 000000000000..2352310ec44e --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingVMScannersConfigurationExclusionTags.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DefenderForServersAwsOfferingVMScannersConfigurationExclusionTagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there + /// is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there + /// is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfigurationExclusionTags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfigurationExclusionTags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DefenderForServersAwsOfferingVMScannersConfigurationExclusionTags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DefenderForServersAwsOfferingVMScannersConfigurationExclusionTags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DefenderForServersAwsOfferingVMScannersConfigurationExclusionTags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingVMScannersConfigurationExclusionTags.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingVMScannersConfigurationExclusionTags.cs new file mode 100644 index 000000000000..b3f12c400301 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingVMScannersConfigurationExclusionTags.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// VM tags that indicates that VM should not be scanned + public partial class DefenderForServersAwsOfferingVMScannersConfigurationExclusionTags : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfigurationExclusionTags, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfigurationExclusionTagsInternal + { + + /// + /// Creates an new instance. + /// + public DefenderForServersAwsOfferingVMScannersConfigurationExclusionTags() + { + + } + } + /// VM tags that indicates that VM should not be scanned + public partial interface IDefenderForServersAwsOfferingVMScannersConfigurationExclusionTags : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray + { + + } + /// VM tags that indicates that VM should not be scanned + internal partial interface IDefenderForServersAwsOfferingVMScannersConfigurationExclusionTagsInternal + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingVMScannersConfigurationExclusionTags.dictionary.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingVMScannersConfigurationExclusionTags.dictionary.cs new file mode 100644 index 000000000000..efef47272755 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingVMScannersConfigurationExclusionTags.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + public partial class DefenderForServersAwsOfferingVMScannersConfigurationExclusionTags : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingVMScannersConfigurationExclusionTags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingVMScannersConfigurationExclusionTags.json.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingVMScannersConfigurationExclusionTags.json.cs new file mode 100644 index 000000000000..ff3529e9a98a --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingVMScannersConfigurationExclusionTags.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// VM tags that indicates that VM should not be scanned + public partial class DefenderForServersAwsOfferingVMScannersConfigurationExclusionTags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + /// + internal DefenderForServersAwsOfferingVMScannersConfigurationExclusionTags(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfigurationExclusionTags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfigurationExclusionTags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfigurationExclusionTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DefenderForServersAwsOfferingVMScannersConfigurationExclusionTags(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingVaAutoProvisioning.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingVaAutoProvisioning.PowerShell.cs new file mode 100644 index 000000000000..b8bc2ec7e0a5 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingVaAutoProvisioning.PowerShell.cs @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The Vulnerability Assessment autoprovisioning configuration + [System.ComponentModel.TypeConverter(typeof(DefenderForServersAwsOfferingVaAutoProvisioningTypeConverter))] + public partial class DefenderForServersAwsOfferingVaAutoProvisioning + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DefenderForServersAwsOfferingVaAutoProvisioning(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Configuration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVaAutoProvisioningInternal)this).Configuration = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVaAutoProvisioningConfiguration) content.GetValueForProperty("Configuration",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVaAutoProvisioningInternal)this).Configuration, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingVaAutoProvisioningConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("Enabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVaAutoProvisioningInternal)this).Enabled = (bool?) content.GetValueForProperty("Enabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVaAutoProvisioningInternal)this).Enabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ConfigurationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVaAutoProvisioningInternal)this).ConfigurationType = (string) content.GetValueForProperty("ConfigurationType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVaAutoProvisioningInternal)this).ConfigurationType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DefenderForServersAwsOfferingVaAutoProvisioning(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Configuration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVaAutoProvisioningInternal)this).Configuration = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVaAutoProvisioningConfiguration) content.GetValueForProperty("Configuration",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVaAutoProvisioningInternal)this).Configuration, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingVaAutoProvisioningConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("Enabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVaAutoProvisioningInternal)this).Enabled = (bool?) content.GetValueForProperty("Enabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVaAutoProvisioningInternal)this).Enabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ConfigurationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVaAutoProvisioningInternal)this).ConfigurationType = (string) content.GetValueForProperty("ConfigurationType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVaAutoProvisioningInternal)this).ConfigurationType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVaAutoProvisioning DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DefenderForServersAwsOfferingVaAutoProvisioning(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVaAutoProvisioning DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DefenderForServersAwsOfferingVaAutoProvisioning(content); + } + + /// + /// Creates a new instance of , deserializing the content from + /// a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVaAutoProvisioning FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The Vulnerability Assessment autoprovisioning configuration + [System.ComponentModel.TypeConverter(typeof(DefenderForServersAwsOfferingVaAutoProvisioningTypeConverter))] + public partial interface IDefenderForServersAwsOfferingVaAutoProvisioning + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingVaAutoProvisioning.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingVaAutoProvisioning.TypeConverter.cs new file mode 100644 index 000000000000..c312706e3291 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingVaAutoProvisioning.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DefenderForServersAwsOfferingVaAutoProvisioningTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, + /// otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVaAutoProvisioning ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVaAutoProvisioning).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DefenderForServersAwsOfferingVaAutoProvisioning.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DefenderForServersAwsOfferingVaAutoProvisioning.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DefenderForServersAwsOfferingVaAutoProvisioning.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingVaAutoProvisioning.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingVaAutoProvisioning.cs new file mode 100644 index 000000000000..527d94470d12 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingVaAutoProvisioning.cs @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The Vulnerability Assessment autoprovisioning configuration + public partial class DefenderForServersAwsOfferingVaAutoProvisioning : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVaAutoProvisioning, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVaAutoProvisioningInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVaAutoProvisioningConfiguration _configuration; + + /// configuration for Vulnerability Assessment autoprovisioning + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVaAutoProvisioningConfiguration Configuration { get => (this._configuration = this._configuration ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingVaAutoProvisioningConfiguration()); set => this._configuration = value; } + + /// + /// The Vulnerability Assessment solution to be provisioned. Can be either 'TVM' or 'Qualys' + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string ConfigurationType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVaAutoProvisioningConfigurationInternal)Configuration).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVaAutoProvisioningConfigurationInternal)Configuration).Type = value ?? null; } + + /// Backing field for property. + private bool? _enabled; + + /// Is Vulnerability Assessment auto provisioning enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public bool? Enabled { get => this._enabled; set => this._enabled = value; } + + /// Internal Acessors for Configuration + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVaAutoProvisioningConfiguration Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVaAutoProvisioningInternal.Configuration { get => (this._configuration = this._configuration ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingVaAutoProvisioningConfiguration()); set { {_configuration = value;} } } + + /// + /// Creates an new instance. + /// + public DefenderForServersAwsOfferingVaAutoProvisioning() + { + + } + } + /// The Vulnerability Assessment autoprovisioning configuration + public partial interface IDefenderForServersAwsOfferingVaAutoProvisioning : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// + /// The Vulnerability Assessment solution to be provisioned. Can be either 'TVM' or 'Qualys' + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The Vulnerability Assessment solution to be provisioned. Can be either 'TVM' or 'Qualys'", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Qualys", "TVM")] + string ConfigurationType { get; set; } + /// Is Vulnerability Assessment auto provisioning enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Is Vulnerability Assessment auto provisioning enabled", + SerializedName = @"enabled", + PossibleTypes = new [] { typeof(bool) })] + bool? Enabled { get; set; } + + } + /// The Vulnerability Assessment autoprovisioning configuration + internal partial interface IDefenderForServersAwsOfferingVaAutoProvisioningInternal + + { + /// configuration for Vulnerability Assessment autoprovisioning + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVaAutoProvisioningConfiguration Configuration { get; set; } + /// + /// The Vulnerability Assessment solution to be provisioned. Can be either 'TVM' or 'Qualys' + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Qualys", "TVM")] + string ConfigurationType { get; set; } + /// Is Vulnerability Assessment auto provisioning enabled + bool? Enabled { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingVaAutoProvisioning.json.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingVaAutoProvisioning.json.cs new file mode 100644 index 000000000000..9c9135178cf7 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingVaAutoProvisioning.json.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The Vulnerability Assessment autoprovisioning configuration + public partial class DefenderForServersAwsOfferingVaAutoProvisioning + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal DefenderForServersAwsOfferingVaAutoProvisioning(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_configuration = If( json?.PropertyT("configuration"), out var __jsonConfiguration) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOfferingVaAutoProvisioningConfiguration.FromJson(__jsonConfiguration) : _configuration;} + {_enabled = If( json?.PropertyT("enabled"), out var __jsonEnabled) ? (bool?)__jsonEnabled : _enabled;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVaAutoProvisioning. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVaAutoProvisioning. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVaAutoProvisioning FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DefenderForServersAwsOfferingVaAutoProvisioning(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._configuration ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._configuration.ToJson(null,serializationMode) : null, "configuration" ,container.Add ); + AddIf( null != this._enabled ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonBoolean((bool)this._enabled) : null, "enabled" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingVaAutoProvisioningConfiguration.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingVaAutoProvisioningConfiguration.PowerShell.cs new file mode 100644 index 000000000000..7d19a7038842 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingVaAutoProvisioningConfiguration.PowerShell.cs @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// configuration for Vulnerability Assessment autoprovisioning + [System.ComponentModel.TypeConverter(typeof(DefenderForServersAwsOfferingVaAutoProvisioningConfigurationTypeConverter))] + public partial class DefenderForServersAwsOfferingVaAutoProvisioningConfiguration + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DefenderForServersAwsOfferingVaAutoProvisioningConfiguration(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVaAutoProvisioningConfigurationInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVaAutoProvisioningConfigurationInternal)this).Type, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DefenderForServersAwsOfferingVaAutoProvisioningConfiguration(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVaAutoProvisioningConfigurationInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVaAutoProvisioningConfigurationInternal)this).Type, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVaAutoProvisioningConfiguration DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DefenderForServersAwsOfferingVaAutoProvisioningConfiguration(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVaAutoProvisioningConfiguration DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DefenderForServersAwsOfferingVaAutoProvisioningConfiguration(content); + } + + /// + /// Creates a new instance of , deserializing the + /// content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVaAutoProvisioningConfiguration FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// configuration for Vulnerability Assessment autoprovisioning + [System.ComponentModel.TypeConverter(typeof(DefenderForServersAwsOfferingVaAutoProvisioningConfigurationTypeConverter))] + public partial interface IDefenderForServersAwsOfferingVaAutoProvisioningConfiguration + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingVaAutoProvisioningConfiguration.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingVaAutoProvisioningConfiguration.TypeConverter.cs new file mode 100644 index 000000000000..4ede9d52da0d --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingVaAutoProvisioningConfiguration.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DefenderForServersAwsOfferingVaAutoProvisioningConfigurationTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is + /// no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is + /// no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVaAutoProvisioningConfiguration ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVaAutoProvisioningConfiguration).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DefenderForServersAwsOfferingVaAutoProvisioningConfiguration.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DefenderForServersAwsOfferingVaAutoProvisioningConfiguration.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DefenderForServersAwsOfferingVaAutoProvisioningConfiguration.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingVaAutoProvisioningConfiguration.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingVaAutoProvisioningConfiguration.cs new file mode 100644 index 000000000000..dd88d65272ac --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingVaAutoProvisioningConfiguration.cs @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// configuration for Vulnerability Assessment autoprovisioning + public partial class DefenderForServersAwsOfferingVaAutoProvisioningConfiguration : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVaAutoProvisioningConfiguration, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVaAutoProvisioningConfigurationInternal + { + + /// Backing field for property. + private string _type; + + /// + /// The Vulnerability Assessment solution to be provisioned. Can be either 'TVM' or 'Qualys' + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string Type { get => this._type; set => this._type = value; } + + /// + /// Creates an new instance. + /// + public DefenderForServersAwsOfferingVaAutoProvisioningConfiguration() + { + + } + } + /// configuration for Vulnerability Assessment autoprovisioning + public partial interface IDefenderForServersAwsOfferingVaAutoProvisioningConfiguration : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// + /// The Vulnerability Assessment solution to be provisioned. Can be either 'TVM' or 'Qualys' + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The Vulnerability Assessment solution to be provisioned. Can be either 'TVM' or 'Qualys'", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Qualys", "TVM")] + string Type { get; set; } + + } + /// configuration for Vulnerability Assessment autoprovisioning + internal partial interface IDefenderForServersAwsOfferingVaAutoProvisioningConfigurationInternal + + { + /// + /// The Vulnerability Assessment solution to be provisioned. Can be either 'TVM' or 'Qualys' + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Qualys", "TVM")] + string Type { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingVaAutoProvisioningConfiguration.json.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingVaAutoProvisioningConfiguration.json.cs new file mode 100644 index 000000000000..f0ceaeb2f12d --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersAwsOfferingVaAutoProvisioningConfiguration.json.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// configuration for Vulnerability Assessment autoprovisioning + public partial class DefenderForServersAwsOfferingVaAutoProvisioningConfiguration + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal DefenderForServersAwsOfferingVaAutoProvisioningConfiguration(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_type = If( json?.PropertyT("type"), out var __jsonType) ? (string)__jsonType : (string)_type;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVaAutoProvisioningConfiguration. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVaAutoProvisioningConfiguration. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVaAutoProvisioningConfiguration FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DefenderForServersAwsOfferingVaAutoProvisioningConfiguration(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._type.ToString()) : null, "type" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOffering.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOffering.PowerShell.cs new file mode 100644 index 000000000000..2ef9fd57dfd6 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOffering.PowerShell.cs @@ -0,0 +1,348 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The Defender for Servers GCP offering configurations + [System.ComponentModel.TypeConverter(typeof(DefenderForServersGcpOfferingTypeConverter))] + public partial class DefenderForServersGcpOffering + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DefenderForServersGcpOffering(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DefenderForServer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).DefenderForServer = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingDefenderForServers) content.GetValueForProperty("DefenderForServer",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).DefenderForServer, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingDefenderForServersTypeConverter.ConvertFrom); + } + if (content.Contains("ArcAutoProvisioning")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).ArcAutoProvisioning = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioning) content.GetValueForProperty("ArcAutoProvisioning",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).ArcAutoProvisioning, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingArcAutoProvisioningTypeConverter.ConvertFrom); + } + if (content.Contains("VaAutoProvisioning")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).VaAutoProvisioning = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVaAutoProvisioning) content.GetValueForProperty("VaAutoProvisioning",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).VaAutoProvisioning, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingVaAutoProvisioningTypeConverter.ConvertFrom); + } + if (content.Contains("MdeAutoProvisioning")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).MdeAutoProvisioning = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingMdeAutoProvisioning) content.GetValueForProperty("MdeAutoProvisioning",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).MdeAutoProvisioning, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingMdeAutoProvisioningTypeConverter.ConvertFrom); + } + if (content.Contains("SubPlan")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).SubPlan = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingSubPlan) content.GetValueForProperty("SubPlan",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).SubPlan, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingSubPlanTypeConverter.ConvertFrom); + } + if (content.Contains("VMScanner")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).VMScanner = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScanners) content.GetValueForProperty("VMScanner",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).VMScanner, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingVMScannersTypeConverter.ConvertFrom); + } + if (content.Contains("OfferingType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType = (string) content.GetValueForProperty("OfferingType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType, global::System.Convert.ToString); + } + if (content.Contains("Description")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description, global::System.Convert.ToString); + } + if (content.Contains("SubPlanType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).SubPlanType = (string) content.GetValueForProperty("SubPlanType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).SubPlanType, global::System.Convert.ToString); + } + if (content.Contains("DefenderForServerWorkloadIdentityProviderId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).DefenderForServerWorkloadIdentityProviderId = (string) content.GetValueForProperty("DefenderForServerWorkloadIdentityProviderId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).DefenderForServerWorkloadIdentityProviderId, global::System.Convert.ToString); + } + if (content.Contains("DefenderForServerServiceAccountEmailAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).DefenderForServerServiceAccountEmailAddress = (string) content.GetValueForProperty("DefenderForServerServiceAccountEmailAddress",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).DefenderForServerServiceAccountEmailAddress, global::System.Convert.ToString); + } + if (content.Contains("ArcAutoProvisioningConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).ArcAutoProvisioningConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioningConfiguration) content.GetValueForProperty("ArcAutoProvisioningConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).ArcAutoProvisioningConfiguration, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingArcAutoProvisioningConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("ArcAutoProvisioningEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).ArcAutoProvisioningEnabled = (bool?) content.GetValueForProperty("ArcAutoProvisioningEnabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).ArcAutoProvisioningEnabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("VaAutoProvisioningConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).VaAutoProvisioningConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVaAutoProvisioningConfiguration) content.GetValueForProperty("VaAutoProvisioningConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).VaAutoProvisioningConfiguration, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingVaAutoProvisioningConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("VaAutoProvisioningEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).VaAutoProvisioningEnabled = (bool?) content.GetValueForProperty("VaAutoProvisioningEnabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).VaAutoProvisioningEnabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ConfigurationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).ConfigurationType = (string) content.GetValueForProperty("ConfigurationType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).ConfigurationType, global::System.Convert.ToString); + } + if (content.Contains("MdeAutoProvisioningEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).MdeAutoProvisioningEnabled = (bool?) content.GetValueForProperty("MdeAutoProvisioningEnabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).MdeAutoProvisioningEnabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("MdeAutoProvisioningConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).MdeAutoProvisioningConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAny) content.GetValueForProperty("MdeAutoProvisioningConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).MdeAutoProvisioningConfiguration, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AnyTypeConverter.ConvertFrom); + } + if (content.Contains("VMScannerConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).VMScannerConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersConfiguration) content.GetValueForProperty("VMScannerConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).VMScannerConfiguration, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingVMScannersConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("VMScannerEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).VMScannerEnabled = (bool?) content.GetValueForProperty("VMScannerEnabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).VMScannerEnabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ConfigurationScanningMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).ConfigurationScanningMode = (string) content.GetValueForProperty("ConfigurationScanningMode",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).ConfigurationScanningMode, global::System.Convert.ToString); + } + if (content.Contains("ConfigurationProxy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).ConfigurationProxy = (string) content.GetValueForProperty("ConfigurationProxy",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).ConfigurationProxy, global::System.Convert.ToString); + } + if (content.Contains("ConfigurationPrivateLinkScope")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).ConfigurationPrivateLinkScope = (string) content.GetValueForProperty("ConfigurationPrivateLinkScope",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).ConfigurationPrivateLinkScope, global::System.Convert.ToString); + } + if (content.Contains("ConfigurationExclusionTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).ConfigurationExclusionTag = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersConfigurationExclusionTags) content.GetValueForProperty("ConfigurationExclusionTag",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).ConfigurationExclusionTag, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingVMScannersConfigurationExclusionTagsTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DefenderForServersGcpOffering(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DefenderForServer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).DefenderForServer = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingDefenderForServers) content.GetValueForProperty("DefenderForServer",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).DefenderForServer, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingDefenderForServersTypeConverter.ConvertFrom); + } + if (content.Contains("ArcAutoProvisioning")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).ArcAutoProvisioning = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioning) content.GetValueForProperty("ArcAutoProvisioning",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).ArcAutoProvisioning, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingArcAutoProvisioningTypeConverter.ConvertFrom); + } + if (content.Contains("VaAutoProvisioning")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).VaAutoProvisioning = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVaAutoProvisioning) content.GetValueForProperty("VaAutoProvisioning",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).VaAutoProvisioning, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingVaAutoProvisioningTypeConverter.ConvertFrom); + } + if (content.Contains("MdeAutoProvisioning")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).MdeAutoProvisioning = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingMdeAutoProvisioning) content.GetValueForProperty("MdeAutoProvisioning",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).MdeAutoProvisioning, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingMdeAutoProvisioningTypeConverter.ConvertFrom); + } + if (content.Contains("SubPlan")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).SubPlan = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingSubPlan) content.GetValueForProperty("SubPlan",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).SubPlan, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingSubPlanTypeConverter.ConvertFrom); + } + if (content.Contains("VMScanner")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).VMScanner = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScanners) content.GetValueForProperty("VMScanner",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).VMScanner, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingVMScannersTypeConverter.ConvertFrom); + } + if (content.Contains("OfferingType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType = (string) content.GetValueForProperty("OfferingType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType, global::System.Convert.ToString); + } + if (content.Contains("Description")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description, global::System.Convert.ToString); + } + if (content.Contains("SubPlanType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).SubPlanType = (string) content.GetValueForProperty("SubPlanType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).SubPlanType, global::System.Convert.ToString); + } + if (content.Contains("DefenderForServerWorkloadIdentityProviderId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).DefenderForServerWorkloadIdentityProviderId = (string) content.GetValueForProperty("DefenderForServerWorkloadIdentityProviderId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).DefenderForServerWorkloadIdentityProviderId, global::System.Convert.ToString); + } + if (content.Contains("DefenderForServerServiceAccountEmailAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).DefenderForServerServiceAccountEmailAddress = (string) content.GetValueForProperty("DefenderForServerServiceAccountEmailAddress",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).DefenderForServerServiceAccountEmailAddress, global::System.Convert.ToString); + } + if (content.Contains("ArcAutoProvisioningConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).ArcAutoProvisioningConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioningConfiguration) content.GetValueForProperty("ArcAutoProvisioningConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).ArcAutoProvisioningConfiguration, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingArcAutoProvisioningConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("ArcAutoProvisioningEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).ArcAutoProvisioningEnabled = (bool?) content.GetValueForProperty("ArcAutoProvisioningEnabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).ArcAutoProvisioningEnabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("VaAutoProvisioningConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).VaAutoProvisioningConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVaAutoProvisioningConfiguration) content.GetValueForProperty("VaAutoProvisioningConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).VaAutoProvisioningConfiguration, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingVaAutoProvisioningConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("VaAutoProvisioningEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).VaAutoProvisioningEnabled = (bool?) content.GetValueForProperty("VaAutoProvisioningEnabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).VaAutoProvisioningEnabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ConfigurationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).ConfigurationType = (string) content.GetValueForProperty("ConfigurationType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).ConfigurationType, global::System.Convert.ToString); + } + if (content.Contains("MdeAutoProvisioningEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).MdeAutoProvisioningEnabled = (bool?) content.GetValueForProperty("MdeAutoProvisioningEnabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).MdeAutoProvisioningEnabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("MdeAutoProvisioningConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).MdeAutoProvisioningConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAny) content.GetValueForProperty("MdeAutoProvisioningConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).MdeAutoProvisioningConfiguration, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AnyTypeConverter.ConvertFrom); + } + if (content.Contains("VMScannerConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).VMScannerConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersConfiguration) content.GetValueForProperty("VMScannerConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).VMScannerConfiguration, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingVMScannersConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("VMScannerEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).VMScannerEnabled = (bool?) content.GetValueForProperty("VMScannerEnabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).VMScannerEnabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ConfigurationScanningMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).ConfigurationScanningMode = (string) content.GetValueForProperty("ConfigurationScanningMode",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).ConfigurationScanningMode, global::System.Convert.ToString); + } + if (content.Contains("ConfigurationProxy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).ConfigurationProxy = (string) content.GetValueForProperty("ConfigurationProxy",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).ConfigurationProxy, global::System.Convert.ToString); + } + if (content.Contains("ConfigurationPrivateLinkScope")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).ConfigurationPrivateLinkScope = (string) content.GetValueForProperty("ConfigurationPrivateLinkScope",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).ConfigurationPrivateLinkScope, global::System.Convert.ToString); + } + if (content.Contains("ConfigurationExclusionTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).ConfigurationExclusionTag = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersConfigurationExclusionTags) content.GetValueForProperty("ConfigurationExclusionTag",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal)this).ConfigurationExclusionTag, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingVMScannersConfigurationExclusionTagsTypeConverter.ConvertFrom); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOffering DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DefenderForServersGcpOffering(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOffering DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DefenderForServersGcpOffering(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOffering FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The Defender for Servers GCP offering configurations + [System.ComponentModel.TypeConverter(typeof(DefenderForServersGcpOfferingTypeConverter))] + public partial interface IDefenderForServersGcpOffering + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOffering.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOffering.TypeConverter.cs new file mode 100644 index 000000000000..ca4739c07e1f --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOffering.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DefenderForServersGcpOfferingTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOffering ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOffering).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DefenderForServersGcpOffering.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DefenderForServersGcpOffering.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DefenderForServersGcpOffering.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOffering.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOffering.cs new file mode 100644 index 000000000000..05cbf2bb6644 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOffering.cs @@ -0,0 +1,384 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The Defender for Servers GCP offering configurations + public partial class DefenderForServersGcpOffering : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOffering, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOffering __cloudOffering = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CloudOffering(); + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioning _arcAutoProvisioning; + + /// The ARC autoprovisioning configuration + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioning ArcAutoProvisioning { get => (this._arcAutoProvisioning = this._arcAutoProvisioning ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingArcAutoProvisioning()); set => this._arcAutoProvisioning = value; } + + /// Is arc auto provisioning enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public bool? ArcAutoProvisioningEnabled { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioningInternal)ArcAutoProvisioning).Enabled; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioningInternal)ArcAutoProvisioning).Enabled = value ?? default(bool); } + + /// VM tags that indicate that VM should not be scanned + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersConfigurationExclusionTags ConfigurationExclusionTag { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersInternal)VMScanner).ConfigurationExclusionTag; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersInternal)VMScanner).ConfigurationExclusionTag = value ?? null /* model class */; } + + /// Optional Arc private link scope resource id to link the Arc agent + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string ConfigurationPrivateLinkScope { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioningInternal)ArcAutoProvisioning).ConfigurationPrivateLinkScope; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioningInternal)ArcAutoProvisioning).ConfigurationPrivateLinkScope = value ?? null; } + + /// Optional HTTP proxy endpoint to use for the Arc agent + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string ConfigurationProxy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioningInternal)ArcAutoProvisioning).ConfigurationProxy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioningInternal)ArcAutoProvisioning).ConfigurationProxy = value ?? null; } + + /// The scanning mode for the VM scan. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string ConfigurationScanningMode { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersInternal)VMScanner).ConfigurationScanningMode; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersInternal)VMScanner).ConfigurationScanningMode = value ?? null; } + + /// + /// The Vulnerability Assessment solution to be provisioned. Can be either 'TVM' or 'Qualys' + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string ConfigurationType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVaAutoProvisioningInternal)VaAutoProvisioning).ConfigurationType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVaAutoProvisioningInternal)VaAutoProvisioning).ConfigurationType = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingDefenderForServers _defenderForServer; + + /// The Defender for servers connection configuration + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingDefenderForServers DefenderForServer { get => (this._defenderForServer = this._defenderForServer ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingDefenderForServers()); set => this._defenderForServer = value; } + + /// The service account email address in GCP for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string DefenderForServerServiceAccountEmailAddress { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingDefenderForServersInternal)DefenderForServer).ServiceAccountEmailAddress; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingDefenderForServersInternal)DefenderForServer).ServiceAccountEmailAddress = value ?? null; } + + /// The workload identity provider id in GCP for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string DefenderForServerWorkloadIdentityProviderId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingDefenderForServersInternal)DefenderForServer).WorkloadIdentityProviderId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingDefenderForServersInternal)DefenderForServer).WorkloadIdentityProviderId = value ?? null; } + + /// The offering description. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string Description { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)__cloudOffering).Description; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingMdeAutoProvisioning _mdeAutoProvisioning; + + /// The Microsoft Defender for Endpoint autoprovisioning configuration + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingMdeAutoProvisioning MdeAutoProvisioning { get => (this._mdeAutoProvisioning = this._mdeAutoProvisioning ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingMdeAutoProvisioning()); set => this._mdeAutoProvisioning = value; } + + /// configuration for Microsoft Defender for Endpoint autoprovisioning + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAny MdeAutoProvisioningConfiguration { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingMdeAutoProvisioningInternal)MdeAutoProvisioning).Configuration; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingMdeAutoProvisioningInternal)MdeAutoProvisioning).Configuration = value ?? null /* model class */; } + + /// Is Microsoft Defender for Endpoint auto provisioning enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public bool? MdeAutoProvisioningEnabled { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingMdeAutoProvisioningInternal)MdeAutoProvisioning).Enabled; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingMdeAutoProvisioningInternal)MdeAutoProvisioning).Enabled = value ?? default(bool); } + + /// Internal Acessors for Description + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal.Description { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)__cloudOffering).Description; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)__cloudOffering).Description = value; } + + /// Internal Acessors for ArcAutoProvisioning + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioning Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal.ArcAutoProvisioning { get => (this._arcAutoProvisioning = this._arcAutoProvisioning ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingArcAutoProvisioning()); set { {_arcAutoProvisioning = value;} } } + + /// Internal Acessors for ArcAutoProvisioningConfiguration + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioningConfiguration Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal.ArcAutoProvisioningConfiguration { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioningInternal)ArcAutoProvisioning).Configuration; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioningInternal)ArcAutoProvisioning).Configuration = value; } + + /// Internal Acessors for DefenderForServer + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingDefenderForServers Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal.DefenderForServer { get => (this._defenderForServer = this._defenderForServer ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingDefenderForServers()); set { {_defenderForServer = value;} } } + + /// Internal Acessors for MdeAutoProvisioning + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingMdeAutoProvisioning Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal.MdeAutoProvisioning { get => (this._mdeAutoProvisioning = this._mdeAutoProvisioning ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingMdeAutoProvisioning()); set { {_mdeAutoProvisioning = value;} } } + + /// Internal Acessors for SubPlan + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingSubPlan Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal.SubPlan { get => (this._subPlan = this._subPlan ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingSubPlan()); set { {_subPlan = value;} } } + + /// Internal Acessors for VMScanner + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScanners Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal.VMScanner { get => (this._vMScanner = this._vMScanner ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingVMScanners()); set { {_vMScanner = value;} } } + + /// Internal Acessors for VMScannerConfiguration + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersConfiguration Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal.VMScannerConfiguration { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersInternal)VMScanner).Configuration; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersInternal)VMScanner).Configuration = value; } + + /// Internal Acessors for VaAutoProvisioning + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVaAutoProvisioning Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal.VaAutoProvisioning { get => (this._vaAutoProvisioning = this._vaAutoProvisioning ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingVaAutoProvisioning()); set { {_vaAutoProvisioning = value;} } } + + /// Internal Acessors for VaAutoProvisioningConfiguration + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVaAutoProvisioningConfiguration Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingInternal.VaAutoProvisioningConfiguration { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVaAutoProvisioningInternal)VaAutoProvisioning).Configuration; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVaAutoProvisioningInternal)VaAutoProvisioning).Configuration = value; } + + /// The type of the security offering. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Constant] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string OfferingType { get => "DefenderForServersGcp"; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)__cloudOffering).OfferingType = "DefenderForServersGcp"; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingSubPlan _subPlan; + + /// configuration for the servers offering subPlan + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingSubPlan SubPlan { get => (this._subPlan = this._subPlan ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingSubPlan()); set => this._subPlan = value; } + + /// The available sub plans + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string SubPlanType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingSubPlanInternal)SubPlan).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingSubPlanInternal)SubPlan).Type = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScanners _vMScanner; + + /// The Microsoft Defender for Server VM scanning configuration + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScanners VMScanner { get => (this._vMScanner = this._vMScanner ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingVMScanners()); set => this._vMScanner = value; } + + /// Is Microsoft Defender for Server VM scanning enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public bool? VMScannerEnabled { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersInternal)VMScanner).Enabled; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersInternal)VMScanner).Enabled = value ?? default(bool); } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVaAutoProvisioning _vaAutoProvisioning; + + /// The Vulnerability Assessment autoprovisioning configuration + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVaAutoProvisioning VaAutoProvisioning { get => (this._vaAutoProvisioning = this._vaAutoProvisioning ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingVaAutoProvisioning()); set => this._vaAutoProvisioning = value; } + + /// Is Vulnerability Assessment auto provisioning enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public bool? VaAutoProvisioningEnabled { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVaAutoProvisioningInternal)VaAutoProvisioning).Enabled; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVaAutoProvisioningInternal)VaAutoProvisioning).Enabled = value ?? default(bool); } + + /// Creates an new instance. + public DefenderForServersGcpOffering() + { + this.__cloudOffering.OfferingType = "DefenderForServersGcp"; + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__cloudOffering), __cloudOffering); + await eventListener.AssertObjectIsValid(nameof(__cloudOffering), __cloudOffering); + } + } + /// The Defender for Servers GCP offering configurations + public partial interface IDefenderForServersGcpOffering : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOffering + { + /// Is arc auto provisioning enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Is arc auto provisioning enabled", + SerializedName = @"enabled", + PossibleTypes = new [] { typeof(bool) })] + bool? ArcAutoProvisioningEnabled { get; set; } + /// VM tags that indicate that VM should not be scanned + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"VM tags that indicate that VM should not be scanned", + SerializedName = @"exclusionTags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersConfigurationExclusionTags) })] + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersConfigurationExclusionTags ConfigurationExclusionTag { get; set; } + /// Optional Arc private link scope resource id to link the Arc agent + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Optional Arc private link scope resource id to link the Arc agent", + SerializedName = @"privateLinkScope", + PossibleTypes = new [] { typeof(string) })] + string ConfigurationPrivateLinkScope { get; set; } + /// Optional HTTP proxy endpoint to use for the Arc agent + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Optional HTTP proxy endpoint to use for the Arc agent", + SerializedName = @"proxy", + PossibleTypes = new [] { typeof(string) })] + string ConfigurationProxy { get; set; } + /// The scanning mode for the VM scan. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The scanning mode for the VM scan.", + SerializedName = @"scanningMode", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Default")] + string ConfigurationScanningMode { get; set; } + /// + /// The Vulnerability Assessment solution to be provisioned. Can be either 'TVM' or 'Qualys' + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The Vulnerability Assessment solution to be provisioned. Can be either 'TVM' or 'Qualys'", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Qualys", "TVM")] + string ConfigurationType { get; set; } + /// The service account email address in GCP for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The service account email address in GCP for this feature", + SerializedName = @"serviceAccountEmailAddress", + PossibleTypes = new [] { typeof(string) })] + string DefenderForServerServiceAccountEmailAddress { get; set; } + /// The workload identity provider id in GCP for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The workload identity provider id in GCP for this feature", + SerializedName = @"workloadIdentityProviderId", + PossibleTypes = new [] { typeof(string) })] + string DefenderForServerWorkloadIdentityProviderId { get; set; } + /// configuration for Microsoft Defender for Endpoint autoprovisioning + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"configuration for Microsoft Defender for Endpoint autoprovisioning", + SerializedName = @"configuration", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAny) })] + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAny MdeAutoProvisioningConfiguration { get; set; } + /// Is Microsoft Defender for Endpoint auto provisioning enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Is Microsoft Defender for Endpoint auto provisioning enabled", + SerializedName = @"enabled", + PossibleTypes = new [] { typeof(bool) })] + bool? MdeAutoProvisioningEnabled { get; set; } + /// The available sub plans + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The available sub plans", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("P1", "P2")] + string SubPlanType { get; set; } + /// Is Microsoft Defender for Server VM scanning enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Is Microsoft Defender for Server VM scanning enabled", + SerializedName = @"enabled", + PossibleTypes = new [] { typeof(bool) })] + bool? VMScannerEnabled { get; set; } + /// Is Vulnerability Assessment auto provisioning enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Is Vulnerability Assessment auto provisioning enabled", + SerializedName = @"enabled", + PossibleTypes = new [] { typeof(bool) })] + bool? VaAutoProvisioningEnabled { get; set; } + + } + /// The Defender for Servers GCP offering configurations + internal partial interface IDefenderForServersGcpOfferingInternal : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal + { + /// The ARC autoprovisioning configuration + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioning ArcAutoProvisioning { get; set; } + /// Configuration for servers Arc auto provisioning + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioningConfiguration ArcAutoProvisioningConfiguration { get; set; } + /// Is arc auto provisioning enabled + bool? ArcAutoProvisioningEnabled { get; set; } + /// VM tags that indicate that VM should not be scanned + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersConfigurationExclusionTags ConfigurationExclusionTag { get; set; } + /// Optional Arc private link scope resource id to link the Arc agent + string ConfigurationPrivateLinkScope { get; set; } + /// Optional HTTP proxy endpoint to use for the Arc agent + string ConfigurationProxy { get; set; } + /// The scanning mode for the VM scan. + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Default")] + string ConfigurationScanningMode { get; set; } + /// + /// The Vulnerability Assessment solution to be provisioned. Can be either 'TVM' or 'Qualys' + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Qualys", "TVM")] + string ConfigurationType { get; set; } + /// The Defender for servers connection configuration + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingDefenderForServers DefenderForServer { get; set; } + /// The service account email address in GCP for this feature + string DefenderForServerServiceAccountEmailAddress { get; set; } + /// The workload identity provider id in GCP for this feature + string DefenderForServerWorkloadIdentityProviderId { get; set; } + /// The Microsoft Defender for Endpoint autoprovisioning configuration + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingMdeAutoProvisioning MdeAutoProvisioning { get; set; } + /// configuration for Microsoft Defender for Endpoint autoprovisioning + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAny MdeAutoProvisioningConfiguration { get; set; } + /// Is Microsoft Defender for Endpoint auto provisioning enabled + bool? MdeAutoProvisioningEnabled { get; set; } + /// configuration for the servers offering subPlan + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingSubPlan SubPlan { get; set; } + /// The available sub plans + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("P1", "P2")] + string SubPlanType { get; set; } + /// The Microsoft Defender for Server VM scanning configuration + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScanners VMScanner { get; set; } + /// configuration for Microsoft Defender for Server VM scanning + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersConfiguration VMScannerConfiguration { get; set; } + /// Is Microsoft Defender for Server VM scanning enabled + bool? VMScannerEnabled { get; set; } + /// The Vulnerability Assessment autoprovisioning configuration + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVaAutoProvisioning VaAutoProvisioning { get; set; } + /// configuration for Vulnerability Assessment autoprovisioning + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVaAutoProvisioningConfiguration VaAutoProvisioningConfiguration { get; set; } + /// Is Vulnerability Assessment auto provisioning enabled + bool? VaAutoProvisioningEnabled { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOffering.json.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOffering.json.cs new file mode 100644 index 000000000000..be964d344802 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOffering.json.cs @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The Defender for Servers GCP offering configurations + public partial class DefenderForServersGcpOffering + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal DefenderForServersGcpOffering(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __cloudOffering = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CloudOffering(json); + {_defenderForServer = If( json?.PropertyT("defenderForServers"), out var __jsonDefenderForServers) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingDefenderForServers.FromJson(__jsonDefenderForServers) : _defenderForServer;} + {_arcAutoProvisioning = If( json?.PropertyT("arcAutoProvisioning"), out var __jsonArcAutoProvisioning) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingArcAutoProvisioning.FromJson(__jsonArcAutoProvisioning) : _arcAutoProvisioning;} + {_vaAutoProvisioning = If( json?.PropertyT("vaAutoProvisioning"), out var __jsonVaAutoProvisioning) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingVaAutoProvisioning.FromJson(__jsonVaAutoProvisioning) : _vaAutoProvisioning;} + {_mdeAutoProvisioning = If( json?.PropertyT("mdeAutoProvisioning"), out var __jsonMdeAutoProvisioning) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingMdeAutoProvisioning.FromJson(__jsonMdeAutoProvisioning) : _mdeAutoProvisioning;} + {_subPlan = If( json?.PropertyT("subPlan"), out var __jsonSubPlan) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingSubPlan.FromJson(__jsonSubPlan) : _subPlan;} + {_vMScanner = If( json?.PropertyT("vmScanners"), out var __jsonVMScanners) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingVMScanners.FromJson(__jsonVMScanners) : _vMScanner;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOffering. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOffering. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOffering FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DefenderForServersGcpOffering(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __cloudOffering?.ToJson(container, serializationMode); + AddIf( null != this._defenderForServer ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._defenderForServer.ToJson(null,serializationMode) : null, "defenderForServers" ,container.Add ); + AddIf( null != this._arcAutoProvisioning ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._arcAutoProvisioning.ToJson(null,serializationMode) : null, "arcAutoProvisioning" ,container.Add ); + AddIf( null != this._vaAutoProvisioning ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._vaAutoProvisioning.ToJson(null,serializationMode) : null, "vaAutoProvisioning" ,container.Add ); + AddIf( null != this._mdeAutoProvisioning ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._mdeAutoProvisioning.ToJson(null,serializationMode) : null, "mdeAutoProvisioning" ,container.Add ); + AddIf( null != this._subPlan ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._subPlan.ToJson(null,serializationMode) : null, "subPlan" ,container.Add ); + AddIf( null != this._vMScanner ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._vMScanner.ToJson(null,serializationMode) : null, "vmScanners" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingArcAutoProvisioning.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingArcAutoProvisioning.PowerShell.cs new file mode 100644 index 000000000000..ddb4d6f1fd20 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingArcAutoProvisioning.PowerShell.cs @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The ARC autoprovisioning configuration + [System.ComponentModel.TypeConverter(typeof(DefenderForServersGcpOfferingArcAutoProvisioningTypeConverter))] + public partial class DefenderForServersGcpOfferingArcAutoProvisioning + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DefenderForServersGcpOfferingArcAutoProvisioning(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Configuration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioningInternal)this).Configuration = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioningConfiguration) content.GetValueForProperty("Configuration",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioningInternal)this).Configuration, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingArcAutoProvisioningConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("Enabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioningInternal)this).Enabled = (bool?) content.GetValueForProperty("Enabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioningInternal)this).Enabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ConfigurationProxy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioningInternal)this).ConfigurationProxy = (string) content.GetValueForProperty("ConfigurationProxy",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioningInternal)this).ConfigurationProxy, global::System.Convert.ToString); + } + if (content.Contains("ConfigurationPrivateLinkScope")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioningInternal)this).ConfigurationPrivateLinkScope = (string) content.GetValueForProperty("ConfigurationPrivateLinkScope",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioningInternal)this).ConfigurationPrivateLinkScope, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DefenderForServersGcpOfferingArcAutoProvisioning(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Configuration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioningInternal)this).Configuration = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioningConfiguration) content.GetValueForProperty("Configuration",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioningInternal)this).Configuration, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingArcAutoProvisioningConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("Enabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioningInternal)this).Enabled = (bool?) content.GetValueForProperty("Enabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioningInternal)this).Enabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ConfigurationProxy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioningInternal)this).ConfigurationProxy = (string) content.GetValueForProperty("ConfigurationProxy",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioningInternal)this).ConfigurationProxy, global::System.Convert.ToString); + } + if (content.Contains("ConfigurationPrivateLinkScope")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioningInternal)this).ConfigurationPrivateLinkScope = (string) content.GetValueForProperty("ConfigurationPrivateLinkScope",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioningInternal)this).ConfigurationPrivateLinkScope, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioning DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DefenderForServersGcpOfferingArcAutoProvisioning(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioning DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DefenderForServersGcpOfferingArcAutoProvisioning(content); + } + + /// + /// Creates a new instance of , deserializing the content from + /// a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioning FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The ARC autoprovisioning configuration + [System.ComponentModel.TypeConverter(typeof(DefenderForServersGcpOfferingArcAutoProvisioningTypeConverter))] + public partial interface IDefenderForServersGcpOfferingArcAutoProvisioning + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingArcAutoProvisioning.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingArcAutoProvisioning.TypeConverter.cs new file mode 100644 index 000000000000..2a74e152b75b --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingArcAutoProvisioning.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DefenderForServersGcpOfferingArcAutoProvisioningTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, + /// otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioning ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioning).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DefenderForServersGcpOfferingArcAutoProvisioning.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DefenderForServersGcpOfferingArcAutoProvisioning.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DefenderForServersGcpOfferingArcAutoProvisioning.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingArcAutoProvisioning.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingArcAutoProvisioning.cs new file mode 100644 index 000000000000..3ba5dece64a3 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingArcAutoProvisioning.cs @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The ARC autoprovisioning configuration + public partial class DefenderForServersGcpOfferingArcAutoProvisioning : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioning, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioningInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioningConfiguration _configuration; + + /// Configuration for servers Arc auto provisioning + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioningConfiguration Configuration { get => (this._configuration = this._configuration ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingArcAutoProvisioningConfiguration()); set => this._configuration = value; } + + /// Optional Arc private link scope resource id to link the Arc agent + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string ConfigurationPrivateLinkScope { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioningConfigurationInternal)Configuration).PrivateLinkScope; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioningConfigurationInternal)Configuration).PrivateLinkScope = value ?? null; } + + /// Optional HTTP proxy endpoint to use for the Arc agent + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string ConfigurationProxy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioningConfigurationInternal)Configuration).Proxy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioningConfigurationInternal)Configuration).Proxy = value ?? null; } + + /// Backing field for property. + private bool? _enabled; + + /// Is arc auto provisioning enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public bool? Enabled { get => this._enabled; set => this._enabled = value; } + + /// Internal Acessors for Configuration + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioningConfiguration Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioningInternal.Configuration { get => (this._configuration = this._configuration ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingArcAutoProvisioningConfiguration()); set { {_configuration = value;} } } + + /// + /// Creates an new instance. + /// + public DefenderForServersGcpOfferingArcAutoProvisioning() + { + + } + } + /// The ARC autoprovisioning configuration + public partial interface IDefenderForServersGcpOfferingArcAutoProvisioning : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// Optional Arc private link scope resource id to link the Arc agent + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Optional Arc private link scope resource id to link the Arc agent", + SerializedName = @"privateLinkScope", + PossibleTypes = new [] { typeof(string) })] + string ConfigurationPrivateLinkScope { get; set; } + /// Optional HTTP proxy endpoint to use for the Arc agent + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Optional HTTP proxy endpoint to use for the Arc agent", + SerializedName = @"proxy", + PossibleTypes = new [] { typeof(string) })] + string ConfigurationProxy { get; set; } + /// Is arc auto provisioning enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Is arc auto provisioning enabled", + SerializedName = @"enabled", + PossibleTypes = new [] { typeof(bool) })] + bool? Enabled { get; set; } + + } + /// The ARC autoprovisioning configuration + internal partial interface IDefenderForServersGcpOfferingArcAutoProvisioningInternal + + { + /// Configuration for servers Arc auto provisioning + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioningConfiguration Configuration { get; set; } + /// Optional Arc private link scope resource id to link the Arc agent + string ConfigurationPrivateLinkScope { get; set; } + /// Optional HTTP proxy endpoint to use for the Arc agent + string ConfigurationProxy { get; set; } + /// Is arc auto provisioning enabled + bool? Enabled { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingArcAutoProvisioning.json.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingArcAutoProvisioning.json.cs new file mode 100644 index 000000000000..c1a48f67fb86 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingArcAutoProvisioning.json.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The ARC autoprovisioning configuration + public partial class DefenderForServersGcpOfferingArcAutoProvisioning + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal DefenderForServersGcpOfferingArcAutoProvisioning(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_configuration = If( json?.PropertyT("configuration"), out var __jsonConfiguration) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingArcAutoProvisioningConfiguration.FromJson(__jsonConfiguration) : _configuration;} + {_enabled = If( json?.PropertyT("enabled"), out var __jsonEnabled) ? (bool?)__jsonEnabled : _enabled;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioning. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioning. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioning FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DefenderForServersGcpOfferingArcAutoProvisioning(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._configuration ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._configuration.ToJson(null,serializationMode) : null, "configuration" ,container.Add ); + AddIf( null != this._enabled ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonBoolean((bool)this._enabled) : null, "enabled" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingArcAutoProvisioningConfiguration.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingArcAutoProvisioningConfiguration.PowerShell.cs new file mode 100644 index 000000000000..3051a9ff5ed6 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingArcAutoProvisioningConfiguration.PowerShell.cs @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// Configuration for servers Arc auto provisioning + [System.ComponentModel.TypeConverter(typeof(DefenderForServersGcpOfferingArcAutoProvisioningConfigurationTypeConverter))] + public partial class DefenderForServersGcpOfferingArcAutoProvisioningConfiguration + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DefenderForServersGcpOfferingArcAutoProvisioningConfiguration(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Proxy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioningConfigurationInternal)this).Proxy = (string) content.GetValueForProperty("Proxy",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioningConfigurationInternal)this).Proxy, global::System.Convert.ToString); + } + if (content.Contains("PrivateLinkScope")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioningConfigurationInternal)this).PrivateLinkScope = (string) content.GetValueForProperty("PrivateLinkScope",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioningConfigurationInternal)this).PrivateLinkScope, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DefenderForServersGcpOfferingArcAutoProvisioningConfiguration(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Proxy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioningConfigurationInternal)this).Proxy = (string) content.GetValueForProperty("Proxy",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioningConfigurationInternal)this).Proxy, global::System.Convert.ToString); + } + if (content.Contains("PrivateLinkScope")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioningConfigurationInternal)this).PrivateLinkScope = (string) content.GetValueForProperty("PrivateLinkScope",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioningConfigurationInternal)this).PrivateLinkScope, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioningConfiguration DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DefenderForServersGcpOfferingArcAutoProvisioningConfiguration(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioningConfiguration DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DefenderForServersGcpOfferingArcAutoProvisioningConfiguration(content); + } + + /// + /// Creates a new instance of , deserializing + /// the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioningConfiguration FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// Configuration for servers Arc auto provisioning + [System.ComponentModel.TypeConverter(typeof(DefenderForServersGcpOfferingArcAutoProvisioningConfigurationTypeConverter))] + public partial interface IDefenderForServersGcpOfferingArcAutoProvisioningConfiguration + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingArcAutoProvisioningConfiguration.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingArcAutoProvisioningConfiguration.TypeConverter.cs new file mode 100644 index 000000000000..b42e4fa50f0c --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingArcAutoProvisioningConfiguration.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DefenderForServersGcpOfferingArcAutoProvisioningConfigurationTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is + /// no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is + /// no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioningConfiguration ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioningConfiguration).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DefenderForServersGcpOfferingArcAutoProvisioningConfiguration.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DefenderForServersGcpOfferingArcAutoProvisioningConfiguration.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DefenderForServersGcpOfferingArcAutoProvisioningConfiguration.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingArcAutoProvisioningConfiguration.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingArcAutoProvisioningConfiguration.cs new file mode 100644 index 000000000000..264d4b5352a8 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingArcAutoProvisioningConfiguration.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// Configuration for servers Arc auto provisioning + public partial class DefenderForServersGcpOfferingArcAutoProvisioningConfiguration : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioningConfiguration, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioningConfigurationInternal + { + + /// Backing field for property. + private string _privateLinkScope; + + /// Optional Arc private link scope resource id to link the Arc agent + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string PrivateLinkScope { get => this._privateLinkScope; set => this._privateLinkScope = value; } + + /// Backing field for property. + private string _proxy; + + /// Optional HTTP proxy endpoint to use for the Arc agent + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string Proxy { get => this._proxy; set => this._proxy = value; } + + /// + /// Creates an new instance. + /// + public DefenderForServersGcpOfferingArcAutoProvisioningConfiguration() + { + + } + } + /// Configuration for servers Arc auto provisioning + public partial interface IDefenderForServersGcpOfferingArcAutoProvisioningConfiguration : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// Optional Arc private link scope resource id to link the Arc agent + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Optional Arc private link scope resource id to link the Arc agent", + SerializedName = @"privateLinkScope", + PossibleTypes = new [] { typeof(string) })] + string PrivateLinkScope { get; set; } + /// Optional HTTP proxy endpoint to use for the Arc agent + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Optional HTTP proxy endpoint to use for the Arc agent", + SerializedName = @"proxy", + PossibleTypes = new [] { typeof(string) })] + string Proxy { get; set; } + + } + /// Configuration for servers Arc auto provisioning + internal partial interface IDefenderForServersGcpOfferingArcAutoProvisioningConfigurationInternal + + { + /// Optional Arc private link scope resource id to link the Arc agent + string PrivateLinkScope { get; set; } + /// Optional HTTP proxy endpoint to use for the Arc agent + string Proxy { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingArcAutoProvisioningConfiguration.json.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingArcAutoProvisioningConfiguration.json.cs new file mode 100644 index 000000000000..3cf3b1201c35 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingArcAutoProvisioningConfiguration.json.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// Configuration for servers Arc auto provisioning + public partial class DefenderForServersGcpOfferingArcAutoProvisioningConfiguration + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal DefenderForServersGcpOfferingArcAutoProvisioningConfiguration(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_proxy = If( json?.PropertyT("proxy"), out var __jsonProxy) ? (string)__jsonProxy : (string)_proxy;} + {_privateLinkScope = If( json?.PropertyT("privateLinkScope"), out var __jsonPrivateLinkScope) ? (string)__jsonPrivateLinkScope : (string)_privateLinkScope;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioningConfiguration. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioningConfiguration. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingArcAutoProvisioningConfiguration FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DefenderForServersGcpOfferingArcAutoProvisioningConfiguration(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._proxy)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._proxy.ToString()) : null, "proxy" ,container.Add ); + AddIf( null != (((object)this._privateLinkScope)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._privateLinkScope.ToString()) : null, "privateLinkScope" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingDefenderForServers.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingDefenderForServers.PowerShell.cs new file mode 100644 index 000000000000..edf538c9e735 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingDefenderForServers.PowerShell.cs @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The Defender for servers connection configuration + [System.ComponentModel.TypeConverter(typeof(DefenderForServersGcpOfferingDefenderForServersTypeConverter))] + public partial class DefenderForServersGcpOfferingDefenderForServers + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DefenderForServersGcpOfferingDefenderForServers(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("WorkloadIdentityProviderId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingDefenderForServersInternal)this).WorkloadIdentityProviderId = (string) content.GetValueForProperty("WorkloadIdentityProviderId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingDefenderForServersInternal)this).WorkloadIdentityProviderId, global::System.Convert.ToString); + } + if (content.Contains("ServiceAccountEmailAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingDefenderForServersInternal)this).ServiceAccountEmailAddress = (string) content.GetValueForProperty("ServiceAccountEmailAddress",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingDefenderForServersInternal)this).ServiceAccountEmailAddress, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DefenderForServersGcpOfferingDefenderForServers(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("WorkloadIdentityProviderId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingDefenderForServersInternal)this).WorkloadIdentityProviderId = (string) content.GetValueForProperty("WorkloadIdentityProviderId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingDefenderForServersInternal)this).WorkloadIdentityProviderId, global::System.Convert.ToString); + } + if (content.Contains("ServiceAccountEmailAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingDefenderForServersInternal)this).ServiceAccountEmailAddress = (string) content.GetValueForProperty("ServiceAccountEmailAddress",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingDefenderForServersInternal)this).ServiceAccountEmailAddress, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingDefenderForServers DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DefenderForServersGcpOfferingDefenderForServers(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingDefenderForServers DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DefenderForServersGcpOfferingDefenderForServers(content); + } + + /// + /// Creates a new instance of , deserializing the content from + /// a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingDefenderForServers FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The Defender for servers connection configuration + [System.ComponentModel.TypeConverter(typeof(DefenderForServersGcpOfferingDefenderForServersTypeConverter))] + public partial interface IDefenderForServersGcpOfferingDefenderForServers + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingDefenderForServers.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingDefenderForServers.TypeConverter.cs new file mode 100644 index 000000000000..50a2b6ae3842 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingDefenderForServers.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DefenderForServersGcpOfferingDefenderForServersTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, + /// otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingDefenderForServers ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingDefenderForServers).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DefenderForServersGcpOfferingDefenderForServers.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DefenderForServersGcpOfferingDefenderForServers.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DefenderForServersGcpOfferingDefenderForServers.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingDefenderForServers.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingDefenderForServers.cs new file mode 100644 index 000000000000..4b5d6d4ff432 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingDefenderForServers.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The Defender for servers connection configuration + public partial class DefenderForServersGcpOfferingDefenderForServers : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingDefenderForServers, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingDefenderForServersInternal + { + + /// Backing field for property. + private string _serviceAccountEmailAddress; + + /// The service account email address in GCP for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string ServiceAccountEmailAddress { get => this._serviceAccountEmailAddress; set => this._serviceAccountEmailAddress = value; } + + /// Backing field for property. + private string _workloadIdentityProviderId; + + /// The workload identity provider id in GCP for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string WorkloadIdentityProviderId { get => this._workloadIdentityProviderId; set => this._workloadIdentityProviderId = value; } + + /// + /// Creates an new instance. + /// + public DefenderForServersGcpOfferingDefenderForServers() + { + + } + } + /// The Defender for servers connection configuration + public partial interface IDefenderForServersGcpOfferingDefenderForServers : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// The service account email address in GCP for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The service account email address in GCP for this feature", + SerializedName = @"serviceAccountEmailAddress", + PossibleTypes = new [] { typeof(string) })] + string ServiceAccountEmailAddress { get; set; } + /// The workload identity provider id in GCP for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The workload identity provider id in GCP for this feature", + SerializedName = @"workloadIdentityProviderId", + PossibleTypes = new [] { typeof(string) })] + string WorkloadIdentityProviderId { get; set; } + + } + /// The Defender for servers connection configuration + internal partial interface IDefenderForServersGcpOfferingDefenderForServersInternal + + { + /// The service account email address in GCP for this feature + string ServiceAccountEmailAddress { get; set; } + /// The workload identity provider id in GCP for this feature + string WorkloadIdentityProviderId { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingDefenderForServers.json.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingDefenderForServers.json.cs new file mode 100644 index 000000000000..3154012588e9 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingDefenderForServers.json.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The Defender for servers connection configuration + public partial class DefenderForServersGcpOfferingDefenderForServers + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal DefenderForServersGcpOfferingDefenderForServers(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_workloadIdentityProviderId = If( json?.PropertyT("workloadIdentityProviderId"), out var __jsonWorkloadIdentityProviderId) ? (string)__jsonWorkloadIdentityProviderId : (string)_workloadIdentityProviderId;} + {_serviceAccountEmailAddress = If( json?.PropertyT("serviceAccountEmailAddress"), out var __jsonServiceAccountEmailAddress) ? (string)__jsonServiceAccountEmailAddress : (string)_serviceAccountEmailAddress;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingDefenderForServers. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingDefenderForServers. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingDefenderForServers FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DefenderForServersGcpOfferingDefenderForServers(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._workloadIdentityProviderId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._workloadIdentityProviderId.ToString()) : null, "workloadIdentityProviderId" ,container.Add ); + AddIf( null != (((object)this._serviceAccountEmailAddress)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._serviceAccountEmailAddress.ToString()) : null, "serviceAccountEmailAddress" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingMdeAutoProvisioning.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingMdeAutoProvisioning.PowerShell.cs new file mode 100644 index 000000000000..6b6ea2909bf7 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingMdeAutoProvisioning.PowerShell.cs @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The Microsoft Defender for Endpoint autoprovisioning configuration + [System.ComponentModel.TypeConverter(typeof(DefenderForServersGcpOfferingMdeAutoProvisioningTypeConverter))] + public partial class DefenderForServersGcpOfferingMdeAutoProvisioning + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DefenderForServersGcpOfferingMdeAutoProvisioning(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Enabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingMdeAutoProvisioningInternal)this).Enabled = (bool?) content.GetValueForProperty("Enabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingMdeAutoProvisioningInternal)this).Enabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("Configuration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingMdeAutoProvisioningInternal)this).Configuration = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAny) content.GetValueForProperty("Configuration",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingMdeAutoProvisioningInternal)this).Configuration, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AnyTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DefenderForServersGcpOfferingMdeAutoProvisioning(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Enabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingMdeAutoProvisioningInternal)this).Enabled = (bool?) content.GetValueForProperty("Enabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingMdeAutoProvisioningInternal)this).Enabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("Configuration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingMdeAutoProvisioningInternal)this).Configuration = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAny) content.GetValueForProperty("Configuration",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingMdeAutoProvisioningInternal)this).Configuration, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AnyTypeConverter.ConvertFrom); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingMdeAutoProvisioning DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DefenderForServersGcpOfferingMdeAutoProvisioning(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingMdeAutoProvisioning DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DefenderForServersGcpOfferingMdeAutoProvisioning(content); + } + + /// + /// Creates a new instance of , deserializing the content from + /// a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingMdeAutoProvisioning FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The Microsoft Defender for Endpoint autoprovisioning configuration + [System.ComponentModel.TypeConverter(typeof(DefenderForServersGcpOfferingMdeAutoProvisioningTypeConverter))] + public partial interface IDefenderForServersGcpOfferingMdeAutoProvisioning + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingMdeAutoProvisioning.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingMdeAutoProvisioning.TypeConverter.cs new file mode 100644 index 000000000000..3df28398ac45 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingMdeAutoProvisioning.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DefenderForServersGcpOfferingMdeAutoProvisioningTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, + /// otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingMdeAutoProvisioning ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingMdeAutoProvisioning).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DefenderForServersGcpOfferingMdeAutoProvisioning.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DefenderForServersGcpOfferingMdeAutoProvisioning.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DefenderForServersGcpOfferingMdeAutoProvisioning.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingMdeAutoProvisioning.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingMdeAutoProvisioning.cs new file mode 100644 index 000000000000..de056f0bacc0 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingMdeAutoProvisioning.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The Microsoft Defender for Endpoint autoprovisioning configuration + public partial class DefenderForServersGcpOfferingMdeAutoProvisioning : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingMdeAutoProvisioning, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingMdeAutoProvisioningInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAny _configuration; + + /// configuration for Microsoft Defender for Endpoint autoprovisioning + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAny Configuration { get => (this._configuration = this._configuration ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.Any()); set => this._configuration = value; } + + /// Backing field for property. + private bool? _enabled; + + /// Is Microsoft Defender for Endpoint auto provisioning enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public bool? Enabled { get => this._enabled; set => this._enabled = value; } + + /// + /// Creates an new instance. + /// + public DefenderForServersGcpOfferingMdeAutoProvisioning() + { + + } + } + /// The Microsoft Defender for Endpoint autoprovisioning configuration + public partial interface IDefenderForServersGcpOfferingMdeAutoProvisioning : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// configuration for Microsoft Defender for Endpoint autoprovisioning + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"configuration for Microsoft Defender for Endpoint autoprovisioning", + SerializedName = @"configuration", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAny) })] + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAny Configuration { get; set; } + /// Is Microsoft Defender for Endpoint auto provisioning enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Is Microsoft Defender for Endpoint auto provisioning enabled", + SerializedName = @"enabled", + PossibleTypes = new [] { typeof(bool) })] + bool? Enabled { get; set; } + + } + /// The Microsoft Defender for Endpoint autoprovisioning configuration + internal partial interface IDefenderForServersGcpOfferingMdeAutoProvisioningInternal + + { + /// configuration for Microsoft Defender for Endpoint autoprovisioning + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAny Configuration { get; set; } + /// Is Microsoft Defender for Endpoint auto provisioning enabled + bool? Enabled { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingMdeAutoProvisioning.json.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingMdeAutoProvisioning.json.cs new file mode 100644 index 000000000000..7a895c0aaff5 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingMdeAutoProvisioning.json.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The Microsoft Defender for Endpoint autoprovisioning configuration + public partial class DefenderForServersGcpOfferingMdeAutoProvisioning + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal DefenderForServersGcpOfferingMdeAutoProvisioning(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_enabled = If( json?.PropertyT("enabled"), out var __jsonEnabled) ? (bool?)__jsonEnabled : _enabled;} + {_configuration = If( json?.PropertyT("configuration"), out var __jsonConfiguration) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.Any.FromJson(__jsonConfiguration) : _configuration;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingMdeAutoProvisioning. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingMdeAutoProvisioning. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingMdeAutoProvisioning FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DefenderForServersGcpOfferingMdeAutoProvisioning(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._enabled ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonBoolean((bool)this._enabled) : null, "enabled" ,container.Add ); + AddIf( null != this._configuration ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._configuration.ToJson(null,serializationMode) : null, "configuration" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingSubPlan.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingSubPlan.PowerShell.cs new file mode 100644 index 000000000000..171f7d071df3 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingSubPlan.PowerShell.cs @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// configuration for the servers offering subPlan + [System.ComponentModel.TypeConverter(typeof(DefenderForServersGcpOfferingSubPlanTypeConverter))] + public partial class DefenderForServersGcpOfferingSubPlan + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DefenderForServersGcpOfferingSubPlan(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingSubPlanInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingSubPlanInternal)this).Type, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DefenderForServersGcpOfferingSubPlan(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingSubPlanInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingSubPlanInternal)this).Type, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingSubPlan DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DefenderForServersGcpOfferingSubPlan(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingSubPlan DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DefenderForServersGcpOfferingSubPlan(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingSubPlan FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// configuration for the servers offering subPlan + [System.ComponentModel.TypeConverter(typeof(DefenderForServersGcpOfferingSubPlanTypeConverter))] + public partial interface IDefenderForServersGcpOfferingSubPlan + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingSubPlan.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingSubPlan.TypeConverter.cs new file mode 100644 index 000000000000..18fc39567d2c --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingSubPlan.TypeConverter.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DefenderForServersGcpOfferingSubPlanTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingSubPlan ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingSubPlan).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DefenderForServersGcpOfferingSubPlan.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DefenderForServersGcpOfferingSubPlan.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DefenderForServersGcpOfferingSubPlan.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingSubPlan.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingSubPlan.cs new file mode 100644 index 000000000000..877d2ff0eb85 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingSubPlan.cs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// configuration for the servers offering subPlan + public partial class DefenderForServersGcpOfferingSubPlan : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingSubPlan, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingSubPlanInternal + { + + /// Backing field for property. + private string _type; + + /// The available sub plans + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string Type { get => this._type; set => this._type = value; } + + /// Creates an new instance. + public DefenderForServersGcpOfferingSubPlan() + { + + } + } + /// configuration for the servers offering subPlan + public partial interface IDefenderForServersGcpOfferingSubPlan : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// The available sub plans + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The available sub plans", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("P1", "P2")] + string Type { get; set; } + + } + /// configuration for the servers offering subPlan + internal partial interface IDefenderForServersGcpOfferingSubPlanInternal + + { + /// The available sub plans + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("P1", "P2")] + string Type { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingSubPlan.json.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingSubPlan.json.cs new file mode 100644 index 000000000000..c3d5379e2882 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingSubPlan.json.cs @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// configuration for the servers offering subPlan + public partial class DefenderForServersGcpOfferingSubPlan + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal DefenderForServersGcpOfferingSubPlan(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_type = If( json?.PropertyT("type"), out var __jsonType) ? (string)__jsonType : (string)_type;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingSubPlan. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingSubPlan. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingSubPlan FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DefenderForServersGcpOfferingSubPlan(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._type.ToString()) : null, "type" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingVMScanners.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingVMScanners.PowerShell.cs new file mode 100644 index 000000000000..ded2b4b27032 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingVMScanners.PowerShell.cs @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The Microsoft Defender for Server VM scanning configuration + [System.ComponentModel.TypeConverter(typeof(DefenderForServersGcpOfferingVMScannersTypeConverter))] + public partial class DefenderForServersGcpOfferingVMScanners + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DefenderForServersGcpOfferingVMScanners(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Configuration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersInternal)this).Configuration = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersConfiguration) content.GetValueForProperty("Configuration",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersInternal)this).Configuration, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingVMScannersConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("Enabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersInternal)this).Enabled = (bool?) content.GetValueForProperty("Enabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersInternal)this).Enabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ConfigurationScanningMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersInternal)this).ConfigurationScanningMode = (string) content.GetValueForProperty("ConfigurationScanningMode",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersInternal)this).ConfigurationScanningMode, global::System.Convert.ToString); + } + if (content.Contains("ConfigurationExclusionTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersInternal)this).ConfigurationExclusionTag = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersConfigurationExclusionTags) content.GetValueForProperty("ConfigurationExclusionTag",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersInternal)this).ConfigurationExclusionTag, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingVMScannersConfigurationExclusionTagsTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DefenderForServersGcpOfferingVMScanners(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Configuration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersInternal)this).Configuration = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersConfiguration) content.GetValueForProperty("Configuration",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersInternal)this).Configuration, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingVMScannersConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("Enabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersInternal)this).Enabled = (bool?) content.GetValueForProperty("Enabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersInternal)this).Enabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ConfigurationScanningMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersInternal)this).ConfigurationScanningMode = (string) content.GetValueForProperty("ConfigurationScanningMode",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersInternal)this).ConfigurationScanningMode, global::System.Convert.ToString); + } + if (content.Contains("ConfigurationExclusionTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersInternal)this).ConfigurationExclusionTag = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersConfigurationExclusionTags) content.GetValueForProperty("ConfigurationExclusionTag",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersInternal)this).ConfigurationExclusionTag, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingVMScannersConfigurationExclusionTagsTypeConverter.ConvertFrom); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScanners DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DefenderForServersGcpOfferingVMScanners(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScanners DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DefenderForServersGcpOfferingVMScanners(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScanners FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The Microsoft Defender for Server VM scanning configuration + [System.ComponentModel.TypeConverter(typeof(DefenderForServersGcpOfferingVMScannersTypeConverter))] + public partial interface IDefenderForServersGcpOfferingVMScanners + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingVMScanners.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingVMScanners.TypeConverter.cs new file mode 100644 index 000000000000..6c2b7af3dce9 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingVMScanners.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DefenderForServersGcpOfferingVMScannersTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScanners ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScanners).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DefenderForServersGcpOfferingVMScanners.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DefenderForServersGcpOfferingVMScanners.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DefenderForServersGcpOfferingVMScanners.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingVMScanners.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingVMScanners.cs new file mode 100644 index 000000000000..d829c632c4df --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingVMScanners.cs @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The Microsoft Defender for Server VM scanning configuration + public partial class DefenderForServersGcpOfferingVMScanners : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScanners, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersConfiguration _configuration; + + /// configuration for Microsoft Defender for Server VM scanning + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersConfiguration Configuration { get => (this._configuration = this._configuration ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingVMScannersConfiguration()); set => this._configuration = value; } + + /// VM tags that indicate that VM should not be scanned + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersConfigurationExclusionTags ConfigurationExclusionTag { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersConfigurationInternal)Configuration).ExclusionTag; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersConfigurationInternal)Configuration).ExclusionTag = value ?? null /* model class */; } + + /// The scanning mode for the VM scan. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string ConfigurationScanningMode { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersConfigurationInternal)Configuration).ScanningMode; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersConfigurationInternal)Configuration).ScanningMode = value ?? null; } + + /// Backing field for property. + private bool? _enabled; + + /// Is Microsoft Defender for Server VM scanning enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public bool? Enabled { get => this._enabled; set => this._enabled = value; } + + /// Internal Acessors for Configuration + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersConfiguration Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersInternal.Configuration { get => (this._configuration = this._configuration ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingVMScannersConfiguration()); set { {_configuration = value;} } } + + /// Creates an new instance. + public DefenderForServersGcpOfferingVMScanners() + { + + } + } + /// The Microsoft Defender for Server VM scanning configuration + public partial interface IDefenderForServersGcpOfferingVMScanners : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// VM tags that indicate that VM should not be scanned + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"VM tags that indicate that VM should not be scanned", + SerializedName = @"exclusionTags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersConfigurationExclusionTags) })] + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersConfigurationExclusionTags ConfigurationExclusionTag { get; set; } + /// The scanning mode for the VM scan. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The scanning mode for the VM scan.", + SerializedName = @"scanningMode", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Default")] + string ConfigurationScanningMode { get; set; } + /// Is Microsoft Defender for Server VM scanning enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Is Microsoft Defender for Server VM scanning enabled", + SerializedName = @"enabled", + PossibleTypes = new [] { typeof(bool) })] + bool? Enabled { get; set; } + + } + /// The Microsoft Defender for Server VM scanning configuration + internal partial interface IDefenderForServersGcpOfferingVMScannersInternal + + { + /// configuration for Microsoft Defender for Server VM scanning + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersConfiguration Configuration { get; set; } + /// VM tags that indicate that VM should not be scanned + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersConfigurationExclusionTags ConfigurationExclusionTag { get; set; } + /// The scanning mode for the VM scan. + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Default")] + string ConfigurationScanningMode { get; set; } + /// Is Microsoft Defender for Server VM scanning enabled + bool? Enabled { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingVMScanners.json.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingVMScanners.json.cs new file mode 100644 index 000000000000..0275fafccc8a --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingVMScanners.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The Microsoft Defender for Server VM scanning configuration + public partial class DefenderForServersGcpOfferingVMScanners + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal DefenderForServersGcpOfferingVMScanners(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_configuration = If( json?.PropertyT("configuration"), out var __jsonConfiguration) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingVMScannersConfiguration.FromJson(__jsonConfiguration) : _configuration;} + {_enabled = If( json?.PropertyT("enabled"), out var __jsonEnabled) ? (bool?)__jsonEnabled : _enabled;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScanners. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScanners. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScanners FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DefenderForServersGcpOfferingVMScanners(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._configuration ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._configuration.ToJson(null,serializationMode) : null, "configuration" ,container.Add ); + AddIf( null != this._enabled ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonBoolean((bool)this._enabled) : null, "enabled" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingVMScannersConfiguration.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingVMScannersConfiguration.PowerShell.cs new file mode 100644 index 000000000000..35cde05af128 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingVMScannersConfiguration.PowerShell.cs @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// configuration for Microsoft Defender for Server VM scanning + [System.ComponentModel.TypeConverter(typeof(DefenderForServersGcpOfferingVMScannersConfigurationTypeConverter))] + public partial class DefenderForServersGcpOfferingVMScannersConfiguration + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DefenderForServersGcpOfferingVMScannersConfiguration(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ScanningMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersConfigurationInternal)this).ScanningMode = (string) content.GetValueForProperty("ScanningMode",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersConfigurationInternal)this).ScanningMode, global::System.Convert.ToString); + } + if (content.Contains("ExclusionTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersConfigurationInternal)this).ExclusionTag = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersConfigurationExclusionTags) content.GetValueForProperty("ExclusionTag",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersConfigurationInternal)this).ExclusionTag, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingVMScannersConfigurationExclusionTagsTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DefenderForServersGcpOfferingVMScannersConfiguration(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ScanningMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersConfigurationInternal)this).ScanningMode = (string) content.GetValueForProperty("ScanningMode",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersConfigurationInternal)this).ScanningMode, global::System.Convert.ToString); + } + if (content.Contains("ExclusionTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersConfigurationInternal)this).ExclusionTag = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersConfigurationExclusionTags) content.GetValueForProperty("ExclusionTag",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersConfigurationInternal)this).ExclusionTag, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingVMScannersConfigurationExclusionTagsTypeConverter.ConvertFrom); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersConfiguration DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DefenderForServersGcpOfferingVMScannersConfiguration(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersConfiguration DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DefenderForServersGcpOfferingVMScannersConfiguration(content); + } + + /// + /// Creates a new instance of , deserializing the content + /// from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersConfiguration FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// configuration for Microsoft Defender for Server VM scanning + [System.ComponentModel.TypeConverter(typeof(DefenderForServersGcpOfferingVMScannersConfigurationTypeConverter))] + public partial interface IDefenderForServersGcpOfferingVMScannersConfiguration + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingVMScannersConfiguration.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingVMScannersConfiguration.TypeConverter.cs new file mode 100644 index 000000000000..4bc00e43511e --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingVMScannersConfiguration.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DefenderForServersGcpOfferingVMScannersConfigurationTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a + /// type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersConfiguration ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersConfiguration).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DefenderForServersGcpOfferingVMScannersConfiguration.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DefenderForServersGcpOfferingVMScannersConfiguration.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DefenderForServersGcpOfferingVMScannersConfiguration.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingVMScannersConfiguration.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingVMScannersConfiguration.cs new file mode 100644 index 000000000000..b03771e1dbaa --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingVMScannersConfiguration.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// configuration for Microsoft Defender for Server VM scanning + public partial class DefenderForServersGcpOfferingVMScannersConfiguration : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersConfiguration, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersConfigurationInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersConfigurationExclusionTags _exclusionTag; + + /// VM tags that indicate that VM should not be scanned + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersConfigurationExclusionTags ExclusionTag { get => (this._exclusionTag = this._exclusionTag ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingVMScannersConfigurationExclusionTags()); set => this._exclusionTag = value; } + + /// Backing field for property. + private string _scanningMode; + + /// The scanning mode for the VM scan. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string ScanningMode { get => this._scanningMode; set => this._scanningMode = value; } + + /// + /// Creates an new instance. + /// + public DefenderForServersGcpOfferingVMScannersConfiguration() + { + + } + } + /// configuration for Microsoft Defender for Server VM scanning + public partial interface IDefenderForServersGcpOfferingVMScannersConfiguration : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// VM tags that indicate that VM should not be scanned + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"VM tags that indicate that VM should not be scanned", + SerializedName = @"exclusionTags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersConfigurationExclusionTags) })] + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersConfigurationExclusionTags ExclusionTag { get; set; } + /// The scanning mode for the VM scan. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The scanning mode for the VM scan.", + SerializedName = @"scanningMode", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Default")] + string ScanningMode { get; set; } + + } + /// configuration for Microsoft Defender for Server VM scanning + internal partial interface IDefenderForServersGcpOfferingVMScannersConfigurationInternal + + { + /// VM tags that indicate that VM should not be scanned + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersConfigurationExclusionTags ExclusionTag { get; set; } + /// The scanning mode for the VM scan. + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Default")] + string ScanningMode { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingVMScannersConfiguration.json.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingVMScannersConfiguration.json.cs new file mode 100644 index 000000000000..37484c1e8dab --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingVMScannersConfiguration.json.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// configuration for Microsoft Defender for Server VM scanning + public partial class DefenderForServersGcpOfferingVMScannersConfiguration + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal DefenderForServersGcpOfferingVMScannersConfiguration(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_scanningMode = If( json?.PropertyT("scanningMode"), out var __jsonScanningMode) ? (string)__jsonScanningMode : (string)_scanningMode;} + {_exclusionTag = If( json?.PropertyT("exclusionTags"), out var __jsonExclusionTags) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingVMScannersConfigurationExclusionTags.FromJson(__jsonExclusionTags) : _exclusionTag;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersConfiguration. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersConfiguration. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersConfiguration FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DefenderForServersGcpOfferingVMScannersConfiguration(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._scanningMode)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._scanningMode.ToString()) : null, "scanningMode" ,container.Add ); + AddIf( null != this._exclusionTag ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._exclusionTag.ToJson(null,serializationMode) : null, "exclusionTags" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingVMScannersConfigurationExclusionTags.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingVMScannersConfigurationExclusionTags.PowerShell.cs new file mode 100644 index 000000000000..26e1c1d04257 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingVMScannersConfigurationExclusionTags.PowerShell.cs @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// VM tags that indicate that VM should not be scanned + [System.ComponentModel.TypeConverter(typeof(DefenderForServersGcpOfferingVMScannersConfigurationExclusionTagsTypeConverter))] + public partial class DefenderForServersGcpOfferingVMScannersConfigurationExclusionTags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DefenderForServersGcpOfferingVMScannersConfigurationExclusionTags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DefenderForServersGcpOfferingVMScannersConfigurationExclusionTags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersConfigurationExclusionTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DefenderForServersGcpOfferingVMScannersConfigurationExclusionTags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersConfigurationExclusionTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DefenderForServersGcpOfferingVMScannersConfigurationExclusionTags(content); + } + + /// + /// Creates a new instance of , deserializing + /// the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersConfigurationExclusionTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// VM tags that indicate that VM should not be scanned + [System.ComponentModel.TypeConverter(typeof(DefenderForServersGcpOfferingVMScannersConfigurationExclusionTagsTypeConverter))] + public partial interface IDefenderForServersGcpOfferingVMScannersConfigurationExclusionTags + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingVMScannersConfigurationExclusionTags.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingVMScannersConfigurationExclusionTags.TypeConverter.cs new file mode 100644 index 000000000000..179cf6c38bd6 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingVMScannersConfigurationExclusionTags.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DefenderForServersGcpOfferingVMScannersConfigurationExclusionTagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there + /// is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there + /// is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersConfigurationExclusionTags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersConfigurationExclusionTags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DefenderForServersGcpOfferingVMScannersConfigurationExclusionTags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DefenderForServersGcpOfferingVMScannersConfigurationExclusionTags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DefenderForServersGcpOfferingVMScannersConfigurationExclusionTags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingVMScannersConfigurationExclusionTags.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingVMScannersConfigurationExclusionTags.cs new file mode 100644 index 000000000000..e016eb6bae44 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingVMScannersConfigurationExclusionTags.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// VM tags that indicate that VM should not be scanned + public partial class DefenderForServersGcpOfferingVMScannersConfigurationExclusionTags : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersConfigurationExclusionTags, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersConfigurationExclusionTagsInternal + { + + /// + /// Creates an new instance. + /// + public DefenderForServersGcpOfferingVMScannersConfigurationExclusionTags() + { + + } + } + /// VM tags that indicate that VM should not be scanned + public partial interface IDefenderForServersGcpOfferingVMScannersConfigurationExclusionTags : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray + { + + } + /// VM tags that indicate that VM should not be scanned + internal partial interface IDefenderForServersGcpOfferingVMScannersConfigurationExclusionTagsInternal + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingVMScannersConfigurationExclusionTags.dictionary.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingVMScannersConfigurationExclusionTags.dictionary.cs new file mode 100644 index 000000000000..9d557b4bc571 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingVMScannersConfigurationExclusionTags.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + public partial class DefenderForServersGcpOfferingVMScannersConfigurationExclusionTags : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingVMScannersConfigurationExclusionTags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingVMScannersConfigurationExclusionTags.json.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingVMScannersConfigurationExclusionTags.json.cs new file mode 100644 index 000000000000..80eb6156ea41 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingVMScannersConfigurationExclusionTags.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// VM tags that indicate that VM should not be scanned + public partial class DefenderForServersGcpOfferingVMScannersConfigurationExclusionTags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + /// + internal DefenderForServersGcpOfferingVMScannersConfigurationExclusionTags(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersConfigurationExclusionTags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersConfigurationExclusionTags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersConfigurationExclusionTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DefenderForServersGcpOfferingVMScannersConfigurationExclusionTags(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingVaAutoProvisioning.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingVaAutoProvisioning.PowerShell.cs new file mode 100644 index 000000000000..8995e963ccaa --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingVaAutoProvisioning.PowerShell.cs @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The Vulnerability Assessment autoprovisioning configuration + [System.ComponentModel.TypeConverter(typeof(DefenderForServersGcpOfferingVaAutoProvisioningTypeConverter))] + public partial class DefenderForServersGcpOfferingVaAutoProvisioning + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DefenderForServersGcpOfferingVaAutoProvisioning(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Configuration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVaAutoProvisioningInternal)this).Configuration = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVaAutoProvisioningConfiguration) content.GetValueForProperty("Configuration",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVaAutoProvisioningInternal)this).Configuration, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingVaAutoProvisioningConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("Enabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVaAutoProvisioningInternal)this).Enabled = (bool?) content.GetValueForProperty("Enabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVaAutoProvisioningInternal)this).Enabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ConfigurationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVaAutoProvisioningInternal)this).ConfigurationType = (string) content.GetValueForProperty("ConfigurationType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVaAutoProvisioningInternal)this).ConfigurationType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DefenderForServersGcpOfferingVaAutoProvisioning(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Configuration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVaAutoProvisioningInternal)this).Configuration = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVaAutoProvisioningConfiguration) content.GetValueForProperty("Configuration",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVaAutoProvisioningInternal)this).Configuration, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingVaAutoProvisioningConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("Enabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVaAutoProvisioningInternal)this).Enabled = (bool?) content.GetValueForProperty("Enabled",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVaAutoProvisioningInternal)this).Enabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ConfigurationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVaAutoProvisioningInternal)this).ConfigurationType = (string) content.GetValueForProperty("ConfigurationType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVaAutoProvisioningInternal)this).ConfigurationType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVaAutoProvisioning DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DefenderForServersGcpOfferingVaAutoProvisioning(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVaAutoProvisioning DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DefenderForServersGcpOfferingVaAutoProvisioning(content); + } + + /// + /// Creates a new instance of , deserializing the content from + /// a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVaAutoProvisioning FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The Vulnerability Assessment autoprovisioning configuration + [System.ComponentModel.TypeConverter(typeof(DefenderForServersGcpOfferingVaAutoProvisioningTypeConverter))] + public partial interface IDefenderForServersGcpOfferingVaAutoProvisioning + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingVaAutoProvisioning.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingVaAutoProvisioning.TypeConverter.cs new file mode 100644 index 000000000000..7b46e831ff35 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingVaAutoProvisioning.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DefenderForServersGcpOfferingVaAutoProvisioningTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, + /// otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVaAutoProvisioning ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVaAutoProvisioning).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DefenderForServersGcpOfferingVaAutoProvisioning.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DefenderForServersGcpOfferingVaAutoProvisioning.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DefenderForServersGcpOfferingVaAutoProvisioning.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingVaAutoProvisioning.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingVaAutoProvisioning.cs new file mode 100644 index 000000000000..b699f1177579 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingVaAutoProvisioning.cs @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The Vulnerability Assessment autoprovisioning configuration + public partial class DefenderForServersGcpOfferingVaAutoProvisioning : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVaAutoProvisioning, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVaAutoProvisioningInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVaAutoProvisioningConfiguration _configuration; + + /// configuration for Vulnerability Assessment autoprovisioning + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVaAutoProvisioningConfiguration Configuration { get => (this._configuration = this._configuration ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingVaAutoProvisioningConfiguration()); set => this._configuration = value; } + + /// + /// The Vulnerability Assessment solution to be provisioned. Can be either 'TVM' or 'Qualys' + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string ConfigurationType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVaAutoProvisioningConfigurationInternal)Configuration).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVaAutoProvisioningConfigurationInternal)Configuration).Type = value ?? null; } + + /// Backing field for property. + private bool? _enabled; + + /// Is Vulnerability Assessment auto provisioning enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public bool? Enabled { get => this._enabled; set => this._enabled = value; } + + /// Internal Acessors for Configuration + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVaAutoProvisioningConfiguration Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVaAutoProvisioningInternal.Configuration { get => (this._configuration = this._configuration ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingVaAutoProvisioningConfiguration()); set { {_configuration = value;} } } + + /// + /// Creates an new instance. + /// + public DefenderForServersGcpOfferingVaAutoProvisioning() + { + + } + } + /// The Vulnerability Assessment autoprovisioning configuration + public partial interface IDefenderForServersGcpOfferingVaAutoProvisioning : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// + /// The Vulnerability Assessment solution to be provisioned. Can be either 'TVM' or 'Qualys' + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The Vulnerability Assessment solution to be provisioned. Can be either 'TVM' or 'Qualys'", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Qualys", "TVM")] + string ConfigurationType { get; set; } + /// Is Vulnerability Assessment auto provisioning enabled + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Is Vulnerability Assessment auto provisioning enabled", + SerializedName = @"enabled", + PossibleTypes = new [] { typeof(bool) })] + bool? Enabled { get; set; } + + } + /// The Vulnerability Assessment autoprovisioning configuration + internal partial interface IDefenderForServersGcpOfferingVaAutoProvisioningInternal + + { + /// configuration for Vulnerability Assessment autoprovisioning + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVaAutoProvisioningConfiguration Configuration { get; set; } + /// + /// The Vulnerability Assessment solution to be provisioned. Can be either 'TVM' or 'Qualys' + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Qualys", "TVM")] + string ConfigurationType { get; set; } + /// Is Vulnerability Assessment auto provisioning enabled + bool? Enabled { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingVaAutoProvisioning.json.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingVaAutoProvisioning.json.cs new file mode 100644 index 000000000000..fba026d67dff --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingVaAutoProvisioning.json.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The Vulnerability Assessment autoprovisioning configuration + public partial class DefenderForServersGcpOfferingVaAutoProvisioning + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal DefenderForServersGcpOfferingVaAutoProvisioning(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_configuration = If( json?.PropertyT("configuration"), out var __jsonConfiguration) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOfferingVaAutoProvisioningConfiguration.FromJson(__jsonConfiguration) : _configuration;} + {_enabled = If( json?.PropertyT("enabled"), out var __jsonEnabled) ? (bool?)__jsonEnabled : _enabled;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVaAutoProvisioning. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVaAutoProvisioning. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVaAutoProvisioning FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DefenderForServersGcpOfferingVaAutoProvisioning(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._configuration ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._configuration.ToJson(null,serializationMode) : null, "configuration" ,container.Add ); + AddIf( null != this._enabled ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonBoolean((bool)this._enabled) : null, "enabled" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingVaAutoProvisioningConfiguration.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingVaAutoProvisioningConfiguration.PowerShell.cs new file mode 100644 index 000000000000..76c0ee6ee800 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingVaAutoProvisioningConfiguration.PowerShell.cs @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// configuration for Vulnerability Assessment autoprovisioning + [System.ComponentModel.TypeConverter(typeof(DefenderForServersGcpOfferingVaAutoProvisioningConfigurationTypeConverter))] + public partial class DefenderForServersGcpOfferingVaAutoProvisioningConfiguration + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DefenderForServersGcpOfferingVaAutoProvisioningConfiguration(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVaAutoProvisioningConfigurationInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVaAutoProvisioningConfigurationInternal)this).Type, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DefenderForServersGcpOfferingVaAutoProvisioningConfiguration(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVaAutoProvisioningConfigurationInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVaAutoProvisioningConfigurationInternal)this).Type, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVaAutoProvisioningConfiguration DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DefenderForServersGcpOfferingVaAutoProvisioningConfiguration(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVaAutoProvisioningConfiguration DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DefenderForServersGcpOfferingVaAutoProvisioningConfiguration(content); + } + + /// + /// Creates a new instance of , deserializing the + /// content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVaAutoProvisioningConfiguration FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// configuration for Vulnerability Assessment autoprovisioning + [System.ComponentModel.TypeConverter(typeof(DefenderForServersGcpOfferingVaAutoProvisioningConfigurationTypeConverter))] + public partial interface IDefenderForServersGcpOfferingVaAutoProvisioningConfiguration + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingVaAutoProvisioningConfiguration.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingVaAutoProvisioningConfiguration.TypeConverter.cs new file mode 100644 index 000000000000..021e4d8f5bc1 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingVaAutoProvisioningConfiguration.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DefenderForServersGcpOfferingVaAutoProvisioningConfigurationTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is + /// no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is + /// no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVaAutoProvisioningConfiguration ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVaAutoProvisioningConfiguration).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DefenderForServersGcpOfferingVaAutoProvisioningConfiguration.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DefenderForServersGcpOfferingVaAutoProvisioningConfiguration.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DefenderForServersGcpOfferingVaAutoProvisioningConfiguration.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingVaAutoProvisioningConfiguration.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingVaAutoProvisioningConfiguration.cs new file mode 100644 index 000000000000..bb433e902181 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingVaAutoProvisioningConfiguration.cs @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// configuration for Vulnerability Assessment autoprovisioning + public partial class DefenderForServersGcpOfferingVaAutoProvisioningConfiguration : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVaAutoProvisioningConfiguration, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVaAutoProvisioningConfigurationInternal + { + + /// Backing field for property. + private string _type; + + /// + /// The Vulnerability Assessment solution to be provisioned. Can be either 'TVM' or 'Qualys' + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string Type { get => this._type; set => this._type = value; } + + /// + /// Creates an new instance. + /// + public DefenderForServersGcpOfferingVaAutoProvisioningConfiguration() + { + + } + } + /// configuration for Vulnerability Assessment autoprovisioning + public partial interface IDefenderForServersGcpOfferingVaAutoProvisioningConfiguration : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// + /// The Vulnerability Assessment solution to be provisioned. Can be either 'TVM' or 'Qualys' + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The Vulnerability Assessment solution to be provisioned. Can be either 'TVM' or 'Qualys'", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Qualys", "TVM")] + string Type { get; set; } + + } + /// configuration for Vulnerability Assessment autoprovisioning + internal partial interface IDefenderForServersGcpOfferingVaAutoProvisioningConfigurationInternal + + { + /// + /// The Vulnerability Assessment solution to be provisioned. Can be either 'TVM' or 'Qualys' + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Qualys", "TVM")] + string Type { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingVaAutoProvisioningConfiguration.json.cs b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingVaAutoProvisioningConfiguration.json.cs new file mode 100644 index 000000000000..689765f45d9c --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DefenderForServersGcpOfferingVaAutoProvisioningConfiguration.json.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// configuration for Vulnerability Assessment autoprovisioning + public partial class DefenderForServersGcpOfferingVaAutoProvisioningConfiguration + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal DefenderForServersGcpOfferingVaAutoProvisioningConfiguration(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_type = If( json?.PropertyT("type"), out var __jsonType) ? (string)__jsonType : (string)_type;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVaAutoProvisioningConfiguration. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVaAutoProvisioningConfiguration. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVaAutoProvisioningConfiguration FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DefenderForServersGcpOfferingVaAutoProvisioningConfiguration(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._type.ToString()) : null, "type" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DevOpsConfiguration.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DevOpsConfiguration.PowerShell.cs new file mode 100644 index 000000000000..4f479dbc07a0 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DevOpsConfiguration.PowerShell.cs @@ -0,0 +1,300 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// DevOps Configuration resource. + [System.ComponentModel.TypeConverter(typeof(DevOpsConfigurationTypeConverter))] + public partial class DevOpsConfiguration + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfiguration DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DevOpsConfiguration(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfiguration DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DevOpsConfiguration(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DevOpsConfiguration(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DevOpsConfigurationPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("Authorization")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationInternal)this).Authorization = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAuthorization) content.GetValueForProperty("Authorization",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationInternal)this).Authorization, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AuthorizationTypeConverter.ConvertFrom); + } + if (content.Contains("AutoDiscovery")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationInternal)this).AutoDiscovery = (string) content.GetValueForProperty("AutoDiscovery",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationInternal)this).AutoDiscovery, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ProvisioningStatusMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationInternal)this).ProvisioningStatusMessage = (string) content.GetValueForProperty("ProvisioningStatusMessage",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationInternal)this).ProvisioningStatusMessage, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningStatusUpdateTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationInternal)this).ProvisioningStatusUpdateTimeUtc = (global::System.DateTime?) content.GetValueForProperty("ProvisioningStatusUpdateTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationInternal)this).ProvisioningStatusUpdateTimeUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationInternal)this).ProvisioningState, global::System.Convert.ToString); + } + if (content.Contains("TopLevelInventoryList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationInternal)this).TopLevelInventoryList = (System.Collections.Generic.List) content.GetValueForProperty("TopLevelInventoryList",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationInternal)this).TopLevelInventoryList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("AuthorizationCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationInternal)this).AuthorizationCode = (string) content.GetValueForProperty("AuthorizationCode",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationInternal)this).AuthorizationCode, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DevOpsConfiguration(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DevOpsConfigurationPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("Authorization")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationInternal)this).Authorization = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAuthorization) content.GetValueForProperty("Authorization",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationInternal)this).Authorization, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AuthorizationTypeConverter.ConvertFrom); + } + if (content.Contains("AutoDiscovery")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationInternal)this).AutoDiscovery = (string) content.GetValueForProperty("AutoDiscovery",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationInternal)this).AutoDiscovery, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ProvisioningStatusMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationInternal)this).ProvisioningStatusMessage = (string) content.GetValueForProperty("ProvisioningStatusMessage",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationInternal)this).ProvisioningStatusMessage, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningStatusUpdateTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationInternal)this).ProvisioningStatusUpdateTimeUtc = (global::System.DateTime?) content.GetValueForProperty("ProvisioningStatusUpdateTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationInternal)this).ProvisioningStatusUpdateTimeUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationInternal)this).ProvisioningState, global::System.Convert.ToString); + } + if (content.Contains("TopLevelInventoryList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationInternal)this).TopLevelInventoryList = (System.Collections.Generic.List) content.GetValueForProperty("TopLevelInventoryList",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationInternal)this).TopLevelInventoryList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("AuthorizationCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationInternal)this).AuthorizationCode = (string) content.GetValueForProperty("AuthorizationCode",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationInternal)this).AuthorizationCode, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfiguration FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// DevOps Configuration resource. + [System.ComponentModel.TypeConverter(typeof(DevOpsConfigurationTypeConverter))] + public partial interface IDevOpsConfiguration + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DevOpsConfiguration.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DevOpsConfiguration.TypeConverter.cs new file mode 100644 index 000000000000..3e9f60b37816 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DevOpsConfiguration.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DevOpsConfigurationTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfiguration ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfiguration).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DevOpsConfiguration.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DevOpsConfiguration.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DevOpsConfiguration.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DevOpsConfiguration.cs b/src/Security/Security.Autorest/generated/api/Models/DevOpsConfiguration.cs new file mode 100644 index 000000000000..a644dd42c70e --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DevOpsConfiguration.cs @@ -0,0 +1,390 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// DevOps Configuration resource. + public partial class DevOpsConfiguration : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfiguration, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationInternal, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IProxyResource __proxyResource = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ProxyResource(); + + /// + /// Gets or sets one-time OAuth code to exchange for refresh and access tokens. + /// + /// Only used during PUT/PATCH operations. The secret is cleared during GET. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string AuthorizationCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationPropertiesInternal)Property).AuthorizationCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationPropertiesInternal)Property).AuthorizationCode = value ?? null; } + + /// AutoDiscovery states. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string AutoDiscovery { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationPropertiesInternal)Property).AutoDiscovery; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationPropertiesInternal)Property).AutoDiscovery = value ?? null; } + + /// + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Id; } + + /// Internal Acessors for Authorization + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAuthorization Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationInternal.Authorization { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationPropertiesInternal)Property).Authorization; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationPropertiesInternal)Property).Authorization = value; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationProperties Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DevOpsConfigurationProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProvisioningStatusMessage + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationInternal.ProvisioningStatusMessage { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationPropertiesInternal)Property).ProvisioningStatusMessage; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationPropertiesInternal)Property).ProvisioningStatusMessage = value; } + + /// Internal Acessors for ProvisioningStatusUpdateTimeUtc + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationInternal.ProvisioningStatusUpdateTimeUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationPropertiesInternal)Property).ProvisioningStatusUpdateTimeUtc; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationPropertiesInternal)Property).ProvisioningStatusUpdateTimeUtc = value; } + + /// Internal Acessors for SystemData + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemData Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationInternal.SystemData { get => (this._systemData = this._systemData ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SystemData()); set { {_systemData = value;} } } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Name = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Type = value; } + + /// The name of the resource + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Name; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationProperties _property; + + /// DevOps Configuration properties. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DevOpsConfigurationProperties()); set => this._property = value; } + + /// + /// The provisioning state of the resource. + /// + /// Pending - Provisioning pending. + /// Failed - Provisioning failed. + /// Succeeded - Successful provisioning. + /// Canceled - Provisioning canceled. + /// PendingDeletion - Deletion pending. + /// DeletionSuccess - Deletion successful. + /// DeletionFailure - Deletion failure. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationPropertiesInternal)Property).ProvisioningState; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationPropertiesInternal)Property).ProvisioningState = value ?? null; } + + /// Gets or sets resource status message. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string ProvisioningStatusMessage { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationPropertiesInternal)Property).ProvisioningStatusMessage; } + + /// Gets or sets time when resource was last checked. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public global::System.DateTime? ProvisioningStatusUpdateTimeUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationPropertiesInternal)Property).ProvisioningStatusUpdateTimeUtc; } + + /// Gets the resource group name + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string ResourceGroupName { get => (new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Success ? new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Groups["resourceGroupName"].Value : null); } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemData _systemData; + + /// Metadata pertaining to creation and last modification of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemData SystemData { get => (this._systemData = this._systemData ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SystemData()); } + + /// The timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).CreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).CreatedAt = value ?? default(global::System.DateTime); } + + /// The identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).CreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).CreatedBy = value ?? null; } + + /// The type of identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).CreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).CreatedByType = value ?? null; } + + /// The timestamp of resource last modification (UTC) + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).LastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).LastModifiedAt = value ?? default(global::System.DateTime); } + + /// The identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).LastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).LastModifiedBy = value ?? null; } + + /// The type of identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).LastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).LastModifiedByType = value ?? null; } + + /// + /// List of top-level inventory to select when AutoDiscovery is disabled. + /// This field is ignored when AutoDiscovery is enabled. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public System.Collections.Generic.List TopLevelInventoryList { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationPropertiesInternal)Property).TopLevelInventoryList; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationPropertiesInternal)Property).TopLevelInventoryList = value ?? null /* arrayOf */; } + + /// + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Type; } + + /// Creates an new instance. + public DevOpsConfiguration() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__proxyResource), __proxyResource); + await eventListener.AssertObjectIsValid(nameof(__proxyResource), __proxyResource); + } + } + /// DevOps Configuration resource. + public partial interface IDevOpsConfiguration : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IProxyResource + { + /// + /// Gets or sets one-time OAuth code to exchange for refresh and access tokens. + /// + /// Only used during PUT/PATCH operations. The secret is cleared during GET. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Gets or sets one-time OAuth code to exchange for refresh and access tokens. + + Only used during PUT/PATCH operations. The secret is cleared during GET.", + SerializedName = @"code", + PossibleTypes = new [] { typeof(string) })] + string AuthorizationCode { get; set; } + /// AutoDiscovery states. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"AutoDiscovery states.", + SerializedName = @"autoDiscovery", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Disabled", "Enabled", "NotApplicable")] + string AutoDiscovery { get; set; } + /// + /// The provisioning state of the resource. + /// + /// Pending - Provisioning pending. + /// Failed - Provisioning failed. + /// Succeeded - Successful provisioning. + /// Canceled - Provisioning canceled. + /// PendingDeletion - Deletion pending. + /// DeletionSuccess - Deletion successful. + /// DeletionFailure - Deletion failure. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The provisioning state of the resource. + + Pending - Provisioning pending. + Failed - Provisioning failed. + Succeeded - Successful provisioning. + Canceled - Provisioning canceled. + PendingDeletion - Deletion pending. + DeletionSuccess - Deletion successful. + DeletionFailure - Deletion failure.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Succeeded", "Failed", "Canceled", "Pending", "PendingDeletion", "DeletionSuccess", "DeletionFailure")] + string ProvisioningState { get; set; } + /// Gets or sets resource status message. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets resource status message.", + SerializedName = @"provisioningStatusMessage", + PossibleTypes = new [] { typeof(string) })] + string ProvisioningStatusMessage { get; } + /// Gets or sets time when resource was last checked. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets time when resource was last checked.", + SerializedName = @"provisioningStatusUpdateTimeUtc", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? ProvisioningStatusUpdateTimeUtc { get; } + /// The timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The timestamp of resource creation (UTC).", + SerializedName = @"createdAt", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? SystemDataCreatedAt { get; } + /// The identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The identity that created the resource.", + SerializedName = @"createdBy", + PossibleTypes = new [] { typeof(string) })] + string SystemDataCreatedBy { get; } + /// The type of identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The type of identity that created the resource.", + SerializedName = @"createdByType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string SystemDataCreatedByType { get; } + /// The timestamp of resource last modification (UTC) + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The timestamp of resource last modification (UTC)", + SerializedName = @"lastModifiedAt", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? SystemDataLastModifiedAt { get; } + /// The identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The identity that last modified the resource.", + SerializedName = @"lastModifiedBy", + PossibleTypes = new [] { typeof(string) })] + string SystemDataLastModifiedBy { get; } + /// The type of identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The type of identity that last modified the resource.", + SerializedName = @"lastModifiedByType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string SystemDataLastModifiedByType { get; } + /// + /// List of top-level inventory to select when AutoDiscovery is disabled. + /// This field is ignored when AutoDiscovery is enabled. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"List of top-level inventory to select when AutoDiscovery is disabled. + This field is ignored when AutoDiscovery is enabled.", + SerializedName = @"topLevelInventoryList", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List TopLevelInventoryList { get; set; } + + } + /// DevOps Configuration resource. + internal partial interface IDevOpsConfigurationInternal : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IProxyResourceInternal + { + /// Authorization payload. + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAuthorization Authorization { get; set; } + /// + /// Gets or sets one-time OAuth code to exchange for refresh and access tokens. + /// + /// Only used during PUT/PATCH operations. The secret is cleared during GET. + /// + string AuthorizationCode { get; set; } + /// AutoDiscovery states. + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Disabled", "Enabled", "NotApplicable")] + string AutoDiscovery { get; set; } + /// DevOps Configuration properties. + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationProperties Property { get; set; } + /// + /// The provisioning state of the resource. + /// + /// Pending - Provisioning pending. + /// Failed - Provisioning failed. + /// Succeeded - Successful provisioning. + /// Canceled - Provisioning canceled. + /// PendingDeletion - Deletion pending. + /// DeletionSuccess - Deletion successful. + /// DeletionFailure - Deletion failure. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Succeeded", "Failed", "Canceled", "Pending", "PendingDeletion", "DeletionSuccess", "DeletionFailure")] + string ProvisioningState { get; set; } + /// Gets or sets resource status message. + string ProvisioningStatusMessage { get; set; } + /// Gets or sets time when resource was last checked. + global::System.DateTime? ProvisioningStatusUpdateTimeUtc { get; set; } + /// Metadata pertaining to creation and last modification of the resource. + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemData SystemData { get; set; } + /// The timestamp of resource creation (UTC). + global::System.DateTime? SystemDataCreatedAt { get; set; } + /// The identity that created the resource. + string SystemDataCreatedBy { get; set; } + /// The type of identity that created the resource. + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string SystemDataCreatedByType { get; set; } + /// The timestamp of resource last modification (UTC) + global::System.DateTime? SystemDataLastModifiedAt { get; set; } + /// The identity that last modified the resource. + string SystemDataLastModifiedBy { get; set; } + /// The type of identity that last modified the resource. + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string SystemDataLastModifiedByType { get; set; } + /// + /// List of top-level inventory to select when AutoDiscovery is disabled. + /// This field is ignored when AutoDiscovery is enabled. + /// + System.Collections.Generic.List TopLevelInventoryList { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DevOpsConfiguration.json.cs b/src/Security/Security.Autorest/generated/api/Models/DevOpsConfiguration.json.cs new file mode 100644 index 000000000000..7afaab6cbdad --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DevOpsConfiguration.json.cs @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// DevOps Configuration resource. + public partial class DevOpsConfiguration + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal DevOpsConfiguration(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __proxyResource = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ProxyResource(json); + {_systemData = If( json?.PropertyT("systemData"), out var __jsonSystemData) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SystemData.FromJson(__jsonSystemData) : _systemData;} + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DevOpsConfigurationProperties.FromJson(__jsonProperties) : _property;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfiguration. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfiguration. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfiguration FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DevOpsConfiguration(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __proxyResource?.ToJson(container, serializationMode); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._systemData ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._systemData.ToJson(null,serializationMode) : null, "systemData" ,container.Add ); + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DevOpsConfigurationListResponse.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DevOpsConfigurationListResponse.PowerShell.cs new file mode 100644 index 000000000000..f754497aaafe --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DevOpsConfigurationListResponse.PowerShell.cs @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// List of RP resources which supports pagination. + [System.ComponentModel.TypeConverter(typeof(DevOpsConfigurationListResponseTypeConverter))] + public partial class DevOpsConfigurationListResponse + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationListResponse DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DevOpsConfigurationListResponse(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationListResponse DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DevOpsConfigurationListResponse(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DevOpsConfigurationListResponse(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationListResponseInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationListResponseInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DevOpsConfigurationTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationListResponseInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationListResponseInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DevOpsConfigurationListResponse(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationListResponseInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationListResponseInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DevOpsConfigurationTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationListResponseInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationListResponseInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationListResponse FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// List of RP resources which supports pagination. + [System.ComponentModel.TypeConverter(typeof(DevOpsConfigurationListResponseTypeConverter))] + public partial interface IDevOpsConfigurationListResponse + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DevOpsConfigurationListResponse.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DevOpsConfigurationListResponse.TypeConverter.cs new file mode 100644 index 000000000000..81138502ebe4 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DevOpsConfigurationListResponse.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DevOpsConfigurationListResponseTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationListResponse ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationListResponse).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DevOpsConfigurationListResponse.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DevOpsConfigurationListResponse.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DevOpsConfigurationListResponse.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DevOpsConfigurationListResponse.cs b/src/Security/Security.Autorest/generated/api/Models/DevOpsConfigurationListResponse.cs new file mode 100644 index 000000000000..9cfb6a045ace --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DevOpsConfigurationListResponse.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// List of RP resources which supports pagination. + public partial class DevOpsConfigurationListResponse : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationListResponse, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationListResponseInternal + { + + /// Backing field for property. + private string _nextLink; + + /// Gets or sets next link to scroll over the results. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private System.Collections.Generic.List _value; + + /// Gets or sets list of resources. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public System.Collections.Generic.List Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public DevOpsConfigurationListResponse() + { + + } + } + /// List of RP resources which supports pagination. + public partial interface IDevOpsConfigurationListResponse : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// Gets or sets next link to scroll over the results. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Gets or sets next link to scroll over the results.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// Gets or sets list of resources. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Gets or sets list of resources.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfiguration) })] + System.Collections.Generic.List Value { get; set; } + + } + /// List of RP resources which supports pagination. + internal partial interface IDevOpsConfigurationListResponseInternal + + { + /// Gets or sets next link to scroll over the results. + string NextLink { get; set; } + /// Gets or sets list of resources. + System.Collections.Generic.List Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DevOpsConfigurationListResponse.json.cs b/src/Security/Security.Autorest/generated/api/Models/DevOpsConfigurationListResponse.json.cs new file mode 100644 index 000000000000..072fce612aa0 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DevOpsConfigurationListResponse.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// List of RP resources which supports pagination. + public partial class DevOpsConfigurationListResponse + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal DevOpsConfigurationListResponse(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfiguration) (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DevOpsConfiguration.FromJson(__u) )) ))() : null : _value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)_nextLink;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationListResponse. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationListResponse. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationListResponse FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DevOpsConfigurationListResponse(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DevOpsConfigurationProperties.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/DevOpsConfigurationProperties.PowerShell.cs new file mode 100644 index 000000000000..1707aab7a4e3 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DevOpsConfigurationProperties.PowerShell.cs @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// DevOps Configuration properties. + [System.ComponentModel.TypeConverter(typeof(DevOpsConfigurationPropertiesTypeConverter))] + public partial class DevOpsConfigurationProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DevOpsConfigurationProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DevOpsConfigurationProperties(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DevOpsConfigurationProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Authorization")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationPropertiesInternal)this).Authorization = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAuthorization) content.GetValueForProperty("Authorization",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationPropertiesInternal)this).Authorization, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AuthorizationTypeConverter.ConvertFrom); + } + if (content.Contains("ProvisioningStatusMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationPropertiesInternal)this).ProvisioningStatusMessage = (string) content.GetValueForProperty("ProvisioningStatusMessage",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationPropertiesInternal)this).ProvisioningStatusMessage, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningStatusUpdateTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationPropertiesInternal)this).ProvisioningStatusUpdateTimeUtc = (global::System.DateTime?) content.GetValueForProperty("ProvisioningStatusUpdateTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationPropertiesInternal)this).ProvisioningStatusUpdateTimeUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationPropertiesInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationPropertiesInternal)this).ProvisioningState, global::System.Convert.ToString); + } + if (content.Contains("AutoDiscovery")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationPropertiesInternal)this).AutoDiscovery = (string) content.GetValueForProperty("AutoDiscovery",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationPropertiesInternal)this).AutoDiscovery, global::System.Convert.ToString); + } + if (content.Contains("TopLevelInventoryList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationPropertiesInternal)this).TopLevelInventoryList = (System.Collections.Generic.List) content.GetValueForProperty("TopLevelInventoryList",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationPropertiesInternal)this).TopLevelInventoryList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("AuthorizationCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationPropertiesInternal)this).AuthorizationCode = (string) content.GetValueForProperty("AuthorizationCode",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationPropertiesInternal)this).AuthorizationCode, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DevOpsConfigurationProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Authorization")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationPropertiesInternal)this).Authorization = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAuthorization) content.GetValueForProperty("Authorization",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationPropertiesInternal)this).Authorization, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AuthorizationTypeConverter.ConvertFrom); + } + if (content.Contains("ProvisioningStatusMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationPropertiesInternal)this).ProvisioningStatusMessage = (string) content.GetValueForProperty("ProvisioningStatusMessage",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationPropertiesInternal)this).ProvisioningStatusMessage, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningStatusUpdateTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationPropertiesInternal)this).ProvisioningStatusUpdateTimeUtc = (global::System.DateTime?) content.GetValueForProperty("ProvisioningStatusUpdateTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationPropertiesInternal)this).ProvisioningStatusUpdateTimeUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationPropertiesInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationPropertiesInternal)this).ProvisioningState, global::System.Convert.ToString); + } + if (content.Contains("AutoDiscovery")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationPropertiesInternal)this).AutoDiscovery = (string) content.GetValueForProperty("AutoDiscovery",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationPropertiesInternal)this).AutoDiscovery, global::System.Convert.ToString); + } + if (content.Contains("TopLevelInventoryList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationPropertiesInternal)this).TopLevelInventoryList = (System.Collections.Generic.List) content.GetValueForProperty("TopLevelInventoryList",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationPropertiesInternal)this).TopLevelInventoryList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("AuthorizationCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationPropertiesInternal)this).AuthorizationCode = (string) content.GetValueForProperty("AuthorizationCode",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationPropertiesInternal)this).AuthorizationCode, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// DevOps Configuration properties. + [System.ComponentModel.TypeConverter(typeof(DevOpsConfigurationPropertiesTypeConverter))] + public partial interface IDevOpsConfigurationProperties + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DevOpsConfigurationProperties.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/DevOpsConfigurationProperties.TypeConverter.cs new file mode 100644 index 000000000000..828739fec0df --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DevOpsConfigurationProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DevOpsConfigurationPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DevOpsConfigurationProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DevOpsConfigurationProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DevOpsConfigurationProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DevOpsConfigurationProperties.cs b/src/Security/Security.Autorest/generated/api/Models/DevOpsConfigurationProperties.cs new file mode 100644 index 000000000000..e94c66e912b2 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DevOpsConfigurationProperties.cs @@ -0,0 +1,235 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// DevOps Configuration properties. + public partial class DevOpsConfigurationProperties : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationProperties, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationPropertiesInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAuthorization _authorization; + + /// Authorization payload. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAuthorization Authorization { get => (this._authorization = this._authorization ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.Authorization()); set => this._authorization = value; } + + /// + /// Gets or sets one-time OAuth code to exchange for refresh and access tokens. + /// + /// Only used during PUT/PATCH operations. The secret is cleared during GET. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string AuthorizationCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAuthorizationInternal)Authorization).Code; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAuthorizationInternal)Authorization).Code = value ?? null; } + + /// Backing field for property. + private string _autoDiscovery; + + /// AutoDiscovery states. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string AutoDiscovery { get => this._autoDiscovery; set => this._autoDiscovery = value; } + + /// Internal Acessors for Authorization + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAuthorization Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationPropertiesInternal.Authorization { get => (this._authorization = this._authorization ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.Authorization()); set { {_authorization = value;} } } + + /// Internal Acessors for ProvisioningStatusMessage + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationPropertiesInternal.ProvisioningStatusMessage { get => this._provisioningStatusMessage; set { {_provisioningStatusMessage = value;} } } + + /// Internal Acessors for ProvisioningStatusUpdateTimeUtc + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationPropertiesInternal.ProvisioningStatusUpdateTimeUtc { get => this._provisioningStatusUpdateTimeUtc; set { {_provisioningStatusUpdateTimeUtc = value;} } } + + /// Backing field for property. + private string _provisioningState; + + /// + /// The provisioning state of the resource. + /// + /// Pending - Provisioning pending. + /// Failed - Provisioning failed. + /// Succeeded - Successful provisioning. + /// Canceled - Provisioning canceled. + /// PendingDeletion - Deletion pending. + /// DeletionSuccess - Deletion successful. + /// DeletionFailure - Deletion failure. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string ProvisioningState { get => this._provisioningState; set => this._provisioningState = value; } + + /// Backing field for property. + private string _provisioningStatusMessage; + + /// Gets or sets resource status message. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string ProvisioningStatusMessage { get => this._provisioningStatusMessage; } + + /// Backing field for property. + private global::System.DateTime? _provisioningStatusUpdateTimeUtc; + + /// Gets or sets time when resource was last checked. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public global::System.DateTime? ProvisioningStatusUpdateTimeUtc { get => this._provisioningStatusUpdateTimeUtc; } + + /// Backing field for property. + private System.Collections.Generic.List _topLevelInventoryList; + + /// + /// List of top-level inventory to select when AutoDiscovery is disabled. + /// This field is ignored when AutoDiscovery is enabled. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public System.Collections.Generic.List TopLevelInventoryList { get => this._topLevelInventoryList; set => this._topLevelInventoryList = value; } + + /// Creates an new instance. + public DevOpsConfigurationProperties() + { + + } + } + /// DevOps Configuration properties. + public partial interface IDevOpsConfigurationProperties : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// + /// Gets or sets one-time OAuth code to exchange for refresh and access tokens. + /// + /// Only used during PUT/PATCH operations. The secret is cleared during GET. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Gets or sets one-time OAuth code to exchange for refresh and access tokens. + + Only used during PUT/PATCH operations. The secret is cleared during GET.", + SerializedName = @"code", + PossibleTypes = new [] { typeof(string) })] + string AuthorizationCode { get; set; } + /// AutoDiscovery states. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"AutoDiscovery states.", + SerializedName = @"autoDiscovery", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Disabled", "Enabled", "NotApplicable")] + string AutoDiscovery { get; set; } + /// + /// The provisioning state of the resource. + /// + /// Pending - Provisioning pending. + /// Failed - Provisioning failed. + /// Succeeded - Successful provisioning. + /// Canceled - Provisioning canceled. + /// PendingDeletion - Deletion pending. + /// DeletionSuccess - Deletion successful. + /// DeletionFailure - Deletion failure. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The provisioning state of the resource. + + Pending - Provisioning pending. + Failed - Provisioning failed. + Succeeded - Successful provisioning. + Canceled - Provisioning canceled. + PendingDeletion - Deletion pending. + DeletionSuccess - Deletion successful. + DeletionFailure - Deletion failure.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Succeeded", "Failed", "Canceled", "Pending", "PendingDeletion", "DeletionSuccess", "DeletionFailure")] + string ProvisioningState { get; set; } + /// Gets or sets resource status message. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets resource status message.", + SerializedName = @"provisioningStatusMessage", + PossibleTypes = new [] { typeof(string) })] + string ProvisioningStatusMessage { get; } + /// Gets or sets time when resource was last checked. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets time when resource was last checked.", + SerializedName = @"provisioningStatusUpdateTimeUtc", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? ProvisioningStatusUpdateTimeUtc { get; } + /// + /// List of top-level inventory to select when AutoDiscovery is disabled. + /// This field is ignored when AutoDiscovery is enabled. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"List of top-level inventory to select when AutoDiscovery is disabled. + This field is ignored when AutoDiscovery is enabled.", + SerializedName = @"topLevelInventoryList", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List TopLevelInventoryList { get; set; } + + } + /// DevOps Configuration properties. + internal partial interface IDevOpsConfigurationPropertiesInternal + + { + /// Authorization payload. + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAuthorization Authorization { get; set; } + /// + /// Gets or sets one-time OAuth code to exchange for refresh and access tokens. + /// + /// Only used during PUT/PATCH operations. The secret is cleared during GET. + /// + string AuthorizationCode { get; set; } + /// AutoDiscovery states. + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Disabled", "Enabled", "NotApplicable")] + string AutoDiscovery { get; set; } + /// + /// The provisioning state of the resource. + /// + /// Pending - Provisioning pending. + /// Failed - Provisioning failed. + /// Succeeded - Successful provisioning. + /// Canceled - Provisioning canceled. + /// PendingDeletion - Deletion pending. + /// DeletionSuccess - Deletion successful. + /// DeletionFailure - Deletion failure. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Succeeded", "Failed", "Canceled", "Pending", "PendingDeletion", "DeletionSuccess", "DeletionFailure")] + string ProvisioningState { get; set; } + /// Gets or sets resource status message. + string ProvisioningStatusMessage { get; set; } + /// Gets or sets time when resource was last checked. + global::System.DateTime? ProvisioningStatusUpdateTimeUtc { get; set; } + /// + /// List of top-level inventory to select when AutoDiscovery is disabled. + /// This field is ignored when AutoDiscovery is enabled. + /// + System.Collections.Generic.List TopLevelInventoryList { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/DevOpsConfigurationProperties.json.cs b/src/Security/Security.Autorest/generated/api/Models/DevOpsConfigurationProperties.json.cs new file mode 100644 index 000000000000..cc3a172ba72b --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/DevOpsConfigurationProperties.json.cs @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// DevOps Configuration properties. + public partial class DevOpsConfigurationProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal DevOpsConfigurationProperties(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_authorization = If( json?.PropertyT("authorization"), out var __jsonAuthorization) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.Authorization.FromJson(__jsonAuthorization) : _authorization;} + {_provisioningStatusMessage = If( json?.PropertyT("provisioningStatusMessage"), out var __jsonProvisioningStatusMessage) ? (string)__jsonProvisioningStatusMessage : (string)_provisioningStatusMessage;} + {_provisioningStatusUpdateTimeUtc = If( json?.PropertyT("provisioningStatusUpdateTimeUtc"), out var __jsonProvisioningStatusUpdateTimeUtc) ? global::System.DateTime.TryParse((string)__jsonProvisioningStatusUpdateTimeUtc, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonProvisioningStatusUpdateTimeUtcValue) ? __jsonProvisioningStatusUpdateTimeUtcValue : _provisioningStatusUpdateTimeUtc : _provisioningStatusUpdateTimeUtc;} + {_provisioningState = If( json?.PropertyT("provisioningState"), out var __jsonProvisioningState) ? (string)__jsonProvisioningState : (string)_provisioningState;} + {_autoDiscovery = If( json?.PropertyT("autoDiscovery"), out var __jsonAutoDiscovery) ? (string)__jsonAutoDiscovery : (string)_autoDiscovery;} + {_topLevelInventoryList = If( json?.PropertyT("topLevelInventoryList"), out var __jsonTopLevelInventoryList) ? If( __jsonTopLevelInventoryList as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : _topLevelInventoryList;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new DevOpsConfigurationProperties(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._authorization ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._authorization.ToJson(null,serializationMode) : null, "authorization" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._provisioningStatusMessage)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._provisioningStatusMessage.ToString()) : null, "provisioningStatusMessage" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._provisioningStatusUpdateTimeUtc ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._provisioningStatusUpdateTimeUtc?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "provisioningStatusUpdateTimeUtc" ,container.Add ); + } + AddIf( null != (((object)this._provisioningState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._provisioningState.ToString()) : null, "provisioningState" ,container.Add ); + AddIf( null != (((object)this._autoDiscovery)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._autoDiscovery.ToString()) : null, "autoDiscovery" ,container.Add ); + if (null != this._topLevelInventoryList) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.XNodeArray(); + foreach( var __x in this._topLevelInventoryList ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("topLevelInventoryList",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/ETag.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/ETag.PowerShell.cs new file mode 100644 index 000000000000..824d96848d66 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/ETag.PowerShell.cs @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// Entity tag is used for comparing two or more entities from the same requested resource. + /// + [System.ComponentModel.TypeConverter(typeof(ETagTypeConverter))] + public partial class ETag + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IETag DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ETag(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IETag DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ETag(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ETag(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Etag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IETagInternal)this).Etag = (string) content.GetValueForProperty("Etag",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IETagInternal)this).Etag, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ETag(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Etag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IETagInternal)this).Etag = (string) content.GetValueForProperty("Etag",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IETagInternal)this).Etag, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IETag FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// Entity tag is used for comparing two or more entities from the same requested resource. + [System.ComponentModel.TypeConverter(typeof(ETagTypeConverter))] + public partial interface IETag + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/ETag.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/ETag.TypeConverter.cs new file mode 100644 index 000000000000..ed54f826dc1f --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/ETag.TypeConverter.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ETagTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IETag ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IETag).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ETag.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ETag.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ETag.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/ETag.cs b/src/Security/Security.Autorest/generated/api/Models/ETag.cs new file mode 100644 index 000000000000..588211bbba33 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/ETag.cs @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// + /// Entity tag is used for comparing two or more entities from the same requested resource. + /// + public partial class ETag : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IETag, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IETagInternal + { + + /// Backing field for property. + private string _etag; + + /// + /// Entity tag is used for comparing two or more entities from the same requested resource. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string Etag { get => this._etag; set => this._etag = value; } + + /// Creates an new instance. + public ETag() + { + + } + } + /// Entity tag is used for comparing two or more entities from the same requested resource. + public partial interface IETag : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// + /// Entity tag is used for comparing two or more entities from the same requested resource. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Entity tag is used for comparing two or more entities from the same requested resource.", + SerializedName = @"etag", + PossibleTypes = new [] { typeof(string) })] + string Etag { get; set; } + + } + /// Entity tag is used for comparing two or more entities from the same requested resource. + internal partial interface IETagInternal + + { + /// + /// Entity tag is used for comparing two or more entities from the same requested resource. + /// + string Etag { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/ETag.json.cs b/src/Security/Security.Autorest/generated/api/Models/ETag.json.cs new file mode 100644 index 000000000000..b2feda437455 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/ETag.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// + /// Entity tag is used for comparing two or more entities from the same requested resource. + /// + public partial class ETag + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal ETag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_etag = If( json?.PropertyT("etag"), out var __jsonEtag) ? (string)__jsonEtag : (string)_etag;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IETag. + /// + /// a to deserialize from. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IETag. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IETag FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new ETag(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._etag)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._etag.ToString()) : null, "etag" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/ErrorAdditionalInfo.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/ErrorAdditionalInfo.PowerShell.cs new file mode 100644 index 000000000000..8059d55a0d65 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/ErrorAdditionalInfo.PowerShell.cs @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The resource management error additional info. + [System.ComponentModel.TypeConverter(typeof(ErrorAdditionalInfoTypeConverter))] + public partial class ErrorAdditionalInfo + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorAdditionalInfo DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ErrorAdditionalInfo(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorAdditionalInfo DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ErrorAdditionalInfo(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ErrorAdditionalInfo(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorAdditionalInfoInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorAdditionalInfoInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Info")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorAdditionalInfoInternal)this).Info = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAny) content.GetValueForProperty("Info",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorAdditionalInfoInternal)this).Info, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AnyTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ErrorAdditionalInfo(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorAdditionalInfoInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorAdditionalInfoInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Info")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorAdditionalInfoInternal)this).Info = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAny) content.GetValueForProperty("Info",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorAdditionalInfoInternal)this).Info, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AnyTypeConverter.ConvertFrom); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorAdditionalInfo FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The resource management error additional info. + [System.ComponentModel.TypeConverter(typeof(ErrorAdditionalInfoTypeConverter))] + public partial interface IErrorAdditionalInfo + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/ErrorAdditionalInfo.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/ErrorAdditionalInfo.TypeConverter.cs new file mode 100644 index 000000000000..0ee82ae4ae42 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/ErrorAdditionalInfo.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ErrorAdditionalInfoTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorAdditionalInfo ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorAdditionalInfo).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ErrorAdditionalInfo.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ErrorAdditionalInfo.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ErrorAdditionalInfo.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/ErrorAdditionalInfo.cs b/src/Security/Security.Autorest/generated/api/Models/ErrorAdditionalInfo.cs new file mode 100644 index 000000000000..2dcba245ad2c --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/ErrorAdditionalInfo.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The resource management error additional info. + public partial class ErrorAdditionalInfo : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorAdditionalInfo, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorAdditionalInfoInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAny _info; + + /// The additional info. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAny Info { get => (this._info = this._info ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.Any()); } + + /// Internal Acessors for Info + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAny Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorAdditionalInfoInternal.Info { get => (this._info = this._info ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.Any()); set { {_info = value;} } } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorAdditionalInfoInternal.Type { get => this._type; set { {_type = value;} } } + + /// Backing field for property. + private string _type; + + /// The additional info type. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string Type { get => this._type; } + + /// Creates an new instance. + public ErrorAdditionalInfo() + { + + } + } + /// The resource management error additional info. + public partial interface IErrorAdditionalInfo : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// The additional info. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The additional info.", + SerializedName = @"info", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAny) })] + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAny Info { get; } + /// The additional info type. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The additional info type.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string Type { get; } + + } + /// The resource management error additional info. + internal partial interface IErrorAdditionalInfoInternal + + { + /// The additional info. + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAny Info { get; set; } + /// The additional info type. + string Type { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/ErrorAdditionalInfo.json.cs b/src/Security/Security.Autorest/generated/api/Models/ErrorAdditionalInfo.json.cs new file mode 100644 index 000000000000..3abbced90f75 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/ErrorAdditionalInfo.json.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The resource management error additional info. + public partial class ErrorAdditionalInfo + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal ErrorAdditionalInfo(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_type = If( json?.PropertyT("type"), out var __jsonType) ? (string)__jsonType : (string)_type;} + {_info = If( json?.PropertyT("info"), out var __jsonInfo) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.Any.FromJson(__jsonInfo) : _info;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorAdditionalInfo. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorAdditionalInfo. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorAdditionalInfo FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new ErrorAdditionalInfo(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._type.ToString()) : null, "type" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._info ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._info.ToJson(null,serializationMode) : null, "info" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/ErrorDetail.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/ErrorDetail.PowerShell.cs new file mode 100644 index 000000000000..b21d5fd15613 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/ErrorDetail.PowerShell.cs @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The error detail. + [System.ComponentModel.TypeConverter(typeof(ErrorDetailTypeConverter))] + public partial class ErrorDetail + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetail DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ErrorDetail(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetail DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ErrorDetail(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ErrorDetail(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailInternal)this).Target, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorDetailTypeConverter.ConvertFrom)); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorAdditionalInfoTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ErrorDetail(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailInternal)this).Target, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorDetailTypeConverter.ConvertFrom)); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorAdditionalInfoTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetail FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The error detail. + [System.ComponentModel.TypeConverter(typeof(ErrorDetailTypeConverter))] + public partial interface IErrorDetail + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/ErrorDetail.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/ErrorDetail.TypeConverter.cs new file mode 100644 index 000000000000..87ad45ee1491 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/ErrorDetail.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ErrorDetailTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetail ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetail).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ErrorDetail.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ErrorDetail.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ErrorDetail.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/ErrorDetail.cs b/src/Security/Security.Autorest/generated/api/Models/ErrorDetail.cs new file mode 100644 index 000000000000..c0ed485c7aee --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/ErrorDetail.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The error detail. + public partial class ErrorDetail : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetail, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailInternal + { + + /// Backing field for property. + private System.Collections.Generic.List _additionalInfo; + + /// The error additional info. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public System.Collections.Generic.List AdditionalInfo { get => this._additionalInfo; } + + /// Backing field for property. + private string _code; + + /// The error code. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string Code { get => this._code; } + + /// Backing field for property. + private System.Collections.Generic.List _detail; + + /// The error details. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public System.Collections.Generic.List Detail { get => this._detail; } + + /// Backing field for property. + private string _message; + + /// The error message. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string Message { get => this._message; } + + /// Internal Acessors for AdditionalInfo + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailInternal.AdditionalInfo { get => this._additionalInfo; set { {_additionalInfo = value;} } } + + /// Internal Acessors for Code + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailInternal.Code { get => this._code; set { {_code = value;} } } + + /// Internal Acessors for Detail + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailInternal.Detail { get => this._detail; set { {_detail = value;} } } + + /// Internal Acessors for Message + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailInternal.Message { get => this._message; set { {_message = value;} } } + + /// Internal Acessors for Target + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailInternal.Target { get => this._target; set { {_target = value;} } } + + /// Backing field for property. + private string _target; + + /// The error target. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string Target { get => this._target; } + + /// Creates an new instance. + public ErrorDetail() + { + + } + } + /// The error detail. + public partial interface IErrorDetail : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// The error additional info. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The error additional info.", + SerializedName = @"additionalInfo", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorAdditionalInfo) })] + System.Collections.Generic.List AdditionalInfo { get; } + /// The error code. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The error code.", + SerializedName = @"code", + PossibleTypes = new [] { typeof(string) })] + string Code { get; } + /// The error details. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The error details.", + SerializedName = @"details", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetail) })] + System.Collections.Generic.List Detail { get; } + /// The error message. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The error message.", + SerializedName = @"message", + PossibleTypes = new [] { typeof(string) })] + string Message { get; } + /// The error target. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The error target.", + SerializedName = @"target", + PossibleTypes = new [] { typeof(string) })] + string Target { get; } + + } + /// The error detail. + internal partial interface IErrorDetailInternal + + { + /// The error additional info. + System.Collections.Generic.List AdditionalInfo { get; set; } + /// The error code. + string Code { get; set; } + /// The error details. + System.Collections.Generic.List Detail { get; set; } + /// The error message. + string Message { get; set; } + /// The error target. + string Target { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/ErrorDetail.json.cs b/src/Security/Security.Autorest/generated/api/Models/ErrorDetail.json.cs new file mode 100644 index 000000000000..4972832e68b1 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/ErrorDetail.json.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The error detail. + public partial class ErrorDetail + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal ErrorDetail(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_code = If( json?.PropertyT("code"), out var __jsonCode) ? (string)__jsonCode : (string)_code;} + {_message = If( json?.PropertyT("message"), out var __jsonMessage) ? (string)__jsonMessage : (string)_message;} + {_target = If( json?.PropertyT("target"), out var __jsonTarget) ? (string)__jsonTarget : (string)_target;} + {_detail = If( json?.PropertyT("details"), out var __jsonDetails) ? If( __jsonDetails as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetail) (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorDetail.FromJson(__u) )) ))() : null : _detail;} + {_additionalInfo = If( json?.PropertyT("additionalInfo"), out var __jsonAdditionalInfo) ? If( __jsonAdditionalInfo as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonArray, out var __q) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__q, (__p)=>(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorAdditionalInfo) (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorAdditionalInfo.FromJson(__p) )) ))() : null : _additionalInfo;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetail. + /// + /// a to deserialize from. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetail. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetail FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new ErrorDetail(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._code)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._code.ToString()) : null, "code" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._message)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._message.ToString()) : null, "message" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._target)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._target.ToString()) : null, "target" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + if (null != this._detail) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.XNodeArray(); + foreach( var __x in this._detail ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("details",__w); + } + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + if (null != this._additionalInfo) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.XNodeArray(); + foreach( var __s in this._additionalInfo ) + { + AddIf(__s?.ToJson(null, serializationMode) ,__r.Add); + } + container.Add("additionalInfo",__r); + } + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/ErrorDetailAutoGenerated.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/ErrorDetailAutoGenerated.PowerShell.cs new file mode 100644 index 000000000000..db38b8167912 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/ErrorDetailAutoGenerated.PowerShell.cs @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The error detail. + [System.ComponentModel.TypeConverter(typeof(ErrorDetailAutoGeneratedTypeConverter))] + public partial class ErrorDetailAutoGenerated + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailAutoGenerated DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ErrorDetailAutoGenerated(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailAutoGenerated DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ErrorDetailAutoGenerated(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ErrorDetailAutoGenerated(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailAutoGeneratedInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailAutoGeneratedInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailAutoGeneratedInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailAutoGeneratedInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailAutoGeneratedInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailAutoGeneratedInternal)this).Target, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailAutoGeneratedInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailAutoGeneratedInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorDetailAutoGeneratedTypeConverter.ConvertFrom)); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailAutoGeneratedInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailAutoGeneratedInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorAdditionalInfoTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ErrorDetailAutoGenerated(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailAutoGeneratedInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailAutoGeneratedInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailAutoGeneratedInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailAutoGeneratedInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailAutoGeneratedInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailAutoGeneratedInternal)this).Target, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailAutoGeneratedInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailAutoGeneratedInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorDetailAutoGeneratedTypeConverter.ConvertFrom)); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailAutoGeneratedInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailAutoGeneratedInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorAdditionalInfoTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailAutoGenerated FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The error detail. + [System.ComponentModel.TypeConverter(typeof(ErrorDetailAutoGeneratedTypeConverter))] + public partial interface IErrorDetailAutoGenerated + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/ErrorDetailAutoGenerated.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/ErrorDetailAutoGenerated.TypeConverter.cs new file mode 100644 index 000000000000..65c41f08eac8 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/ErrorDetailAutoGenerated.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ErrorDetailAutoGeneratedTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailAutoGenerated ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailAutoGenerated).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ErrorDetailAutoGenerated.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ErrorDetailAutoGenerated.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ErrorDetailAutoGenerated.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/ErrorDetailAutoGenerated.cs b/src/Security/Security.Autorest/generated/api/Models/ErrorDetailAutoGenerated.cs new file mode 100644 index 000000000000..572720300c68 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/ErrorDetailAutoGenerated.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The error detail. + public partial class ErrorDetailAutoGenerated : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailAutoGenerated, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailAutoGeneratedInternal + { + + /// Backing field for property. + private System.Collections.Generic.List _additionalInfo; + + /// The error additional info. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public System.Collections.Generic.List AdditionalInfo { get => this._additionalInfo; } + + /// Backing field for property. + private string _code; + + /// The error code. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string Code { get => this._code; } + + /// Backing field for property. + private System.Collections.Generic.List _detail; + + /// The error details. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public System.Collections.Generic.List Detail { get => this._detail; } + + /// Backing field for property. + private string _message; + + /// The error message. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string Message { get => this._message; } + + /// Internal Acessors for AdditionalInfo + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailAutoGeneratedInternal.AdditionalInfo { get => this._additionalInfo; set { {_additionalInfo = value;} } } + + /// Internal Acessors for Code + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailAutoGeneratedInternal.Code { get => this._code; set { {_code = value;} } } + + /// Internal Acessors for Detail + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailAutoGeneratedInternal.Detail { get => this._detail; set { {_detail = value;} } } + + /// Internal Acessors for Message + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailAutoGeneratedInternal.Message { get => this._message; set { {_message = value;} } } + + /// Internal Acessors for Target + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailAutoGeneratedInternal.Target { get => this._target; set { {_target = value;} } } + + /// Backing field for property. + private string _target; + + /// The error target. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string Target { get => this._target; } + + /// Creates an new instance. + public ErrorDetailAutoGenerated() + { + + } + } + /// The error detail. + public partial interface IErrorDetailAutoGenerated : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// The error additional info. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The error additional info.", + SerializedName = @"additionalInfo", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorAdditionalInfo) })] + System.Collections.Generic.List AdditionalInfo { get; } + /// The error code. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The error code.", + SerializedName = @"code", + PossibleTypes = new [] { typeof(string) })] + string Code { get; } + /// The error details. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The error details.", + SerializedName = @"details", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailAutoGenerated) })] + System.Collections.Generic.List Detail { get; } + /// The error message. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The error message.", + SerializedName = @"message", + PossibleTypes = new [] { typeof(string) })] + string Message { get; } + /// The error target. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The error target.", + SerializedName = @"target", + PossibleTypes = new [] { typeof(string) })] + string Target { get; } + + } + /// The error detail. + internal partial interface IErrorDetailAutoGeneratedInternal + + { + /// The error additional info. + System.Collections.Generic.List AdditionalInfo { get; set; } + /// The error code. + string Code { get; set; } + /// The error details. + System.Collections.Generic.List Detail { get; set; } + /// The error message. + string Message { get; set; } + /// The error target. + string Target { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/ErrorDetailAutoGenerated.json.cs b/src/Security/Security.Autorest/generated/api/Models/ErrorDetailAutoGenerated.json.cs new file mode 100644 index 000000000000..5fc8e26a60d6 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/ErrorDetailAutoGenerated.json.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The error detail. + public partial class ErrorDetailAutoGenerated + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal ErrorDetailAutoGenerated(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_code = If( json?.PropertyT("code"), out var __jsonCode) ? (string)__jsonCode : (string)_code;} + {_message = If( json?.PropertyT("message"), out var __jsonMessage) ? (string)__jsonMessage : (string)_message;} + {_target = If( json?.PropertyT("target"), out var __jsonTarget) ? (string)__jsonTarget : (string)_target;} + {_detail = If( json?.PropertyT("details"), out var __jsonDetails) ? If( __jsonDetails as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailAutoGenerated) (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorDetailAutoGenerated.FromJson(__u) )) ))() : null : _detail;} + {_additionalInfo = If( json?.PropertyT("additionalInfo"), out var __jsonAdditionalInfo) ? If( __jsonAdditionalInfo as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonArray, out var __q) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__q, (__p)=>(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorAdditionalInfo) (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorAdditionalInfo.FromJson(__p) )) ))() : null : _additionalInfo;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailAutoGenerated. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailAutoGenerated. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailAutoGenerated FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new ErrorDetailAutoGenerated(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._code)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._code.ToString()) : null, "code" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._message)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._message.ToString()) : null, "message" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._target)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._target.ToString()) : null, "target" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + if (null != this._detail) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.XNodeArray(); + foreach( var __x in this._detail ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("details",__w); + } + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + if (null != this._additionalInfo) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.XNodeArray(); + foreach( var __s in this._additionalInfo ) + { + AddIf(__s?.ToJson(null, serializationMode) ,__r.Add); + } + container.Add("additionalInfo",__r); + } + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/ErrorResponse.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/ErrorResponse.PowerShell.cs new file mode 100644 index 000000000000..a384c8b8ce76 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/ErrorResponse.PowerShell.cs @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows + /// the OData error response format.). + /// + [System.ComponentModel.TypeConverter(typeof(ErrorResponseTypeConverter))] + public partial class ErrorResponse + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ErrorResponse(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ErrorResponse(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ErrorResponse(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetail) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorDetailTypeConverter.ConvertFrom); + } + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseInternal)this).Target, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorDetailTypeConverter.ConvertFrom)); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorAdditionalInfoTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ErrorResponse(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetail) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorDetailTypeConverter.ConvertFrom); + } + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseInternal)this).Target, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorDetailTypeConverter.ConvertFrom)); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorAdditionalInfoTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows + /// the OData error response format.). + [System.ComponentModel.TypeConverter(typeof(ErrorResponseTypeConverter))] + public partial interface IErrorResponse + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/ErrorResponse.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/ErrorResponse.TypeConverter.cs new file mode 100644 index 000000000000..a7084b392b08 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/ErrorResponse.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ErrorResponseTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ErrorResponse.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ErrorResponse.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ErrorResponse.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/ErrorResponse.cs b/src/Security/Security.Autorest/generated/api/Models/ErrorResponse.cs new file mode 100644 index 000000000000..c4b6f10af334 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/ErrorResponse.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// + /// Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows + /// the OData error response format.). + /// + public partial class ErrorResponse : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseInternal + { + + /// The error additional info. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public System.Collections.Generic.List AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailInternal)Error).AdditionalInfo; } + + /// The error code. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailInternal)Error).Code; } + + /// The error details. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public System.Collections.Generic.List Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailInternal)Error).Detail; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetail _error; + + /// The error object. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetail Error { get => (this._error = this._error ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorDetail()); set => this._error = value; } + + /// The error message. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailInternal)Error).Message; } + + /// Internal Acessors for AdditionalInfo + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseInternal.AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailInternal)Error).AdditionalInfo; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailInternal)Error).AdditionalInfo = value; } + + /// Internal Acessors for Code + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseInternal.Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailInternal)Error).Code; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailInternal)Error).Code = value; } + + /// Internal Acessors for Detail + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseInternal.Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailInternal)Error).Detail; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailInternal)Error).Detail = value; } + + /// Internal Acessors for Error + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetail Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseInternal.Error { get => (this._error = this._error ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorDetail()); set { {_error = value;} } } + + /// Internal Acessors for Message + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseInternal.Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailInternal)Error).Message; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailInternal)Error).Message = value; } + + /// Internal Acessors for Target + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseInternal.Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailInternal)Error).Target; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailInternal)Error).Target = value; } + + /// The error target. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailInternal)Error).Target; } + + /// Creates an new instance. + public ErrorResponse() + { + + } + } + /// Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows + /// the OData error response format.). + public partial interface IErrorResponse : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// The error additional info. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The error additional info.", + SerializedName = @"additionalInfo", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorAdditionalInfo) })] + System.Collections.Generic.List AdditionalInfo { get; } + /// The error code. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The error code.", + SerializedName = @"code", + PossibleTypes = new [] { typeof(string) })] + string Code { get; } + /// The error details. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The error details.", + SerializedName = @"details", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetail) })] + System.Collections.Generic.List Detail { get; } + /// The error message. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The error message.", + SerializedName = @"message", + PossibleTypes = new [] { typeof(string) })] + string Message { get; } + /// The error target. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The error target.", + SerializedName = @"target", + PossibleTypes = new [] { typeof(string) })] + string Target { get; } + + } + /// Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows + /// the OData error response format.). + internal partial interface IErrorResponseInternal + + { + /// The error additional info. + System.Collections.Generic.List AdditionalInfo { get; set; } + /// The error code. + string Code { get; set; } + /// The error details. + System.Collections.Generic.List Detail { get; set; } + /// The error object. + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetail Error { get; set; } + /// The error message. + string Message { get; set; } + /// The error target. + string Target { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/ErrorResponse.json.cs b/src/Security/Security.Autorest/generated/api/Models/ErrorResponse.json.cs new file mode 100644 index 000000000000..3ac2aa28e4f7 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/ErrorResponse.json.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// + /// Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows + /// the OData error response format.). + /// + public partial class ErrorResponse + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal ErrorResponse(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_error = If( json?.PropertyT("error"), out var __jsonError) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorDetail.FromJson(__jsonError) : _error;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new ErrorResponse(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._error ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._error.ToJson(null,serializationMode) : null, "error" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/ErrorResponseAutoGenerated.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/ErrorResponseAutoGenerated.PowerShell.cs new file mode 100644 index 000000000000..f602cc71ee29 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/ErrorResponseAutoGenerated.PowerShell.cs @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows + /// the OData error response format.). + /// + [System.ComponentModel.TypeConverter(typeof(ErrorResponseAutoGeneratedTypeConverter))] + public partial class ErrorResponseAutoGenerated + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseAutoGenerated DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ErrorResponseAutoGenerated(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseAutoGenerated DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ErrorResponseAutoGenerated(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ErrorResponseAutoGenerated(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseAutoGeneratedInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailAutoGenerated) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseAutoGeneratedInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorDetailAutoGeneratedTypeConverter.ConvertFrom); + } + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseAutoGeneratedInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseAutoGeneratedInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseAutoGeneratedInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseAutoGeneratedInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseAutoGeneratedInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseAutoGeneratedInternal)this).Target, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseAutoGeneratedInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseAutoGeneratedInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorDetailAutoGeneratedTypeConverter.ConvertFrom)); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseAutoGeneratedInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseAutoGeneratedInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorAdditionalInfoTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ErrorResponseAutoGenerated(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseAutoGeneratedInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailAutoGenerated) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseAutoGeneratedInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorDetailAutoGeneratedTypeConverter.ConvertFrom); + } + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseAutoGeneratedInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseAutoGeneratedInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseAutoGeneratedInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseAutoGeneratedInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseAutoGeneratedInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseAutoGeneratedInternal)this).Target, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseAutoGeneratedInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseAutoGeneratedInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorDetailAutoGeneratedTypeConverter.ConvertFrom)); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseAutoGeneratedInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseAutoGeneratedInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorAdditionalInfoTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseAutoGenerated FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows + /// the OData error response format.). + [System.ComponentModel.TypeConverter(typeof(ErrorResponseAutoGeneratedTypeConverter))] + public partial interface IErrorResponseAutoGenerated + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/ErrorResponseAutoGenerated.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/ErrorResponseAutoGenerated.TypeConverter.cs new file mode 100644 index 000000000000..fe9a9c0cde7d --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/ErrorResponseAutoGenerated.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ErrorResponseAutoGeneratedTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseAutoGenerated ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseAutoGenerated).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ErrorResponseAutoGenerated.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ErrorResponseAutoGenerated.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ErrorResponseAutoGenerated.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/ErrorResponseAutoGenerated.cs b/src/Security/Security.Autorest/generated/api/Models/ErrorResponseAutoGenerated.cs new file mode 100644 index 000000000000..6153a7835d86 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/ErrorResponseAutoGenerated.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// + /// Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows + /// the OData error response format.). + /// + public partial class ErrorResponseAutoGenerated : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseAutoGenerated, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseAutoGeneratedInternal + { + + /// The error additional info. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public System.Collections.Generic.List AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailAutoGeneratedInternal)Error).AdditionalInfo; } + + /// The error code. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailAutoGeneratedInternal)Error).Code; } + + /// The error details. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public System.Collections.Generic.List Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailAutoGeneratedInternal)Error).Detail; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailAutoGenerated _error; + + /// The error object. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailAutoGenerated Error { get => (this._error = this._error ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorDetailAutoGenerated()); set => this._error = value; } + + /// The error message. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailAutoGeneratedInternal)Error).Message; } + + /// Internal Acessors for AdditionalInfo + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseAutoGeneratedInternal.AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailAutoGeneratedInternal)Error).AdditionalInfo; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailAutoGeneratedInternal)Error).AdditionalInfo = value; } + + /// Internal Acessors for Code + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseAutoGeneratedInternal.Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailAutoGeneratedInternal)Error).Code; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailAutoGeneratedInternal)Error).Code = value; } + + /// Internal Acessors for Detail + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseAutoGeneratedInternal.Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailAutoGeneratedInternal)Error).Detail; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailAutoGeneratedInternal)Error).Detail = value; } + + /// Internal Acessors for Error + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailAutoGenerated Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseAutoGeneratedInternal.Error { get => (this._error = this._error ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorDetailAutoGenerated()); set { {_error = value;} } } + + /// Internal Acessors for Message + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseAutoGeneratedInternal.Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailAutoGeneratedInternal)Error).Message; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailAutoGeneratedInternal)Error).Message = value; } + + /// Internal Acessors for Target + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseAutoGeneratedInternal.Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailAutoGeneratedInternal)Error).Target; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailAutoGeneratedInternal)Error).Target = value; } + + /// The error target. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailAutoGeneratedInternal)Error).Target; } + + /// Creates an new instance. + public ErrorResponseAutoGenerated() + { + + } + } + /// Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows + /// the OData error response format.). + public partial interface IErrorResponseAutoGenerated : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// The error additional info. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The error additional info.", + SerializedName = @"additionalInfo", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorAdditionalInfo) })] + System.Collections.Generic.List AdditionalInfo { get; } + /// The error code. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The error code.", + SerializedName = @"code", + PossibleTypes = new [] { typeof(string) })] + string Code { get; } + /// The error details. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The error details.", + SerializedName = @"details", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailAutoGenerated) })] + System.Collections.Generic.List Detail { get; } + /// The error message. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The error message.", + SerializedName = @"message", + PossibleTypes = new [] { typeof(string) })] + string Message { get; } + /// The error target. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The error target.", + SerializedName = @"target", + PossibleTypes = new [] { typeof(string) })] + string Target { get; } + + } + /// Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows + /// the OData error response format.). + internal partial interface IErrorResponseAutoGeneratedInternal + + { + /// The error additional info. + System.Collections.Generic.List AdditionalInfo { get; set; } + /// The error code. + string Code { get; set; } + /// The error details. + System.Collections.Generic.List Detail { get; set; } + /// The error object. + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailAutoGenerated Error { get; set; } + /// The error message. + string Message { get; set; } + /// The error target. + string Target { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/ErrorResponseAutoGenerated.json.cs b/src/Security/Security.Autorest/generated/api/Models/ErrorResponseAutoGenerated.json.cs new file mode 100644 index 000000000000..5b9e8541771e --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/ErrorResponseAutoGenerated.json.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// + /// Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows + /// the OData error response format.). + /// + public partial class ErrorResponseAutoGenerated + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal ErrorResponseAutoGenerated(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_error = If( json?.PropertyT("error"), out var __jsonError) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorDetailAutoGenerated.FromJson(__jsonError) : _error;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseAutoGenerated. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseAutoGenerated. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseAutoGenerated FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new ErrorResponseAutoGenerated(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._error ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._error.ToJson(null,serializationMode) : null, "error" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GcpOrganizationalData.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/GcpOrganizationalData.PowerShell.cs new file mode 100644 index 000000000000..b0573a1bd753 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GcpOrganizationalData.PowerShell.cs @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The gcpOrganization data + [System.ComponentModel.TypeConverter(typeof(GcpOrganizationalDataTypeConverter))] + public partial class GcpOrganizationalData + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalData DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new GcpOrganizationalData(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalData DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new GcpOrganizationalData(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalData FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal GcpOrganizationalData(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("OrganizationMembershipType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalDataInternal)this).OrganizationMembershipType = (string) content.GetValueForProperty("OrganizationMembershipType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalDataInternal)this).OrganizationMembershipType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal GcpOrganizationalData(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("OrganizationMembershipType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalDataInternal)this).OrganizationMembershipType = (string) content.GetValueForProperty("OrganizationMembershipType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalDataInternal)this).OrganizationMembershipType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The gcpOrganization data + [System.ComponentModel.TypeConverter(typeof(GcpOrganizationalDataTypeConverter))] + public partial interface IGcpOrganizationalData + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GcpOrganizationalData.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/GcpOrganizationalData.TypeConverter.cs new file mode 100644 index 000000000000..d5fcb5ae3e84 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GcpOrganizationalData.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class GcpOrganizationalDataTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalData ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalData).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return GcpOrganizationalData.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return GcpOrganizationalData.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return GcpOrganizationalData.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GcpOrganizationalData.cs b/src/Security/Security.Autorest/generated/api/Models/GcpOrganizationalData.cs new file mode 100644 index 000000000000..896fd456cab5 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GcpOrganizationalData.cs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The gcpOrganization data + public partial class GcpOrganizationalData : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalData, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalDataInternal + { + + /// Backing field for property. + private string _organizationMembershipType; + + /// The multi cloud account's membership type in the organization + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string OrganizationMembershipType { get => this._organizationMembershipType; set => this._organizationMembershipType = value; } + + /// Creates an new instance. + public GcpOrganizationalData() + { + + } + } + /// The gcpOrganization data + public partial interface IGcpOrganizationalData : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// The multi cloud account's membership type in the organization + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The multi cloud account's membership type in the organization", + SerializedName = @"organizationMembershipType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Member", "Organization")] + string OrganizationMembershipType { get; set; } + + } + /// The gcpOrganization data + internal partial interface IGcpOrganizationalDataInternal + + { + /// The multi cloud account's membership type in the organization + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Member", "Organization")] + string OrganizationMembershipType { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GcpOrganizationalData.json.cs b/src/Security/Security.Autorest/generated/api/Models/GcpOrganizationalData.json.cs new file mode 100644 index 000000000000..5e396d702e8e --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GcpOrganizationalData.json.cs @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The gcpOrganization data + public partial class GcpOrganizationalData + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalData. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalData interface is polymorphic, and the + /// precise model class that will get deserialized is determined at runtime based on the payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalData. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalData FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("organizationMembershipType") ) + { + case "Organization": + { + return new GcpOrganizationalDataOrganization(json); + } + case "Member": + { + return new GcpOrganizationalDataMember(json); + } + } + return new GcpOrganizationalData(json); + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal GcpOrganizationalData(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_organizationMembershipType = If( json?.PropertyT("organizationMembershipType"), out var __jsonOrganizationMembershipType) ? (string)__jsonOrganizationMembershipType : (string)_organizationMembershipType;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._organizationMembershipType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._organizationMembershipType.ToString()) : null, "organizationMembershipType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GcpOrganizationalDataMember.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/GcpOrganizationalDataMember.PowerShell.cs new file mode 100644 index 000000000000..4898f6ea3e82 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GcpOrganizationalDataMember.PowerShell.cs @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The gcpOrganization data for the member account + [System.ComponentModel.TypeConverter(typeof(GcpOrganizationalDataMemberTypeConverter))] + public partial class GcpOrganizationalDataMember + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalDataMember DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new GcpOrganizationalDataMember(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalDataMember DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new GcpOrganizationalDataMember(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalDataMember FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal GcpOrganizationalDataMember(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ParentHierarchyId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalDataMemberInternal)this).ParentHierarchyId = (string) content.GetValueForProperty("ParentHierarchyId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalDataMemberInternal)this).ParentHierarchyId, global::System.Convert.ToString); + } + if (content.Contains("ManagementProjectNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalDataMemberInternal)this).ManagementProjectNumber = (string) content.GetValueForProperty("ManagementProjectNumber",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalDataMemberInternal)this).ManagementProjectNumber, global::System.Convert.ToString); + } + if (content.Contains("OrganizationMembershipType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalDataInternal)this).OrganizationMembershipType = (string) content.GetValueForProperty("OrganizationMembershipType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalDataInternal)this).OrganizationMembershipType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal GcpOrganizationalDataMember(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ParentHierarchyId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalDataMemberInternal)this).ParentHierarchyId = (string) content.GetValueForProperty("ParentHierarchyId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalDataMemberInternal)this).ParentHierarchyId, global::System.Convert.ToString); + } + if (content.Contains("ManagementProjectNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalDataMemberInternal)this).ManagementProjectNumber = (string) content.GetValueForProperty("ManagementProjectNumber",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalDataMemberInternal)this).ManagementProjectNumber, global::System.Convert.ToString); + } + if (content.Contains("OrganizationMembershipType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalDataInternal)this).OrganizationMembershipType = (string) content.GetValueForProperty("OrganizationMembershipType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalDataInternal)this).OrganizationMembershipType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The gcpOrganization data for the member account + [System.ComponentModel.TypeConverter(typeof(GcpOrganizationalDataMemberTypeConverter))] + public partial interface IGcpOrganizationalDataMember + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GcpOrganizationalDataMember.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/GcpOrganizationalDataMember.TypeConverter.cs new file mode 100644 index 000000000000..e5b55398735d --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GcpOrganizationalDataMember.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class GcpOrganizationalDataMemberTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalDataMember ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalDataMember).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return GcpOrganizationalDataMember.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return GcpOrganizationalDataMember.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return GcpOrganizationalDataMember.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GcpOrganizationalDataMember.cs b/src/Security/Security.Autorest/generated/api/Models/GcpOrganizationalDataMember.cs new file mode 100644 index 000000000000..4e3585eb0774 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GcpOrganizationalDataMember.cs @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The gcpOrganization data for the member account + public partial class GcpOrganizationalDataMember : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalDataMember, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalDataMemberInternal, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalData __gcpOrganizationalData = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GcpOrganizationalData(); + + /// Backing field for property. + private string _managementProjectNumber; + + /// The GCP management project number from organizational onboarding + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string ManagementProjectNumber { get => this._managementProjectNumber; set => this._managementProjectNumber = value; } + + /// The multi cloud account's membership type in the organization + [Microsoft.Azure.PowerShell.Cmdlets.Security.Constant] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string OrganizationMembershipType { get => "Member"; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalDataInternal)__gcpOrganizationalData).OrganizationMembershipType = "Member"; } + + /// Backing field for property. + private string _parentHierarchyId; + + /// + /// If the multi cloud account is not of membership type organization, this will be the ID of the project's parent + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string ParentHierarchyId { get => this._parentHierarchyId; set => this._parentHierarchyId = value; } + + /// Creates an new instance. + public GcpOrganizationalDataMember() + { + this.__gcpOrganizationalData.OrganizationMembershipType = "Member"; + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__gcpOrganizationalData), __gcpOrganizationalData); + await eventListener.AssertObjectIsValid(nameof(__gcpOrganizationalData), __gcpOrganizationalData); + } + } + /// The gcpOrganization data for the member account + public partial interface IGcpOrganizationalDataMember : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalData + { + /// The GCP management project number from organizational onboarding + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The GCP management project number from organizational onboarding", + SerializedName = @"managementProjectNumber", + PossibleTypes = new [] { typeof(string) })] + string ManagementProjectNumber { get; set; } + /// + /// If the multi cloud account is not of membership type organization, this will be the ID of the project's parent + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"If the multi cloud account is not of membership type organization, this will be the ID of the project's parent", + SerializedName = @"parentHierarchyId", + PossibleTypes = new [] { typeof(string) })] + string ParentHierarchyId { get; set; } + + } + /// The gcpOrganization data for the member account + internal partial interface IGcpOrganizationalDataMemberInternal : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalDataInternal + { + /// The GCP management project number from organizational onboarding + string ManagementProjectNumber { get; set; } + /// + /// If the multi cloud account is not of membership type organization, this will be the ID of the project's parent + /// + string ParentHierarchyId { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GcpOrganizationalDataMember.json.cs b/src/Security/Security.Autorest/generated/api/Models/GcpOrganizationalDataMember.json.cs new file mode 100644 index 000000000000..69073df3d1e5 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GcpOrganizationalDataMember.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The gcpOrganization data for the member account + public partial class GcpOrganizationalDataMember + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalDataMember. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalDataMember. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalDataMember FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new GcpOrganizationalDataMember(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal GcpOrganizationalDataMember(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __gcpOrganizationalData = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GcpOrganizationalData(json); + {_parentHierarchyId = If( json?.PropertyT("parentHierarchyId"), out var __jsonParentHierarchyId) ? (string)__jsonParentHierarchyId : (string)_parentHierarchyId;} + {_managementProjectNumber = If( json?.PropertyT("managementProjectNumber"), out var __jsonManagementProjectNumber) ? (string)__jsonManagementProjectNumber : (string)_managementProjectNumber;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __gcpOrganizationalData?.ToJson(container, serializationMode); + AddIf( null != (((object)this._parentHierarchyId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._parentHierarchyId.ToString()) : null, "parentHierarchyId" ,container.Add ); + AddIf( null != (((object)this._managementProjectNumber)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._managementProjectNumber.ToString()) : null, "managementProjectNumber" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GcpOrganizationalDataOrganization.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/GcpOrganizationalDataOrganization.PowerShell.cs new file mode 100644 index 000000000000..07eaa384fa7b --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GcpOrganizationalDataOrganization.PowerShell.cs @@ -0,0 +1,198 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The gcpOrganization data for the parent account + [System.ComponentModel.TypeConverter(typeof(GcpOrganizationalDataOrganizationTypeConverter))] + public partial class GcpOrganizationalDataOrganization + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalDataOrganization DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new GcpOrganizationalDataOrganization(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalDataOrganization DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new GcpOrganizationalDataOrganization(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalDataOrganization FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal GcpOrganizationalDataOrganization(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ExcludedProjectNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalDataOrganizationInternal)this).ExcludedProjectNumber = (System.Collections.Generic.List) content.GetValueForProperty("ExcludedProjectNumber",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalDataOrganizationInternal)this).ExcludedProjectNumber, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("ServiceAccountEmailAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalDataOrganizationInternal)this).ServiceAccountEmailAddress = (string) content.GetValueForProperty("ServiceAccountEmailAddress",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalDataOrganizationInternal)this).ServiceAccountEmailAddress, global::System.Convert.ToString); + } + if (content.Contains("WorkloadIdentityProviderId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalDataOrganizationInternal)this).WorkloadIdentityProviderId = (string) content.GetValueForProperty("WorkloadIdentityProviderId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalDataOrganizationInternal)this).WorkloadIdentityProviderId, global::System.Convert.ToString); + } + if (content.Contains("OrganizationName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalDataOrganizationInternal)this).OrganizationName = (string) content.GetValueForProperty("OrganizationName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalDataOrganizationInternal)this).OrganizationName, global::System.Convert.ToString); + } + if (content.Contains("OrganizationMembershipType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalDataInternal)this).OrganizationMembershipType = (string) content.GetValueForProperty("OrganizationMembershipType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalDataInternal)this).OrganizationMembershipType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal GcpOrganizationalDataOrganization(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ExcludedProjectNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalDataOrganizationInternal)this).ExcludedProjectNumber = (System.Collections.Generic.List) content.GetValueForProperty("ExcludedProjectNumber",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalDataOrganizationInternal)this).ExcludedProjectNumber, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("ServiceAccountEmailAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalDataOrganizationInternal)this).ServiceAccountEmailAddress = (string) content.GetValueForProperty("ServiceAccountEmailAddress",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalDataOrganizationInternal)this).ServiceAccountEmailAddress, global::System.Convert.ToString); + } + if (content.Contains("WorkloadIdentityProviderId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalDataOrganizationInternal)this).WorkloadIdentityProviderId = (string) content.GetValueForProperty("WorkloadIdentityProviderId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalDataOrganizationInternal)this).WorkloadIdentityProviderId, global::System.Convert.ToString); + } + if (content.Contains("OrganizationName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalDataOrganizationInternal)this).OrganizationName = (string) content.GetValueForProperty("OrganizationName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalDataOrganizationInternal)this).OrganizationName, global::System.Convert.ToString); + } + if (content.Contains("OrganizationMembershipType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalDataInternal)this).OrganizationMembershipType = (string) content.GetValueForProperty("OrganizationMembershipType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalDataInternal)this).OrganizationMembershipType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The gcpOrganization data for the parent account + [System.ComponentModel.TypeConverter(typeof(GcpOrganizationalDataOrganizationTypeConverter))] + public partial interface IGcpOrganizationalDataOrganization + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GcpOrganizationalDataOrganization.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/GcpOrganizationalDataOrganization.TypeConverter.cs new file mode 100644 index 000000000000..332079b79fbe --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GcpOrganizationalDataOrganization.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class GcpOrganizationalDataOrganizationTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalDataOrganization ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalDataOrganization).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return GcpOrganizationalDataOrganization.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return GcpOrganizationalDataOrganization.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return GcpOrganizationalDataOrganization.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GcpOrganizationalDataOrganization.cs b/src/Security/Security.Autorest/generated/api/Models/GcpOrganizationalDataOrganization.cs new file mode 100644 index 000000000000..1ca2b801fc73 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GcpOrganizationalDataOrganization.cs @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The gcpOrganization data for the parent account + public partial class GcpOrganizationalDataOrganization : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalDataOrganization, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalDataOrganizationInternal, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalData __gcpOrganizationalData = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GcpOrganizationalData(); + + /// Backing field for property. + private System.Collections.Generic.List _excludedProjectNumber; + + /// + /// If the multi cloud account is of membership type organization, list of accounts excluded from offering + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public System.Collections.Generic.List ExcludedProjectNumber { get => this._excludedProjectNumber; set => this._excludedProjectNumber = value; } + + /// Internal Acessors for OrganizationName + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalDataOrganizationInternal.OrganizationName { get => this._organizationName; set { {_organizationName = value;} } } + + /// The multi cloud account's membership type in the organization + [Microsoft.Azure.PowerShell.Cmdlets.Security.Constant] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string OrganizationMembershipType { get => "Organization"; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalDataInternal)__gcpOrganizationalData).OrganizationMembershipType = "Organization"; } + + /// Backing field for property. + private string _organizationName; + + /// GCP organization name + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string OrganizationName { get => this._organizationName; } + + /// Backing field for property. + private string _serviceAccountEmailAddress; + + /// + /// The service account email address which represents the organization level permissions container. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string ServiceAccountEmailAddress { get => this._serviceAccountEmailAddress; set => this._serviceAccountEmailAddress = value; } + + /// Backing field for property. + private string _workloadIdentityProviderId; + + /// + /// The GCP workload identity provider id which represents the permissions required to auto provision security connectors + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string WorkloadIdentityProviderId { get => this._workloadIdentityProviderId; set => this._workloadIdentityProviderId = value; } + + /// Creates an new instance. + public GcpOrganizationalDataOrganization() + { + this.__gcpOrganizationalData.OrganizationMembershipType = "Organization"; + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__gcpOrganizationalData), __gcpOrganizationalData); + await eventListener.AssertObjectIsValid(nameof(__gcpOrganizationalData), __gcpOrganizationalData); + } + } + /// The gcpOrganization data for the parent account + public partial interface IGcpOrganizationalDataOrganization : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalData + { + /// + /// If the multi cloud account is of membership type organization, list of accounts excluded from offering + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"If the multi cloud account is of membership type organization, list of accounts excluded from offering", + SerializedName = @"excludedProjectNumbers", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List ExcludedProjectNumber { get; set; } + /// GCP organization name + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"GCP organization name", + SerializedName = @"organizationName", + PossibleTypes = new [] { typeof(string) })] + string OrganizationName { get; } + /// + /// The service account email address which represents the organization level permissions container. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The service account email address which represents the organization level permissions container.", + SerializedName = @"serviceAccountEmailAddress", + PossibleTypes = new [] { typeof(string) })] + string ServiceAccountEmailAddress { get; set; } + /// + /// The GCP workload identity provider id which represents the permissions required to auto provision security connectors + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The GCP workload identity provider id which represents the permissions required to auto provision security connectors", + SerializedName = @"workloadIdentityProviderId", + PossibleTypes = new [] { typeof(string) })] + string WorkloadIdentityProviderId { get; set; } + + } + /// The gcpOrganization data for the parent account + internal partial interface IGcpOrganizationalDataOrganizationInternal : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalDataInternal + { + /// + /// If the multi cloud account is of membership type organization, list of accounts excluded from offering + /// + System.Collections.Generic.List ExcludedProjectNumber { get; set; } + /// GCP organization name + string OrganizationName { get; set; } + /// + /// The service account email address which represents the organization level permissions container. + /// + string ServiceAccountEmailAddress { get; set; } + /// + /// The GCP workload identity provider id which represents the permissions required to auto provision security connectors + /// + string WorkloadIdentityProviderId { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GcpOrganizationalDataOrganization.json.cs b/src/Security/Security.Autorest/generated/api/Models/GcpOrganizationalDataOrganization.json.cs new file mode 100644 index 000000000000..eb45812dd226 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GcpOrganizationalDataOrganization.json.cs @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The gcpOrganization data for the parent account + public partial class GcpOrganizationalDataOrganization + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalDataOrganization. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalDataOrganization. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalDataOrganization FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new GcpOrganizationalDataOrganization(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal GcpOrganizationalDataOrganization(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __gcpOrganizationalData = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GcpOrganizationalData(json); + {_excludedProjectNumber = If( json?.PropertyT("excludedProjectNumbers"), out var __jsonExcludedProjectNumbers) ? If( __jsonExcludedProjectNumbers as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : _excludedProjectNumber;} + {_serviceAccountEmailAddress = If( json?.PropertyT("serviceAccountEmailAddress"), out var __jsonServiceAccountEmailAddress) ? (string)__jsonServiceAccountEmailAddress : (string)_serviceAccountEmailAddress;} + {_workloadIdentityProviderId = If( json?.PropertyT("workloadIdentityProviderId"), out var __jsonWorkloadIdentityProviderId) ? (string)__jsonWorkloadIdentityProviderId : (string)_workloadIdentityProviderId;} + {_organizationName = If( json?.PropertyT("organizationName"), out var __jsonOrganizationName) ? (string)__jsonOrganizationName : (string)_organizationName;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __gcpOrganizationalData?.ToJson(container, serializationMode); + if (null != this._excludedProjectNumber) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.XNodeArray(); + foreach( var __x in this._excludedProjectNumber ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("excludedProjectNumbers",__w); + } + AddIf( null != (((object)this._serviceAccountEmailAddress)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._serviceAccountEmailAddress.ToString()) : null, "serviceAccountEmailAddress" ,container.Add ); + AddIf( null != (((object)this._workloadIdentityProviderId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._workloadIdentityProviderId.ToString()) : null, "workloadIdentityProviderId" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._organizationName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._organizationName.ToString()) : null, "organizationName" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GcpProjectDetails.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/GcpProjectDetails.PowerShell.cs new file mode 100644 index 000000000000..febdc1cf9c24 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GcpProjectDetails.PowerShell.cs @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The details about the project represented by the security connector + [System.ComponentModel.TypeConverter(typeof(GcpProjectDetailsTypeConverter))] + public partial class GcpProjectDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new GcpProjectDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new GcpProjectDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal GcpProjectDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProjectNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectDetailsInternal)this).ProjectNumber = (string) content.GetValueForProperty("ProjectNumber",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectDetailsInternal)this).ProjectNumber, global::System.Convert.ToString); + } + if (content.Contains("ProjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectDetailsInternal)this).ProjectId = (string) content.GetValueForProperty("ProjectId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectDetailsInternal)this).ProjectId, global::System.Convert.ToString); + } + if (content.Contains("WorkloadIdentityPoolId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectDetailsInternal)this).WorkloadIdentityPoolId = (string) content.GetValueForProperty("WorkloadIdentityPoolId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectDetailsInternal)this).WorkloadIdentityPoolId, global::System.Convert.ToString); + } + if (content.Contains("ProjectName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectDetailsInternal)this).ProjectName = (string) content.GetValueForProperty("ProjectName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectDetailsInternal)this).ProjectName, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal GcpProjectDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProjectNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectDetailsInternal)this).ProjectNumber = (string) content.GetValueForProperty("ProjectNumber",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectDetailsInternal)this).ProjectNumber, global::System.Convert.ToString); + } + if (content.Contains("ProjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectDetailsInternal)this).ProjectId = (string) content.GetValueForProperty("ProjectId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectDetailsInternal)this).ProjectId, global::System.Convert.ToString); + } + if (content.Contains("WorkloadIdentityPoolId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectDetailsInternal)this).WorkloadIdentityPoolId = (string) content.GetValueForProperty("WorkloadIdentityPoolId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectDetailsInternal)this).WorkloadIdentityPoolId, global::System.Convert.ToString); + } + if (content.Contains("ProjectName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectDetailsInternal)this).ProjectName = (string) content.GetValueForProperty("ProjectName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectDetailsInternal)this).ProjectName, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The details about the project represented by the security connector + [System.ComponentModel.TypeConverter(typeof(GcpProjectDetailsTypeConverter))] + public partial interface IGcpProjectDetails + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GcpProjectDetails.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/GcpProjectDetails.TypeConverter.cs new file mode 100644 index 000000000000..d38f780f183a --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GcpProjectDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class GcpProjectDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return GcpProjectDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return GcpProjectDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return GcpProjectDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GcpProjectDetails.cs b/src/Security/Security.Autorest/generated/api/Models/GcpProjectDetails.cs new file mode 100644 index 000000000000..129df37b18a5 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GcpProjectDetails.cs @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The details about the project represented by the security connector + public partial class GcpProjectDetails : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectDetails, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectDetailsInternal + { + + /// Internal Acessors for ProjectName + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectDetailsInternal.ProjectName { get => this._projectName; set { {_projectName = value;} } } + + /// Internal Acessors for WorkloadIdentityPoolId + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectDetailsInternal.WorkloadIdentityPoolId { get => this._workloadIdentityPoolId; set { {_workloadIdentityPoolId = value;} } } + + /// Backing field for property. + private string _projectId; + + /// The GCP Project id + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string ProjectId { get => this._projectId; set => this._projectId = value; } + + /// Backing field for property. + private string _projectName; + + /// GCP project name + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string ProjectName { get => this._projectName; } + + /// Backing field for property. + private string _projectNumber; + + /// The unique GCP Project number + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string ProjectNumber { get => this._projectNumber; set => this._projectNumber = value; } + + /// Backing field for property. + private string _workloadIdentityPoolId; + + /// The GCP workload identity federation pool id + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string WorkloadIdentityPoolId { get => this._workloadIdentityPoolId; } + + /// Creates an new instance. + public GcpProjectDetails() + { + + } + } + /// The details about the project represented by the security connector + public partial interface IGcpProjectDetails : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// The GCP Project id + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The GCP Project id", + SerializedName = @"projectId", + PossibleTypes = new [] { typeof(string) })] + string ProjectId { get; set; } + /// GCP project name + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"GCP project name", + SerializedName = @"projectName", + PossibleTypes = new [] { typeof(string) })] + string ProjectName { get; } + /// The unique GCP Project number + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The unique GCP Project number", + SerializedName = @"projectNumber", + PossibleTypes = new [] { typeof(string) })] + string ProjectNumber { get; set; } + /// The GCP workload identity federation pool id + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The GCP workload identity federation pool id", + SerializedName = @"workloadIdentityPoolId", + PossibleTypes = new [] { typeof(string) })] + string WorkloadIdentityPoolId { get; } + + } + /// The details about the project represented by the security connector + internal partial interface IGcpProjectDetailsInternal + + { + /// The GCP Project id + string ProjectId { get; set; } + /// GCP project name + string ProjectName { get; set; } + /// The unique GCP Project number + string ProjectNumber { get; set; } + /// The GCP workload identity federation pool id + string WorkloadIdentityPoolId { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GcpProjectDetails.json.cs b/src/Security/Security.Autorest/generated/api/Models/GcpProjectDetails.json.cs new file mode 100644 index 000000000000..20c49aa859be --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GcpProjectDetails.json.cs @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The details about the project represented by the security connector + public partial class GcpProjectDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new GcpProjectDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal GcpProjectDetails(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_projectNumber = If( json?.PropertyT("projectNumber"), out var __jsonProjectNumber) ? (string)__jsonProjectNumber : (string)_projectNumber;} + {_projectId = If( json?.PropertyT("projectId"), out var __jsonProjectId) ? (string)__jsonProjectId : (string)_projectId;} + {_workloadIdentityPoolId = If( json?.PropertyT("workloadIdentityPoolId"), out var __jsonWorkloadIdentityPoolId) ? (string)__jsonWorkloadIdentityPoolId : (string)_workloadIdentityPoolId;} + {_projectName = If( json?.PropertyT("projectName"), out var __jsonProjectName) ? (string)__jsonProjectName : (string)_projectName;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._projectNumber)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._projectNumber.ToString()) : null, "projectNumber" ,container.Add ); + AddIf( null != (((object)this._projectId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._projectId.ToString()) : null, "projectId" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._workloadIdentityPoolId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._workloadIdentityPoolId.ToString()) : null, "workloadIdentityPoolId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._projectName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._projectName.ToString()) : null, "projectName" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GcpProjectEnvironment.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/GcpProjectEnvironment.PowerShell.cs new file mode 100644 index 000000000000..1e888017528a --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GcpProjectEnvironment.PowerShell.cs @@ -0,0 +1,220 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The GCP project connector environment data + [System.ComponentModel.TypeConverter(typeof(GcpProjectEnvironmentTypeConverter))] + public partial class GcpProjectEnvironment + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectEnvironment DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new GcpProjectEnvironment(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectEnvironment DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new GcpProjectEnvironment(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectEnvironment FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal GcpProjectEnvironment(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProjectDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectEnvironmentInternal)this).ProjectDetail = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectDetails) content.GetValueForProperty("ProjectDetail",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectEnvironmentInternal)this).ProjectDetail, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GcpProjectDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("OrganizationalData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectEnvironmentInternal)this).OrganizationalData = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalData) content.GetValueForProperty("OrganizationalData",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectEnvironmentInternal)this).OrganizationalData, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GcpOrganizationalDataTypeConverter.ConvertFrom); + } + if (content.Contains("ScanInterval")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectEnvironmentInternal)this).ScanInterval = (long?) content.GetValueForProperty("ScanInterval",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectEnvironmentInternal)this).ScanInterval, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("EnvironmentType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironmentInternal)this).EnvironmentType = (string) content.GetValueForProperty("EnvironmentType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironmentInternal)this).EnvironmentType, global::System.Convert.ToString); + } + if (content.Contains("ProjectDetailProjectNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectEnvironmentInternal)this).ProjectDetailProjectNumber = (string) content.GetValueForProperty("ProjectDetailProjectNumber",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectEnvironmentInternal)this).ProjectDetailProjectNumber, global::System.Convert.ToString); + } + if (content.Contains("ProjectDetailProjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectEnvironmentInternal)this).ProjectDetailProjectId = (string) content.GetValueForProperty("ProjectDetailProjectId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectEnvironmentInternal)this).ProjectDetailProjectId, global::System.Convert.ToString); + } + if (content.Contains("ProjectDetailWorkloadIdentityPoolId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectEnvironmentInternal)this).ProjectDetailWorkloadIdentityPoolId = (string) content.GetValueForProperty("ProjectDetailWorkloadIdentityPoolId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectEnvironmentInternal)this).ProjectDetailWorkloadIdentityPoolId, global::System.Convert.ToString); + } + if (content.Contains("ProjectDetailProjectName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectEnvironmentInternal)this).ProjectDetailProjectName = (string) content.GetValueForProperty("ProjectDetailProjectName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectEnvironmentInternal)this).ProjectDetailProjectName, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal GcpProjectEnvironment(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProjectDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectEnvironmentInternal)this).ProjectDetail = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectDetails) content.GetValueForProperty("ProjectDetail",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectEnvironmentInternal)this).ProjectDetail, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GcpProjectDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("OrganizationalData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectEnvironmentInternal)this).OrganizationalData = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalData) content.GetValueForProperty("OrganizationalData",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectEnvironmentInternal)this).OrganizationalData, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GcpOrganizationalDataTypeConverter.ConvertFrom); + } + if (content.Contains("ScanInterval")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectEnvironmentInternal)this).ScanInterval = (long?) content.GetValueForProperty("ScanInterval",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectEnvironmentInternal)this).ScanInterval, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("EnvironmentType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironmentInternal)this).EnvironmentType = (string) content.GetValueForProperty("EnvironmentType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironmentInternal)this).EnvironmentType, global::System.Convert.ToString); + } + if (content.Contains("ProjectDetailProjectNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectEnvironmentInternal)this).ProjectDetailProjectNumber = (string) content.GetValueForProperty("ProjectDetailProjectNumber",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectEnvironmentInternal)this).ProjectDetailProjectNumber, global::System.Convert.ToString); + } + if (content.Contains("ProjectDetailProjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectEnvironmentInternal)this).ProjectDetailProjectId = (string) content.GetValueForProperty("ProjectDetailProjectId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectEnvironmentInternal)this).ProjectDetailProjectId, global::System.Convert.ToString); + } + if (content.Contains("ProjectDetailWorkloadIdentityPoolId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectEnvironmentInternal)this).ProjectDetailWorkloadIdentityPoolId = (string) content.GetValueForProperty("ProjectDetailWorkloadIdentityPoolId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectEnvironmentInternal)this).ProjectDetailWorkloadIdentityPoolId, global::System.Convert.ToString); + } + if (content.Contains("ProjectDetailProjectName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectEnvironmentInternal)this).ProjectDetailProjectName = (string) content.GetValueForProperty("ProjectDetailProjectName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectEnvironmentInternal)this).ProjectDetailProjectName, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The GCP project connector environment data + [System.ComponentModel.TypeConverter(typeof(GcpProjectEnvironmentTypeConverter))] + public partial interface IGcpProjectEnvironment + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GcpProjectEnvironment.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/GcpProjectEnvironment.TypeConverter.cs new file mode 100644 index 000000000000..79a9ad4960fd --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GcpProjectEnvironment.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class GcpProjectEnvironmentTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectEnvironment ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectEnvironment).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return GcpProjectEnvironment.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return GcpProjectEnvironment.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return GcpProjectEnvironment.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GcpProjectEnvironment.cs b/src/Security/Security.Autorest/generated/api/Models/GcpProjectEnvironment.cs new file mode 100644 index 000000000000..a9e1b44d9ca2 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GcpProjectEnvironment.cs @@ -0,0 +1,184 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The GCP project connector environment data + public partial class GcpProjectEnvironment : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectEnvironment, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectEnvironmentInternal, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironment __securityConnectorEnvironment = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SecurityConnectorEnvironment(); + + /// The type of the environment data. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Constant] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string EnvironmentType { get => "GcpProject"; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironmentInternal)__securityConnectorEnvironment).EnvironmentType = "GcpProject"; } + + /// Internal Acessors for ProjectDetail + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectDetails Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectEnvironmentInternal.ProjectDetail { get => (this._projectDetail = this._projectDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GcpProjectDetails()); set { {_projectDetail = value;} } } + + /// Internal Acessors for ProjectDetailProjectName + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectEnvironmentInternal.ProjectDetailProjectName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectDetailsInternal)ProjectDetail).ProjectName; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectDetailsInternal)ProjectDetail).ProjectName = value; } + + /// Internal Acessors for ProjectDetailWorkloadIdentityPoolId + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectEnvironmentInternal.ProjectDetailWorkloadIdentityPoolId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectDetailsInternal)ProjectDetail).WorkloadIdentityPoolId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectDetailsInternal)ProjectDetail).WorkloadIdentityPoolId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalData _organizationalData; + + /// The Gcp project's organizational data + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalData OrganizationalData { get => (this._organizationalData = this._organizationalData ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GcpOrganizationalData()); set => this._organizationalData = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectDetails _projectDetail; + + /// The Gcp project's details + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectDetails ProjectDetail { get => (this._projectDetail = this._projectDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GcpProjectDetails()); set => this._projectDetail = value; } + + /// The GCP Project id + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string ProjectDetailProjectId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectDetailsInternal)ProjectDetail).ProjectId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectDetailsInternal)ProjectDetail).ProjectId = value ?? null; } + + /// GCP project name + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string ProjectDetailProjectName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectDetailsInternal)ProjectDetail).ProjectName; } + + /// The unique GCP Project number + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string ProjectDetailProjectNumber { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectDetailsInternal)ProjectDetail).ProjectNumber; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectDetailsInternal)ProjectDetail).ProjectNumber = value ?? null; } + + /// The GCP workload identity federation pool id + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string ProjectDetailWorkloadIdentityPoolId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectDetailsInternal)ProjectDetail).WorkloadIdentityPoolId; } + + /// Backing field for property. + private long? _scanInterval; + + /// Scan interval in hours (value should be between 1-hour to 24-hours) + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public long? ScanInterval { get => this._scanInterval; set => this._scanInterval = value; } + + /// Creates an new instance. + public GcpProjectEnvironment() + { + this.__securityConnectorEnvironment.EnvironmentType = "GcpProject"; + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__securityConnectorEnvironment), __securityConnectorEnvironment); + await eventListener.AssertObjectIsValid(nameof(__securityConnectorEnvironment), __securityConnectorEnvironment); + } + } + /// The GCP project connector environment data + public partial interface IGcpProjectEnvironment : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironment + { + /// The Gcp project's organizational data + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The Gcp project's organizational data", + SerializedName = @"organizationalData", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalData),typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalDataOrganization),typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalDataMember) })] + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalData OrganizationalData { get; set; } + /// The GCP Project id + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The GCP Project id", + SerializedName = @"projectId", + PossibleTypes = new [] { typeof(string) })] + string ProjectDetailProjectId { get; set; } + /// GCP project name + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"GCP project name", + SerializedName = @"projectName", + PossibleTypes = new [] { typeof(string) })] + string ProjectDetailProjectName { get; } + /// The unique GCP Project number + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The unique GCP Project number", + SerializedName = @"projectNumber", + PossibleTypes = new [] { typeof(string) })] + string ProjectDetailProjectNumber { get; set; } + /// The GCP workload identity federation pool id + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The GCP workload identity federation pool id", + SerializedName = @"workloadIdentityPoolId", + PossibleTypes = new [] { typeof(string) })] + string ProjectDetailWorkloadIdentityPoolId { get; } + /// Scan interval in hours (value should be between 1-hour to 24-hours) + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Scan interval in hours (value should be between 1-hour to 24-hours)", + SerializedName = @"scanInterval", + PossibleTypes = new [] { typeof(long) })] + long? ScanInterval { get; set; } + + } + /// The GCP project connector environment data + internal partial interface IGcpProjectEnvironmentInternal : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironmentInternal + { + /// The Gcp project's organizational data + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalData OrganizationalData { get; set; } + /// The Gcp project's details + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectDetails ProjectDetail { get; set; } + /// The GCP Project id + string ProjectDetailProjectId { get; set; } + /// GCP project name + string ProjectDetailProjectName { get; set; } + /// The unique GCP Project number + string ProjectDetailProjectNumber { get; set; } + /// The GCP workload identity federation pool id + string ProjectDetailWorkloadIdentityPoolId { get; set; } + /// Scan interval in hours (value should be between 1-hour to 24-hours) + long? ScanInterval { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GcpProjectEnvironment.json.cs b/src/Security/Security.Autorest/generated/api/Models/GcpProjectEnvironment.json.cs new file mode 100644 index 000000000000..213277f63952 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GcpProjectEnvironment.json.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The GCP project connector environment data + public partial class GcpProjectEnvironment + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectEnvironment. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectEnvironment. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpProjectEnvironment FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new GcpProjectEnvironment(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal GcpProjectEnvironment(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __securityConnectorEnvironment = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SecurityConnectorEnvironment(json); + {_projectDetail = If( json?.PropertyT("projectDetails"), out var __jsonProjectDetails) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GcpProjectDetails.FromJson(__jsonProjectDetails) : _projectDetail;} + {_organizationalData = If( json?.PropertyT("organizationalData"), out var __jsonOrganizationalData) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GcpOrganizationalData.FromJson(__jsonOrganizationalData) : _organizationalData;} + {_scanInterval = If( json?.PropertyT("scanInterval"), out var __jsonScanInterval) ? (long?)__jsonScanInterval : _scanInterval;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __securityConnectorEnvironment?.ToJson(container, serializationMode); + AddIf( null != this._projectDetail ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._projectDetail.ToJson(null,serializationMode) : null, "projectDetails" ,container.Add ); + AddIf( null != this._organizationalData ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._organizationalData.ToJson(null,serializationMode) : null, "organizationalData" ,container.Add ); + AddIf( null != this._scanInterval ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNumber((long)this._scanInterval) : null, "scanInterval" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitHubOwner.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/GitHubOwner.PowerShell.cs new file mode 100644 index 000000000000..7dbd5baa7c7a --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitHubOwner.PowerShell.cs @@ -0,0 +1,292 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// GitHub Owner resource. + [System.ComponentModel.TypeConverter(typeof(GitHubOwnerTypeConverter))] + public partial class GitHubOwner + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwner DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new GitHubOwner(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwner DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new GitHubOwner(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwner FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal GitHubOwner(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitHubOwnerPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("OnboardingState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerInternal)this).OnboardingState = (string) content.GetValueForProperty("OnboardingState",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerInternal)this).OnboardingState, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ProvisioningStatusMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerInternal)this).ProvisioningStatusMessage = (string) content.GetValueForProperty("ProvisioningStatusMessage",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerInternal)this).ProvisioningStatusMessage, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningStatusUpdateTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerInternal)this).ProvisioningStatusUpdateTimeUtc = (global::System.DateTime?) content.GetValueForProperty("ProvisioningStatusUpdateTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerInternal)this).ProvisioningStatusUpdateTimeUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerInternal)this).ProvisioningState, global::System.Convert.ToString); + } + if (content.Contains("OwnerUrl")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerInternal)this).OwnerUrl = (string) content.GetValueForProperty("OwnerUrl",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerInternal)this).OwnerUrl, global::System.Convert.ToString); + } + if (content.Contains("GitHubInternalId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerInternal)this).GitHubInternalId = (string) content.GetValueForProperty("GitHubInternalId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerInternal)this).GitHubInternalId, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal GitHubOwner(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitHubOwnerPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("OnboardingState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerInternal)this).OnboardingState = (string) content.GetValueForProperty("OnboardingState",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerInternal)this).OnboardingState, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ProvisioningStatusMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerInternal)this).ProvisioningStatusMessage = (string) content.GetValueForProperty("ProvisioningStatusMessage",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerInternal)this).ProvisioningStatusMessage, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningStatusUpdateTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerInternal)this).ProvisioningStatusUpdateTimeUtc = (global::System.DateTime?) content.GetValueForProperty("ProvisioningStatusUpdateTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerInternal)this).ProvisioningStatusUpdateTimeUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerInternal)this).ProvisioningState, global::System.Convert.ToString); + } + if (content.Contains("OwnerUrl")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerInternal)this).OwnerUrl = (string) content.GetValueForProperty("OwnerUrl",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerInternal)this).OwnerUrl, global::System.Convert.ToString); + } + if (content.Contains("GitHubInternalId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerInternal)this).GitHubInternalId = (string) content.GetValueForProperty("GitHubInternalId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerInternal)this).GitHubInternalId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// GitHub Owner resource. + [System.ComponentModel.TypeConverter(typeof(GitHubOwnerTypeConverter))] + public partial interface IGitHubOwner + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitHubOwner.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/GitHubOwner.TypeConverter.cs new file mode 100644 index 000000000000..359be17382d5 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitHubOwner.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class GitHubOwnerTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwner ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwner).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return GitHubOwner.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return GitHubOwner.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return GitHubOwner.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitHubOwner.cs b/src/Security/Security.Autorest/generated/api/Models/GitHubOwner.cs new file mode 100644 index 000000000000..8c435916e432 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitHubOwner.cs @@ -0,0 +1,396 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// GitHub Owner resource. + public partial class GitHubOwner : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwner, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerInternal, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IProxyResource __proxyResource = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ProxyResource(); + + /// Gets or sets internal GitHub id. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string GitHubInternalId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerPropertiesInternal)Property).GitHubInternalId; } + + /// + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Id; } + + /// Internal Acessors for GitHubInternalId + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerInternal.GitHubInternalId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerPropertiesInternal)Property).GitHubInternalId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerPropertiesInternal)Property).GitHubInternalId = value; } + + /// Internal Acessors for OwnerUrl + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerInternal.OwnerUrl { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerPropertiesInternal)Property).OwnerUrl; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerPropertiesInternal)Property).OwnerUrl = value; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerProperties Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitHubOwnerProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProvisioningStatusMessage + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerInternal.ProvisioningStatusMessage { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerPropertiesInternal)Property).ProvisioningStatusMessage; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerPropertiesInternal)Property).ProvisioningStatusMessage = value; } + + /// Internal Acessors for ProvisioningStatusUpdateTimeUtc + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerInternal.ProvisioningStatusUpdateTimeUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerPropertiesInternal)Property).ProvisioningStatusUpdateTimeUtc; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerPropertiesInternal)Property).ProvisioningStatusUpdateTimeUtc = value; } + + /// Internal Acessors for SystemData + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemData Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerInternal.SystemData { get => (this._systemData = this._systemData ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SystemData()); set { {_systemData = value;} } } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Name = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Type = value; } + + /// The name of the resource + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Name; } + + /// + /// Details about resource onboarding status across all connectors. + /// + /// OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to + /// top-level resources. + /// Onboarded - this resource has already been onboarded by the specified connector. + /// NotOnboarded - this resource has not been onboarded to any connector. + /// NotApplicable - the onboarding state is not applicable to the current endpoint. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string OnboardingState { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerPropertiesInternal)Property).OnboardingState; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerPropertiesInternal)Property).OnboardingState = value ?? null; } + + /// Gets or sets GitHub Owner url. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string OwnerUrl { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerPropertiesInternal)Property).OwnerUrl; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerProperties _property; + + /// GitHub Owner properties. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitHubOwnerProperties()); set => this._property = value; } + + /// + /// The provisioning state of the resource. + /// + /// Pending - Provisioning pending. + /// Failed - Provisioning failed. + /// Succeeded - Successful provisioning. + /// Canceled - Provisioning canceled. + /// PendingDeletion - Deletion pending. + /// DeletionSuccess - Deletion successful. + /// DeletionFailure - Deletion failure. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerPropertiesInternal)Property).ProvisioningState; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerPropertiesInternal)Property).ProvisioningState = value ?? null; } + + /// Gets or sets resource status message. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string ProvisioningStatusMessage { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerPropertiesInternal)Property).ProvisioningStatusMessage; } + + /// Gets or sets time when resource was last checked. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public global::System.DateTime? ProvisioningStatusUpdateTimeUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerPropertiesInternal)Property).ProvisioningStatusUpdateTimeUtc; } + + /// Gets the resource group name + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string ResourceGroupName { get => (new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Success ? new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Groups["resourceGroupName"].Value : null); } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemData _systemData; + + /// Metadata pertaining to creation and last modification of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemData SystemData { get => (this._systemData = this._systemData ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SystemData()); } + + /// The timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).CreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).CreatedAt = value ?? default(global::System.DateTime); } + + /// The identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).CreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).CreatedBy = value ?? null; } + + /// The type of identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).CreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).CreatedByType = value ?? null; } + + /// The timestamp of resource last modification (UTC) + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).LastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).LastModifiedAt = value ?? default(global::System.DateTime); } + + /// The identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).LastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).LastModifiedBy = value ?? null; } + + /// The type of identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).LastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).LastModifiedByType = value ?? null; } + + /// + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Type; } + + /// Creates an new instance. + public GitHubOwner() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__proxyResource), __proxyResource); + await eventListener.AssertObjectIsValid(nameof(__proxyResource), __proxyResource); + } + } + /// GitHub Owner resource. + public partial interface IGitHubOwner : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IProxyResource + { + /// Gets or sets internal GitHub id. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets internal GitHub id.", + SerializedName = @"gitHubInternalId", + PossibleTypes = new [] { typeof(string) })] + string GitHubInternalId { get; } + /// + /// Details about resource onboarding status across all connectors. + /// + /// OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to + /// top-level resources. + /// Onboarded - this resource has already been onboarded by the specified connector. + /// NotOnboarded - this resource has not been onboarded to any connector. + /// NotApplicable - the onboarding state is not applicable to the current endpoint. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Details about resource onboarding status across all connectors. + + OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to top-level resources. + Onboarded - this resource has already been onboarded by the specified connector. + NotOnboarded - this resource has not been onboarded to any connector. + NotApplicable - the onboarding state is not applicable to the current endpoint.", + SerializedName = @"onboardingState", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("NotApplicable", "OnboardedByOtherConnector", "Onboarded", "NotOnboarded")] + string OnboardingState { get; set; } + /// Gets or sets GitHub Owner url. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets GitHub Owner url.", + SerializedName = @"ownerUrl", + PossibleTypes = new [] { typeof(string) })] + string OwnerUrl { get; } + /// + /// The provisioning state of the resource. + /// + /// Pending - Provisioning pending. + /// Failed - Provisioning failed. + /// Succeeded - Successful provisioning. + /// Canceled - Provisioning canceled. + /// PendingDeletion - Deletion pending. + /// DeletionSuccess - Deletion successful. + /// DeletionFailure - Deletion failure. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The provisioning state of the resource. + + Pending - Provisioning pending. + Failed - Provisioning failed. + Succeeded - Successful provisioning. + Canceled - Provisioning canceled. + PendingDeletion - Deletion pending. + DeletionSuccess - Deletion successful. + DeletionFailure - Deletion failure.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Succeeded", "Failed", "Canceled", "Pending", "PendingDeletion", "DeletionSuccess", "DeletionFailure")] + string ProvisioningState { get; set; } + /// Gets or sets resource status message. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets resource status message.", + SerializedName = @"provisioningStatusMessage", + PossibleTypes = new [] { typeof(string) })] + string ProvisioningStatusMessage { get; } + /// Gets or sets time when resource was last checked. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets time when resource was last checked.", + SerializedName = @"provisioningStatusUpdateTimeUtc", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? ProvisioningStatusUpdateTimeUtc { get; } + /// The timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The timestamp of resource creation (UTC).", + SerializedName = @"createdAt", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? SystemDataCreatedAt { get; } + /// The identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The identity that created the resource.", + SerializedName = @"createdBy", + PossibleTypes = new [] { typeof(string) })] + string SystemDataCreatedBy { get; } + /// The type of identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The type of identity that created the resource.", + SerializedName = @"createdByType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string SystemDataCreatedByType { get; } + /// The timestamp of resource last modification (UTC) + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The timestamp of resource last modification (UTC)", + SerializedName = @"lastModifiedAt", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? SystemDataLastModifiedAt { get; } + /// The identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The identity that last modified the resource.", + SerializedName = @"lastModifiedBy", + PossibleTypes = new [] { typeof(string) })] + string SystemDataLastModifiedBy { get; } + /// The type of identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The type of identity that last modified the resource.", + SerializedName = @"lastModifiedByType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string SystemDataLastModifiedByType { get; } + + } + /// GitHub Owner resource. + internal partial interface IGitHubOwnerInternal : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IProxyResourceInternal + { + /// Gets or sets internal GitHub id. + string GitHubInternalId { get; set; } + /// + /// Details about resource onboarding status across all connectors. + /// + /// OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to + /// top-level resources. + /// Onboarded - this resource has already been onboarded by the specified connector. + /// NotOnboarded - this resource has not been onboarded to any connector. + /// NotApplicable - the onboarding state is not applicable to the current endpoint. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("NotApplicable", "OnboardedByOtherConnector", "Onboarded", "NotOnboarded")] + string OnboardingState { get; set; } + /// Gets or sets GitHub Owner url. + string OwnerUrl { get; set; } + /// GitHub Owner properties. + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerProperties Property { get; set; } + /// + /// The provisioning state of the resource. + /// + /// Pending - Provisioning pending. + /// Failed - Provisioning failed. + /// Succeeded - Successful provisioning. + /// Canceled - Provisioning canceled. + /// PendingDeletion - Deletion pending. + /// DeletionSuccess - Deletion successful. + /// DeletionFailure - Deletion failure. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Succeeded", "Failed", "Canceled", "Pending", "PendingDeletion", "DeletionSuccess", "DeletionFailure")] + string ProvisioningState { get; set; } + /// Gets or sets resource status message. + string ProvisioningStatusMessage { get; set; } + /// Gets or sets time when resource was last checked. + global::System.DateTime? ProvisioningStatusUpdateTimeUtc { get; set; } + /// Metadata pertaining to creation and last modification of the resource. + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemData SystemData { get; set; } + /// The timestamp of resource creation (UTC). + global::System.DateTime? SystemDataCreatedAt { get; set; } + /// The identity that created the resource. + string SystemDataCreatedBy { get; set; } + /// The type of identity that created the resource. + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string SystemDataCreatedByType { get; set; } + /// The timestamp of resource last modification (UTC) + global::System.DateTime? SystemDataLastModifiedAt { get; set; } + /// The identity that last modified the resource. + string SystemDataLastModifiedBy { get; set; } + /// The type of identity that last modified the resource. + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string SystemDataLastModifiedByType { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitHubOwner.json.cs b/src/Security/Security.Autorest/generated/api/Models/GitHubOwner.json.cs new file mode 100644 index 000000000000..c475504e0493 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitHubOwner.json.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// GitHub Owner resource. + public partial class GitHubOwner + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwner. + /// + /// a to deserialize from. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwner. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwner FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new GitHubOwner(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal GitHubOwner(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __proxyResource = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ProxyResource(json); + {_systemData = If( json?.PropertyT("systemData"), out var __jsonSystemData) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SystemData.FromJson(__jsonSystemData) : _systemData;} + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitHubOwnerProperties.FromJson(__jsonProperties) : _property;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __proxyResource?.ToJson(container, serializationMode); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._systemData ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._systemData.ToJson(null,serializationMode) : null, "systemData" ,container.Add ); + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitHubOwnerConfiguration.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/GitHubOwnerConfiguration.PowerShell.cs new file mode 100644 index 000000000000..82a387f0e992 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitHubOwnerConfiguration.PowerShell.cs @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// GitHub Owner Inventory Configuration. + [System.ComponentModel.TypeConverter(typeof(GitHubOwnerConfigurationTypeConverter))] + public partial class GitHubOwnerConfiguration + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerConfiguration DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new GitHubOwnerConfiguration(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerConfiguration DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new GitHubOwnerConfiguration(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerConfiguration FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal GitHubOwnerConfiguration(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AutoDiscovery")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerConfigurationInternal)this).AutoDiscovery = (string) content.GetValueForProperty("AutoDiscovery",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerConfigurationInternal)this).AutoDiscovery, global::System.Convert.ToString); + } + if (content.Contains("RepositoryConfig")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerConfigurationInternal)this).RepositoryConfig = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerConfigurationRepositoryConfigs) content.GetValueForProperty("RepositoryConfig",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerConfigurationInternal)this).RepositoryConfig, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitHubOwnerConfigurationRepositoryConfigsTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal GitHubOwnerConfiguration(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AutoDiscovery")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerConfigurationInternal)this).AutoDiscovery = (string) content.GetValueForProperty("AutoDiscovery",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerConfigurationInternal)this).AutoDiscovery, global::System.Convert.ToString); + } + if (content.Contains("RepositoryConfig")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerConfigurationInternal)this).RepositoryConfig = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerConfigurationRepositoryConfigs) content.GetValueForProperty("RepositoryConfig",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerConfigurationInternal)this).RepositoryConfig, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitHubOwnerConfigurationRepositoryConfigsTypeConverter.ConvertFrom); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// GitHub Owner Inventory Configuration. + [System.ComponentModel.TypeConverter(typeof(GitHubOwnerConfigurationTypeConverter))] + public partial interface IGitHubOwnerConfiguration + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitHubOwnerConfiguration.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/GitHubOwnerConfiguration.TypeConverter.cs new file mode 100644 index 000000000000..cee56d6322ad --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitHubOwnerConfiguration.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class GitHubOwnerConfigurationTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerConfiguration ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerConfiguration).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return GitHubOwnerConfiguration.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return GitHubOwnerConfiguration.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return GitHubOwnerConfiguration.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitHubOwnerConfiguration.cs b/src/Security/Security.Autorest/generated/api/Models/GitHubOwnerConfiguration.cs new file mode 100644 index 000000000000..cc293578baa6 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitHubOwnerConfiguration.cs @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// GitHub Owner Inventory Configuration. + public partial class GitHubOwnerConfiguration : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerConfiguration, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerConfigurationInternal + { + + /// Backing field for property. + private string _autoDiscovery; + + /// AutoDiscovery states. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string AutoDiscovery { get => this._autoDiscovery; set => this._autoDiscovery = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerConfigurationRepositoryConfigs _repositoryConfig; + + /// + /// GitHub Repository Inventory Configuration. + /// Dictionary of GitHub repository name to desired repository configuration. + /// If AutoDiscovery is Enabled, this field should be null or empty. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerConfigurationRepositoryConfigs RepositoryConfig { get => (this._repositoryConfig = this._repositoryConfig ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitHubOwnerConfigurationRepositoryConfigs()); set => this._repositoryConfig = value; } + + /// Creates an new instance. + public GitHubOwnerConfiguration() + { + + } + } + /// GitHub Owner Inventory Configuration. + public partial interface IGitHubOwnerConfiguration : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// AutoDiscovery states. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"AutoDiscovery states.", + SerializedName = @"autoDiscovery", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Disabled", "Enabled", "NotApplicable")] + string AutoDiscovery { get; set; } + /// + /// GitHub Repository Inventory Configuration. + /// Dictionary of GitHub repository name to desired repository configuration. + /// If AutoDiscovery is Enabled, this field should be null or empty. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"GitHub Repository Inventory Configuration. + Dictionary of GitHub repository name to desired repository configuration. + If AutoDiscovery is Enabled, this field should be null or empty.", + SerializedName = @"repositoryConfigs", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerConfigurationRepositoryConfigs) })] + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerConfigurationRepositoryConfigs RepositoryConfig { get; set; } + + } + /// GitHub Owner Inventory Configuration. + internal partial interface IGitHubOwnerConfigurationInternal + + { + /// AutoDiscovery states. + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Disabled", "Enabled", "NotApplicable")] + string AutoDiscovery { get; set; } + /// + /// GitHub Repository Inventory Configuration. + /// Dictionary of GitHub repository name to desired repository configuration. + /// If AutoDiscovery is Enabled, this field should be null or empty. + /// + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerConfigurationRepositoryConfigs RepositoryConfig { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitHubOwnerConfiguration.json.cs b/src/Security/Security.Autorest/generated/api/Models/GitHubOwnerConfiguration.json.cs new file mode 100644 index 000000000000..2a4ebd057e68 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitHubOwnerConfiguration.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// GitHub Owner Inventory Configuration. + public partial class GitHubOwnerConfiguration + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerConfiguration. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerConfiguration. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerConfiguration FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new GitHubOwnerConfiguration(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal GitHubOwnerConfiguration(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_autoDiscovery = If( json?.PropertyT("autoDiscovery"), out var __jsonAutoDiscovery) ? (string)__jsonAutoDiscovery : (string)_autoDiscovery;} + {_repositoryConfig = If( json?.PropertyT("repositoryConfigs"), out var __jsonRepositoryConfigs) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitHubOwnerConfigurationRepositoryConfigs.FromJson(__jsonRepositoryConfigs) : _repositoryConfig;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._autoDiscovery)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._autoDiscovery.ToString()) : null, "autoDiscovery" ,container.Add ); + AddIf( null != this._repositoryConfig ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._repositoryConfig.ToJson(null,serializationMode) : null, "repositoryConfigs" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitHubOwnerConfigurationRepositoryConfigs.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/GitHubOwnerConfigurationRepositoryConfigs.PowerShell.cs new file mode 100644 index 000000000000..d6aacc2c84a7 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitHubOwnerConfigurationRepositoryConfigs.PowerShell.cs @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// GitHub Repository Inventory Configuration. + /// Dictionary of GitHub repository name to desired repository configuration. + /// If AutoDiscovery is Enabled, this field should be null or empty. + /// + [System.ComponentModel.TypeConverter(typeof(GitHubOwnerConfigurationRepositoryConfigsTypeConverter))] + public partial class GitHubOwnerConfigurationRepositoryConfigs + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerConfigurationRepositoryConfigs DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new GitHubOwnerConfigurationRepositoryConfigs(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerConfigurationRepositoryConfigs DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new GitHubOwnerConfigurationRepositoryConfigs(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerConfigurationRepositoryConfigs FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal GitHubOwnerConfigurationRepositoryConfigs(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal GitHubOwnerConfigurationRepositoryConfigs(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// GitHub Repository Inventory Configuration. + /// Dictionary of GitHub repository name to desired repository configuration. + /// If AutoDiscovery is Enabled, this field should be null or empty. + [System.ComponentModel.TypeConverter(typeof(GitHubOwnerConfigurationRepositoryConfigsTypeConverter))] + public partial interface IGitHubOwnerConfigurationRepositoryConfigs + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitHubOwnerConfigurationRepositoryConfigs.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/GitHubOwnerConfigurationRepositoryConfigs.TypeConverter.cs new file mode 100644 index 000000000000..93ac7e1827cf --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitHubOwnerConfigurationRepositoryConfigs.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class GitHubOwnerConfigurationRepositoryConfigsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerConfigurationRepositoryConfigs ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerConfigurationRepositoryConfigs).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return GitHubOwnerConfigurationRepositoryConfigs.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return GitHubOwnerConfigurationRepositoryConfigs.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return GitHubOwnerConfigurationRepositoryConfigs.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitHubOwnerConfigurationRepositoryConfigs.cs b/src/Security/Security.Autorest/generated/api/Models/GitHubOwnerConfigurationRepositoryConfigs.cs new file mode 100644 index 000000000000..e58fe233ffb2 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitHubOwnerConfigurationRepositoryConfigs.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// + /// GitHub Repository Inventory Configuration. + /// Dictionary of GitHub repository name to desired repository configuration. + /// If AutoDiscovery is Enabled, this field should be null or empty. + /// + public partial class GitHubOwnerConfigurationRepositoryConfigs : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerConfigurationRepositoryConfigs, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerConfigurationRepositoryConfigsInternal + { + + /// + /// Creates an new instance. + /// + public GitHubOwnerConfigurationRepositoryConfigs() + { + + } + } + /// GitHub Repository Inventory Configuration. + /// Dictionary of GitHub repository name to desired repository configuration. + /// If AutoDiscovery is Enabled, this field should be null or empty. + public partial interface IGitHubOwnerConfigurationRepositoryConfigs : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray + { + + } + /// GitHub Repository Inventory Configuration. + /// Dictionary of GitHub repository name to desired repository configuration. + /// If AutoDiscovery is Enabled, this field should be null or empty. + internal partial interface IGitHubOwnerConfigurationRepositoryConfigsInternal + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitHubOwnerConfigurationRepositoryConfigs.dictionary.cs b/src/Security/Security.Autorest/generated/api/Models/GitHubOwnerConfigurationRepositoryConfigs.dictionary.cs new file mode 100644 index 000000000000..83cd1f37b894 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitHubOwnerConfigurationRepositoryConfigs.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + public partial class GitHubOwnerConfigurationRepositoryConfigs : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IBaseResourceConfiguration this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IBaseResourceConfiguration value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IBaseResourceConfiguration value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitHubOwnerConfigurationRepositoryConfigs source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitHubOwnerConfigurationRepositoryConfigs.json.cs b/src/Security/Security.Autorest/generated/api/Models/GitHubOwnerConfigurationRepositoryConfigs.json.cs new file mode 100644 index 000000000000..0faa5af4f9fb --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitHubOwnerConfigurationRepositoryConfigs.json.cs @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// + /// GitHub Repository Inventory Configuration. + /// Dictionary of GitHub repository name to desired repository configuration. + /// If AutoDiscovery is Enabled, this field should be null or empty. + /// + public partial class GitHubOwnerConfigurationRepositoryConfigs + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerConfigurationRepositoryConfigs. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerConfigurationRepositoryConfigs. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerConfigurationRepositoryConfigs FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new GitHubOwnerConfigurationRepositoryConfigs(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + /// + internal GitHubOwnerConfigurationRepositoryConfigs(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray)this).AdditionalProperties, (j) => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.BaseResourceConfiguration.FromJson(j) ,exclusions ); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitHubOwnerListResponse.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/GitHubOwnerListResponse.PowerShell.cs new file mode 100644 index 000000000000..aeeabd89735a --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitHubOwnerListResponse.PowerShell.cs @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// List of RP resources which supports pagination. + [System.ComponentModel.TypeConverter(typeof(GitHubOwnerListResponseTypeConverter))] + public partial class GitHubOwnerListResponse + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerListResponse DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new GitHubOwnerListResponse(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerListResponse DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new GitHubOwnerListResponse(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerListResponse FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal GitHubOwnerListResponse(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerListResponseInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerListResponseInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitHubOwnerTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerListResponseInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerListResponseInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal GitHubOwnerListResponse(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerListResponseInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerListResponseInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitHubOwnerTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerListResponseInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerListResponseInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// List of RP resources which supports pagination. + [System.ComponentModel.TypeConverter(typeof(GitHubOwnerListResponseTypeConverter))] + public partial interface IGitHubOwnerListResponse + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitHubOwnerListResponse.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/GitHubOwnerListResponse.TypeConverter.cs new file mode 100644 index 000000000000..4335c7a0eed2 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitHubOwnerListResponse.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class GitHubOwnerListResponseTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerListResponse ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerListResponse).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return GitHubOwnerListResponse.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return GitHubOwnerListResponse.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return GitHubOwnerListResponse.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitHubOwnerListResponse.cs b/src/Security/Security.Autorest/generated/api/Models/GitHubOwnerListResponse.cs new file mode 100644 index 000000000000..5b01f3d0d72b --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitHubOwnerListResponse.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// List of RP resources which supports pagination. + public partial class GitHubOwnerListResponse : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerListResponse, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerListResponseInternal + { + + /// Backing field for property. + private string _nextLink; + + /// Gets or sets next link to scroll over the results. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private System.Collections.Generic.List _value; + + /// Gets or sets list of resources. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public System.Collections.Generic.List Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public GitHubOwnerListResponse() + { + + } + } + /// List of RP resources which supports pagination. + public partial interface IGitHubOwnerListResponse : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// Gets or sets next link to scroll over the results. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Gets or sets next link to scroll over the results.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// Gets or sets list of resources. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Gets or sets list of resources.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwner) })] + System.Collections.Generic.List Value { get; set; } + + } + /// List of RP resources which supports pagination. + internal partial interface IGitHubOwnerListResponseInternal + + { + /// Gets or sets next link to scroll over the results. + string NextLink { get; set; } + /// Gets or sets list of resources. + System.Collections.Generic.List Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitHubOwnerListResponse.json.cs b/src/Security/Security.Autorest/generated/api/Models/GitHubOwnerListResponse.json.cs new file mode 100644 index 000000000000..e215a4f41b15 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitHubOwnerListResponse.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// List of RP resources which supports pagination. + public partial class GitHubOwnerListResponse + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerListResponse. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerListResponse. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerListResponse FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new GitHubOwnerListResponse(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal GitHubOwnerListResponse(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwner) (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitHubOwner.FromJson(__u) )) ))() : null : _value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)_nextLink;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitHubOwnerProperties.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/GitHubOwnerProperties.PowerShell.cs new file mode 100644 index 000000000000..35aa68e38a99 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitHubOwnerProperties.PowerShell.cs @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// GitHub Owner properties. + [System.ComponentModel.TypeConverter(typeof(GitHubOwnerPropertiesTypeConverter))] + public partial class GitHubOwnerProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new GitHubOwnerProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new GitHubOwnerProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal GitHubOwnerProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProvisioningStatusMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerPropertiesInternal)this).ProvisioningStatusMessage = (string) content.GetValueForProperty("ProvisioningStatusMessage",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerPropertiesInternal)this).ProvisioningStatusMessage, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningStatusUpdateTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerPropertiesInternal)this).ProvisioningStatusUpdateTimeUtc = (global::System.DateTime?) content.GetValueForProperty("ProvisioningStatusUpdateTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerPropertiesInternal)this).ProvisioningStatusUpdateTimeUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerPropertiesInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerPropertiesInternal)this).ProvisioningState, global::System.Convert.ToString); + } + if (content.Contains("OwnerUrl")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerPropertiesInternal)this).OwnerUrl = (string) content.GetValueForProperty("OwnerUrl",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerPropertiesInternal)this).OwnerUrl, global::System.Convert.ToString); + } + if (content.Contains("GitHubInternalId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerPropertiesInternal)this).GitHubInternalId = (string) content.GetValueForProperty("GitHubInternalId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerPropertiesInternal)this).GitHubInternalId, global::System.Convert.ToString); + } + if (content.Contains("OnboardingState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerPropertiesInternal)this).OnboardingState = (string) content.GetValueForProperty("OnboardingState",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerPropertiesInternal)this).OnboardingState, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal GitHubOwnerProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProvisioningStatusMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerPropertiesInternal)this).ProvisioningStatusMessage = (string) content.GetValueForProperty("ProvisioningStatusMessage",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerPropertiesInternal)this).ProvisioningStatusMessage, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningStatusUpdateTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerPropertiesInternal)this).ProvisioningStatusUpdateTimeUtc = (global::System.DateTime?) content.GetValueForProperty("ProvisioningStatusUpdateTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerPropertiesInternal)this).ProvisioningStatusUpdateTimeUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerPropertiesInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerPropertiesInternal)this).ProvisioningState, global::System.Convert.ToString); + } + if (content.Contains("OwnerUrl")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerPropertiesInternal)this).OwnerUrl = (string) content.GetValueForProperty("OwnerUrl",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerPropertiesInternal)this).OwnerUrl, global::System.Convert.ToString); + } + if (content.Contains("GitHubInternalId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerPropertiesInternal)this).GitHubInternalId = (string) content.GetValueForProperty("GitHubInternalId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerPropertiesInternal)this).GitHubInternalId, global::System.Convert.ToString); + } + if (content.Contains("OnboardingState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerPropertiesInternal)this).OnboardingState = (string) content.GetValueForProperty("OnboardingState",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerPropertiesInternal)this).OnboardingState, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// GitHub Owner properties. + [System.ComponentModel.TypeConverter(typeof(GitHubOwnerPropertiesTypeConverter))] + public partial interface IGitHubOwnerProperties + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitHubOwnerProperties.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/GitHubOwnerProperties.TypeConverter.cs new file mode 100644 index 000000000000..a363dc4e1c9d --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitHubOwnerProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class GitHubOwnerPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return GitHubOwnerProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return GitHubOwnerProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return GitHubOwnerProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitHubOwnerProperties.cs b/src/Security/Security.Autorest/generated/api/Models/GitHubOwnerProperties.cs new file mode 100644 index 000000000000..c88d6374f8d4 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitHubOwnerProperties.cs @@ -0,0 +1,237 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// GitHub Owner properties. + public partial class GitHubOwnerProperties : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerProperties, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerPropertiesInternal + { + + /// Backing field for property. + private string _gitHubInternalId; + + /// Gets or sets internal GitHub id. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string GitHubInternalId { get => this._gitHubInternalId; } + + /// Internal Acessors for GitHubInternalId + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerPropertiesInternal.GitHubInternalId { get => this._gitHubInternalId; set { {_gitHubInternalId = value;} } } + + /// Internal Acessors for OwnerUrl + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerPropertiesInternal.OwnerUrl { get => this._ownerUrl; set { {_ownerUrl = value;} } } + + /// Internal Acessors for ProvisioningStatusMessage + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerPropertiesInternal.ProvisioningStatusMessage { get => this._provisioningStatusMessage; set { {_provisioningStatusMessage = value;} } } + + /// Internal Acessors for ProvisioningStatusUpdateTimeUtc + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerPropertiesInternal.ProvisioningStatusUpdateTimeUtc { get => this._provisioningStatusUpdateTimeUtc; set { {_provisioningStatusUpdateTimeUtc = value;} } } + + /// Backing field for property. + private string _onboardingState; + + /// + /// Details about resource onboarding status across all connectors. + /// + /// OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to + /// top-level resources. + /// Onboarded - this resource has already been onboarded by the specified connector. + /// NotOnboarded - this resource has not been onboarded to any connector. + /// NotApplicable - the onboarding state is not applicable to the current endpoint. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string OnboardingState { get => this._onboardingState; set => this._onboardingState = value; } + + /// Backing field for property. + private string _ownerUrl; + + /// Gets or sets GitHub Owner url. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string OwnerUrl { get => this._ownerUrl; } + + /// Backing field for property. + private string _provisioningState; + + /// + /// The provisioning state of the resource. + /// + /// Pending - Provisioning pending. + /// Failed - Provisioning failed. + /// Succeeded - Successful provisioning. + /// Canceled - Provisioning canceled. + /// PendingDeletion - Deletion pending. + /// DeletionSuccess - Deletion successful. + /// DeletionFailure - Deletion failure. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string ProvisioningState { get => this._provisioningState; set => this._provisioningState = value; } + + /// Backing field for property. + private string _provisioningStatusMessage; + + /// Gets or sets resource status message. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string ProvisioningStatusMessage { get => this._provisioningStatusMessage; } + + /// Backing field for property. + private global::System.DateTime? _provisioningStatusUpdateTimeUtc; + + /// Gets or sets time when resource was last checked. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public global::System.DateTime? ProvisioningStatusUpdateTimeUtc { get => this._provisioningStatusUpdateTimeUtc; } + + /// Creates an new instance. + public GitHubOwnerProperties() + { + + } + } + /// GitHub Owner properties. + public partial interface IGitHubOwnerProperties : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// Gets or sets internal GitHub id. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets internal GitHub id.", + SerializedName = @"gitHubInternalId", + PossibleTypes = new [] { typeof(string) })] + string GitHubInternalId { get; } + /// + /// Details about resource onboarding status across all connectors. + /// + /// OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to + /// top-level resources. + /// Onboarded - this resource has already been onboarded by the specified connector. + /// NotOnboarded - this resource has not been onboarded to any connector. + /// NotApplicable - the onboarding state is not applicable to the current endpoint. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Details about resource onboarding status across all connectors. + + OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to top-level resources. + Onboarded - this resource has already been onboarded by the specified connector. + NotOnboarded - this resource has not been onboarded to any connector. + NotApplicable - the onboarding state is not applicable to the current endpoint.", + SerializedName = @"onboardingState", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("NotApplicable", "OnboardedByOtherConnector", "Onboarded", "NotOnboarded")] + string OnboardingState { get; set; } + /// Gets or sets GitHub Owner url. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets GitHub Owner url.", + SerializedName = @"ownerUrl", + PossibleTypes = new [] { typeof(string) })] + string OwnerUrl { get; } + /// + /// The provisioning state of the resource. + /// + /// Pending - Provisioning pending. + /// Failed - Provisioning failed. + /// Succeeded - Successful provisioning. + /// Canceled - Provisioning canceled. + /// PendingDeletion - Deletion pending. + /// DeletionSuccess - Deletion successful. + /// DeletionFailure - Deletion failure. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The provisioning state of the resource. + + Pending - Provisioning pending. + Failed - Provisioning failed. + Succeeded - Successful provisioning. + Canceled - Provisioning canceled. + PendingDeletion - Deletion pending. + DeletionSuccess - Deletion successful. + DeletionFailure - Deletion failure.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Succeeded", "Failed", "Canceled", "Pending", "PendingDeletion", "DeletionSuccess", "DeletionFailure")] + string ProvisioningState { get; set; } + /// Gets or sets resource status message. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets resource status message.", + SerializedName = @"provisioningStatusMessage", + PossibleTypes = new [] { typeof(string) })] + string ProvisioningStatusMessage { get; } + /// Gets or sets time when resource was last checked. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets time when resource was last checked.", + SerializedName = @"provisioningStatusUpdateTimeUtc", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? ProvisioningStatusUpdateTimeUtc { get; } + + } + /// GitHub Owner properties. + internal partial interface IGitHubOwnerPropertiesInternal + + { + /// Gets or sets internal GitHub id. + string GitHubInternalId { get; set; } + /// + /// Details about resource onboarding status across all connectors. + /// + /// OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to + /// top-level resources. + /// Onboarded - this resource has already been onboarded by the specified connector. + /// NotOnboarded - this resource has not been onboarded to any connector. + /// NotApplicable - the onboarding state is not applicable to the current endpoint. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("NotApplicable", "OnboardedByOtherConnector", "Onboarded", "NotOnboarded")] + string OnboardingState { get; set; } + /// Gets or sets GitHub Owner url. + string OwnerUrl { get; set; } + /// + /// The provisioning state of the resource. + /// + /// Pending - Provisioning pending. + /// Failed - Provisioning failed. + /// Succeeded - Successful provisioning. + /// Canceled - Provisioning canceled. + /// PendingDeletion - Deletion pending. + /// DeletionSuccess - Deletion successful. + /// DeletionFailure - Deletion failure. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Succeeded", "Failed", "Canceled", "Pending", "PendingDeletion", "DeletionSuccess", "DeletionFailure")] + string ProvisioningState { get; set; } + /// Gets or sets resource status message. + string ProvisioningStatusMessage { get; set; } + /// Gets or sets time when resource was last checked. + global::System.DateTime? ProvisioningStatusUpdateTimeUtc { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitHubOwnerProperties.json.cs b/src/Security/Security.Autorest/generated/api/Models/GitHubOwnerProperties.json.cs new file mode 100644 index 000000000000..04df659366a1 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitHubOwnerProperties.json.cs @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// GitHub Owner properties. + public partial class GitHubOwnerProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new GitHubOwnerProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal GitHubOwnerProperties(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_provisioningStatusMessage = If( json?.PropertyT("provisioningStatusMessage"), out var __jsonProvisioningStatusMessage) ? (string)__jsonProvisioningStatusMessage : (string)_provisioningStatusMessage;} + {_provisioningStatusUpdateTimeUtc = If( json?.PropertyT("provisioningStatusUpdateTimeUtc"), out var __jsonProvisioningStatusUpdateTimeUtc) ? global::System.DateTime.TryParse((string)__jsonProvisioningStatusUpdateTimeUtc, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonProvisioningStatusUpdateTimeUtcValue) ? __jsonProvisioningStatusUpdateTimeUtcValue : _provisioningStatusUpdateTimeUtc : _provisioningStatusUpdateTimeUtc;} + {_provisioningState = If( json?.PropertyT("provisioningState"), out var __jsonProvisioningState) ? (string)__jsonProvisioningState : (string)_provisioningState;} + {_ownerUrl = If( json?.PropertyT("ownerUrl"), out var __jsonOwnerUrl) ? (string)__jsonOwnerUrl : (string)_ownerUrl;} + {_gitHubInternalId = If( json?.PropertyT("gitHubInternalId"), out var __jsonGitHubInternalId) ? (string)__jsonGitHubInternalId : (string)_gitHubInternalId;} + {_onboardingState = If( json?.PropertyT("onboardingState"), out var __jsonOnboardingState) ? (string)__jsonOnboardingState : (string)_onboardingState;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._provisioningStatusMessage)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._provisioningStatusMessage.ToString()) : null, "provisioningStatusMessage" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._provisioningStatusUpdateTimeUtc ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._provisioningStatusUpdateTimeUtc?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "provisioningStatusUpdateTimeUtc" ,container.Add ); + } + AddIf( null != (((object)this._provisioningState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._provisioningState.ToString()) : null, "provisioningState" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._ownerUrl)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._ownerUrl.ToString()) : null, "ownerUrl" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._gitHubInternalId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._gitHubInternalId.ToString()) : null, "gitHubInternalId" ,container.Add ); + } + AddIf( null != (((object)this._onboardingState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._onboardingState.ToString()) : null, "onboardingState" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitHubRepository.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/GitHubRepository.PowerShell.cs new file mode 100644 index 000000000000..582f53a8f670 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitHubRepository.PowerShell.cs @@ -0,0 +1,316 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// GitHub Repository resource. + [System.ComponentModel.TypeConverter(typeof(GitHubRepositoryTypeConverter))] + public partial class GitHubRepository + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepository DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new GitHubRepository(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepository DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new GitHubRepository(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepository FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal GitHubRepository(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitHubRepositoryPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("OnboardingState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal)this).OnboardingState = (string) content.GetValueForProperty("OnboardingState",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal)this).OnboardingState, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ProvisioningStatusMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal)this).ProvisioningStatusMessage = (string) content.GetValueForProperty("ProvisioningStatusMessage",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal)this).ProvisioningStatusMessage, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningStatusUpdateTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal)this).ProvisioningStatusUpdateTimeUtc = (global::System.DateTime?) content.GetValueForProperty("ProvisioningStatusUpdateTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal)this).ProvisioningStatusUpdateTimeUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal)this).ProvisioningState, global::System.Convert.ToString); + } + if (content.Contains("RepoId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal)this).RepoId = (string) content.GetValueForProperty("RepoId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal)this).RepoId, global::System.Convert.ToString); + } + if (content.Contains("RepoName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal)this).RepoName = (string) content.GetValueForProperty("RepoName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal)this).RepoName, global::System.Convert.ToString); + } + if (content.Contains("RepoFullName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal)this).RepoFullName = (string) content.GetValueForProperty("RepoFullName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal)this).RepoFullName, global::System.Convert.ToString); + } + if (content.Contains("RepoUrl")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal)this).RepoUrl = (string) content.GetValueForProperty("RepoUrl",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal)this).RepoUrl, global::System.Convert.ToString); + } + if (content.Contains("ParentOwnerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal)this).ParentOwnerName = (string) content.GetValueForProperty("ParentOwnerName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal)this).ParentOwnerName, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal GitHubRepository(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitHubRepositoryPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("OnboardingState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal)this).OnboardingState = (string) content.GetValueForProperty("OnboardingState",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal)this).OnboardingState, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ProvisioningStatusMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal)this).ProvisioningStatusMessage = (string) content.GetValueForProperty("ProvisioningStatusMessage",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal)this).ProvisioningStatusMessage, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningStatusUpdateTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal)this).ProvisioningStatusUpdateTimeUtc = (global::System.DateTime?) content.GetValueForProperty("ProvisioningStatusUpdateTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal)this).ProvisioningStatusUpdateTimeUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal)this).ProvisioningState, global::System.Convert.ToString); + } + if (content.Contains("RepoId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal)this).RepoId = (string) content.GetValueForProperty("RepoId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal)this).RepoId, global::System.Convert.ToString); + } + if (content.Contains("RepoName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal)this).RepoName = (string) content.GetValueForProperty("RepoName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal)this).RepoName, global::System.Convert.ToString); + } + if (content.Contains("RepoFullName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal)this).RepoFullName = (string) content.GetValueForProperty("RepoFullName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal)this).RepoFullName, global::System.Convert.ToString); + } + if (content.Contains("RepoUrl")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal)this).RepoUrl = (string) content.GetValueForProperty("RepoUrl",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal)this).RepoUrl, global::System.Convert.ToString); + } + if (content.Contains("ParentOwnerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal)this).ParentOwnerName = (string) content.GetValueForProperty("ParentOwnerName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal)this).ParentOwnerName, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// GitHub Repository resource. + [System.ComponentModel.TypeConverter(typeof(GitHubRepositoryTypeConverter))] + public partial interface IGitHubRepository + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitHubRepository.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/GitHubRepository.TypeConverter.cs new file mode 100644 index 000000000000..42f99934b261 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitHubRepository.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class GitHubRepositoryTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepository ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepository).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return GitHubRepository.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return GitHubRepository.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return GitHubRepository.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitHubRepository.cs b/src/Security/Security.Autorest/generated/api/Models/GitHubRepository.cs new file mode 100644 index 000000000000..6c8c65011955 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitHubRepository.cs @@ -0,0 +1,495 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// GitHub Repository resource. + public partial class GitHubRepository : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepository, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IProxyResource __proxyResource = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ProxyResource(); + + /// + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Id; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryProperties Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitHubRepositoryProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProvisioningStatusMessage + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal.ProvisioningStatusMessage { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryPropertiesInternal)Property).ProvisioningStatusMessage; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryPropertiesInternal)Property).ProvisioningStatusMessage = value; } + + /// Internal Acessors for ProvisioningStatusUpdateTimeUtc + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal.ProvisioningStatusUpdateTimeUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryPropertiesInternal)Property).ProvisioningStatusUpdateTimeUtc; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryPropertiesInternal)Property).ProvisioningStatusUpdateTimeUtc = value; } + + /// Internal Acessors for RepoFullName + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal.RepoFullName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryPropertiesInternal)Property).RepoFullName; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryPropertiesInternal)Property).RepoFullName = value; } + + /// Internal Acessors for RepoId + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal.RepoId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryPropertiesInternal)Property).RepoId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryPropertiesInternal)Property).RepoId = value; } + + /// Internal Acessors for RepoName + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal.RepoName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryPropertiesInternal)Property).RepoName; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryPropertiesInternal)Property).RepoName = value; } + + /// Internal Acessors for RepoUrl + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal.RepoUrl { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryPropertiesInternal)Property).RepoUrl; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryPropertiesInternal)Property).RepoUrl = value; } + + /// Internal Acessors for SystemData + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemData Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryInternal.SystemData { get => (this._systemData = this._systemData ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SystemData()); set { {_systemData = value;} } } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Name = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Type = value; } + + /// The name of the resource + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Name; } + + /// + /// Details about resource onboarding status across all connectors. + /// + /// OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to + /// top-level resources. + /// Onboarded - this resource has already been onboarded by the specified connector. + /// NotOnboarded - this resource has not been onboarded to any connector. + /// NotApplicable - the onboarding state is not applicable to the current endpoint. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string OnboardingState { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryPropertiesInternal)Property).OnboardingState; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryPropertiesInternal)Property).OnboardingState = value ?? null; } + + /// Gets or sets parent GitHub Owner name. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string ParentOwnerName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryPropertiesInternal)Property).ParentOwnerName; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryPropertiesInternal)Property).ParentOwnerName = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryProperties _property; + + /// GitHub Repository properties. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitHubRepositoryProperties()); set => this._property = value; } + + /// + /// The provisioning state of the resource. + /// + /// Pending - Provisioning pending. + /// Failed - Provisioning failed. + /// Succeeded - Successful provisioning. + /// Canceled - Provisioning canceled. + /// PendingDeletion - Deletion pending. + /// DeletionSuccess - Deletion successful. + /// DeletionFailure - Deletion failure. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryPropertiesInternal)Property).ProvisioningState; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryPropertiesInternal)Property).ProvisioningState = value ?? null; } + + /// Gets or sets resource status message. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string ProvisioningStatusMessage { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryPropertiesInternal)Property).ProvisioningStatusMessage; } + + /// Gets or sets time when resource was last checked. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public global::System.DateTime? ProvisioningStatusUpdateTimeUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryPropertiesInternal)Property).ProvisioningStatusUpdateTimeUtc; } + + /// + /// Gets or sets GitHub Full Name. + /// Repository name, prefixed with Owner name. + /// Eg: "my-org/new-repo-1". + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string RepoFullName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryPropertiesInternal)Property).RepoFullName; } + + /// + /// Gets or sets GitHub Repository id. + /// + /// This is a numeric id defined by Github. + /// Eg: "123456". + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string RepoId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryPropertiesInternal)Property).RepoId; } + + /// + /// Gets or sets GitHub Repository name. + /// Eg: "new-repo-1". + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string RepoName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryPropertiesInternal)Property).RepoName; } + + /// Gets or sets GitHub Repository url. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string RepoUrl { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryPropertiesInternal)Property).RepoUrl; } + + /// Gets the resource group name + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string ResourceGroupName { get => (new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Success ? new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Groups["resourceGroupName"].Value : null); } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemData _systemData; + + /// Metadata pertaining to creation and last modification of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemData SystemData { get => (this._systemData = this._systemData ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SystemData()); } + + /// The timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).CreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).CreatedAt = value ?? default(global::System.DateTime); } + + /// The identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).CreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).CreatedBy = value ?? null; } + + /// The type of identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).CreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).CreatedByType = value ?? null; } + + /// The timestamp of resource last modification (UTC) + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).LastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).LastModifiedAt = value ?? default(global::System.DateTime); } + + /// The identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).LastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).LastModifiedBy = value ?? null; } + + /// The type of identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).LastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).LastModifiedByType = value ?? null; } + + /// + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Type; } + + /// Creates an new instance. + public GitHubRepository() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__proxyResource), __proxyResource); + await eventListener.AssertObjectIsValid(nameof(__proxyResource), __proxyResource); + } + } + /// GitHub Repository resource. + public partial interface IGitHubRepository : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IProxyResource + { + /// + /// Details about resource onboarding status across all connectors. + /// + /// OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to + /// top-level resources. + /// Onboarded - this resource has already been onboarded by the specified connector. + /// NotOnboarded - this resource has not been onboarded to any connector. + /// NotApplicable - the onboarding state is not applicable to the current endpoint. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Details about resource onboarding status across all connectors. + + OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to top-level resources. + Onboarded - this resource has already been onboarded by the specified connector. + NotOnboarded - this resource has not been onboarded to any connector. + NotApplicable - the onboarding state is not applicable to the current endpoint.", + SerializedName = @"onboardingState", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("NotApplicable", "OnboardedByOtherConnector", "Onboarded", "NotOnboarded")] + string OnboardingState { get; set; } + /// Gets or sets parent GitHub Owner name. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Gets or sets parent GitHub Owner name.", + SerializedName = @"parentOwnerName", + PossibleTypes = new [] { typeof(string) })] + string ParentOwnerName { get; set; } + /// + /// The provisioning state of the resource. + /// + /// Pending - Provisioning pending. + /// Failed - Provisioning failed. + /// Succeeded - Successful provisioning. + /// Canceled - Provisioning canceled. + /// PendingDeletion - Deletion pending. + /// DeletionSuccess - Deletion successful. + /// DeletionFailure - Deletion failure. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The provisioning state of the resource. + + Pending - Provisioning pending. + Failed - Provisioning failed. + Succeeded - Successful provisioning. + Canceled - Provisioning canceled. + PendingDeletion - Deletion pending. + DeletionSuccess - Deletion successful. + DeletionFailure - Deletion failure.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Succeeded", "Failed", "Canceled", "Pending", "PendingDeletion", "DeletionSuccess", "DeletionFailure")] + string ProvisioningState { get; set; } + /// Gets or sets resource status message. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets resource status message.", + SerializedName = @"provisioningStatusMessage", + PossibleTypes = new [] { typeof(string) })] + string ProvisioningStatusMessage { get; } + /// Gets or sets time when resource was last checked. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets time when resource was last checked.", + SerializedName = @"provisioningStatusUpdateTimeUtc", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? ProvisioningStatusUpdateTimeUtc { get; } + /// + /// Gets or sets GitHub Full Name. + /// Repository name, prefixed with Owner name. + /// Eg: "my-org/new-repo-1". + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets GitHub Full Name. + Repository name, prefixed with Owner name. + Eg: ""my-org/new-repo-1"".", + SerializedName = @"repoFullName", + PossibleTypes = new [] { typeof(string) })] + string RepoFullName { get; } + /// + /// Gets or sets GitHub Repository id. + /// + /// This is a numeric id defined by Github. + /// Eg: "123456". + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets GitHub Repository id. + + This is a numeric id defined by Github. + Eg: ""123456"".", + SerializedName = @"repoId", + PossibleTypes = new [] { typeof(string) })] + string RepoId { get; } + /// + /// Gets or sets GitHub Repository name. + /// Eg: "new-repo-1". + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets GitHub Repository name. + Eg: ""new-repo-1"".", + SerializedName = @"repoName", + PossibleTypes = new [] { typeof(string) })] + string RepoName { get; } + /// Gets or sets GitHub Repository url. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets GitHub Repository url.", + SerializedName = @"repoUrl", + PossibleTypes = new [] { typeof(string) })] + string RepoUrl { get; } + /// The timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The timestamp of resource creation (UTC).", + SerializedName = @"createdAt", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? SystemDataCreatedAt { get; } + /// The identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The identity that created the resource.", + SerializedName = @"createdBy", + PossibleTypes = new [] { typeof(string) })] + string SystemDataCreatedBy { get; } + /// The type of identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The type of identity that created the resource.", + SerializedName = @"createdByType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string SystemDataCreatedByType { get; } + /// The timestamp of resource last modification (UTC) + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The timestamp of resource last modification (UTC)", + SerializedName = @"lastModifiedAt", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? SystemDataLastModifiedAt { get; } + /// The identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The identity that last modified the resource.", + SerializedName = @"lastModifiedBy", + PossibleTypes = new [] { typeof(string) })] + string SystemDataLastModifiedBy { get; } + /// The type of identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The type of identity that last modified the resource.", + SerializedName = @"lastModifiedByType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string SystemDataLastModifiedByType { get; } + + } + /// GitHub Repository resource. + internal partial interface IGitHubRepositoryInternal : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IProxyResourceInternal + { + /// + /// Details about resource onboarding status across all connectors. + /// + /// OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to + /// top-level resources. + /// Onboarded - this resource has already been onboarded by the specified connector. + /// NotOnboarded - this resource has not been onboarded to any connector. + /// NotApplicable - the onboarding state is not applicable to the current endpoint. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("NotApplicable", "OnboardedByOtherConnector", "Onboarded", "NotOnboarded")] + string OnboardingState { get; set; } + /// Gets or sets parent GitHub Owner name. + string ParentOwnerName { get; set; } + /// GitHub Repository properties. + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryProperties Property { get; set; } + /// + /// The provisioning state of the resource. + /// + /// Pending - Provisioning pending. + /// Failed - Provisioning failed. + /// Succeeded - Successful provisioning. + /// Canceled - Provisioning canceled. + /// PendingDeletion - Deletion pending. + /// DeletionSuccess - Deletion successful. + /// DeletionFailure - Deletion failure. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Succeeded", "Failed", "Canceled", "Pending", "PendingDeletion", "DeletionSuccess", "DeletionFailure")] + string ProvisioningState { get; set; } + /// Gets or sets resource status message. + string ProvisioningStatusMessage { get; set; } + /// Gets or sets time when resource was last checked. + global::System.DateTime? ProvisioningStatusUpdateTimeUtc { get; set; } + /// + /// Gets or sets GitHub Full Name. + /// Repository name, prefixed with Owner name. + /// Eg: "my-org/new-repo-1". + /// + string RepoFullName { get; set; } + /// + /// Gets or sets GitHub Repository id. + /// + /// This is a numeric id defined by Github. + /// Eg: "123456". + /// + string RepoId { get; set; } + /// + /// Gets or sets GitHub Repository name. + /// Eg: "new-repo-1". + /// + string RepoName { get; set; } + /// Gets or sets GitHub Repository url. + string RepoUrl { get; set; } + /// Metadata pertaining to creation and last modification of the resource. + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemData SystemData { get; set; } + /// The timestamp of resource creation (UTC). + global::System.DateTime? SystemDataCreatedAt { get; set; } + /// The identity that created the resource. + string SystemDataCreatedBy { get; set; } + /// The type of identity that created the resource. + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string SystemDataCreatedByType { get; set; } + /// The timestamp of resource last modification (UTC) + global::System.DateTime? SystemDataLastModifiedAt { get; set; } + /// The identity that last modified the resource. + string SystemDataLastModifiedBy { get; set; } + /// The type of identity that last modified the resource. + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string SystemDataLastModifiedByType { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitHubRepository.json.cs b/src/Security/Security.Autorest/generated/api/Models/GitHubRepository.json.cs new file mode 100644 index 000000000000..e831362f9839 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitHubRepository.json.cs @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// GitHub Repository resource. + public partial class GitHubRepository + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepository. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepository. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepository FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new GitHubRepository(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal GitHubRepository(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __proxyResource = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ProxyResource(json); + {_systemData = If( json?.PropertyT("systemData"), out var __jsonSystemData) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SystemData.FromJson(__jsonSystemData) : _systemData;} + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitHubRepositoryProperties.FromJson(__jsonProperties) : _property;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __proxyResource?.ToJson(container, serializationMode); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._systemData ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._systemData.ToJson(null,serializationMode) : null, "systemData" ,container.Add ); + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitHubRepositoryListResponse.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/GitHubRepositoryListResponse.PowerShell.cs new file mode 100644 index 000000000000..9db200114593 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitHubRepositoryListResponse.PowerShell.cs @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// List of RP resources which supports pagination. + [System.ComponentModel.TypeConverter(typeof(GitHubRepositoryListResponseTypeConverter))] + public partial class GitHubRepositoryListResponse + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryListResponse DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new GitHubRepositoryListResponse(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryListResponse DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new GitHubRepositoryListResponse(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryListResponse FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal GitHubRepositoryListResponse(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryListResponseInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryListResponseInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitHubRepositoryTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryListResponseInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryListResponseInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal GitHubRepositoryListResponse(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryListResponseInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryListResponseInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitHubRepositoryTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryListResponseInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryListResponseInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// List of RP resources which supports pagination. + [System.ComponentModel.TypeConverter(typeof(GitHubRepositoryListResponseTypeConverter))] + public partial interface IGitHubRepositoryListResponse + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitHubRepositoryListResponse.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/GitHubRepositoryListResponse.TypeConverter.cs new file mode 100644 index 000000000000..753bd89ee4c7 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitHubRepositoryListResponse.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class GitHubRepositoryListResponseTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryListResponse ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryListResponse).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return GitHubRepositoryListResponse.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return GitHubRepositoryListResponse.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return GitHubRepositoryListResponse.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitHubRepositoryListResponse.cs b/src/Security/Security.Autorest/generated/api/Models/GitHubRepositoryListResponse.cs new file mode 100644 index 000000000000..e9429811d79b --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitHubRepositoryListResponse.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// List of RP resources which supports pagination. + public partial class GitHubRepositoryListResponse : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryListResponse, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryListResponseInternal + { + + /// Backing field for property. + private string _nextLink; + + /// Gets or sets next link to scroll over the results. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private System.Collections.Generic.List _value; + + /// Gets or sets list of resources. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public System.Collections.Generic.List Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public GitHubRepositoryListResponse() + { + + } + } + /// List of RP resources which supports pagination. + public partial interface IGitHubRepositoryListResponse : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// Gets or sets next link to scroll over the results. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Gets or sets next link to scroll over the results.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// Gets or sets list of resources. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Gets or sets list of resources.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepository) })] + System.Collections.Generic.List Value { get; set; } + + } + /// List of RP resources which supports pagination. + internal partial interface IGitHubRepositoryListResponseInternal + + { + /// Gets or sets next link to scroll over the results. + string NextLink { get; set; } + /// Gets or sets list of resources. + System.Collections.Generic.List Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitHubRepositoryListResponse.json.cs b/src/Security/Security.Autorest/generated/api/Models/GitHubRepositoryListResponse.json.cs new file mode 100644 index 000000000000..24775acfc66c --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitHubRepositoryListResponse.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// List of RP resources which supports pagination. + public partial class GitHubRepositoryListResponse + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryListResponse. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryListResponse. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryListResponse FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new GitHubRepositoryListResponse(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal GitHubRepositoryListResponse(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepository) (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitHubRepository.FromJson(__u) )) ))() : null : _value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)_nextLink;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitHubRepositoryProperties.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/GitHubRepositoryProperties.PowerShell.cs new file mode 100644 index 000000000000..c4988c400d5d --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitHubRepositoryProperties.PowerShell.cs @@ -0,0 +1,228 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// GitHub Repository properties. + [System.ComponentModel.TypeConverter(typeof(GitHubRepositoryPropertiesTypeConverter))] + public partial class GitHubRepositoryProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new GitHubRepositoryProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new GitHubRepositoryProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal GitHubRepositoryProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProvisioningStatusMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryPropertiesInternal)this).ProvisioningStatusMessage = (string) content.GetValueForProperty("ProvisioningStatusMessage",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryPropertiesInternal)this).ProvisioningStatusMessage, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningStatusUpdateTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryPropertiesInternal)this).ProvisioningStatusUpdateTimeUtc = (global::System.DateTime?) content.GetValueForProperty("ProvisioningStatusUpdateTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryPropertiesInternal)this).ProvisioningStatusUpdateTimeUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryPropertiesInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryPropertiesInternal)this).ProvisioningState, global::System.Convert.ToString); + } + if (content.Contains("RepoId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryPropertiesInternal)this).RepoId = (string) content.GetValueForProperty("RepoId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryPropertiesInternal)this).RepoId, global::System.Convert.ToString); + } + if (content.Contains("RepoName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryPropertiesInternal)this).RepoName = (string) content.GetValueForProperty("RepoName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryPropertiesInternal)this).RepoName, global::System.Convert.ToString); + } + if (content.Contains("RepoFullName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryPropertiesInternal)this).RepoFullName = (string) content.GetValueForProperty("RepoFullName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryPropertiesInternal)this).RepoFullName, global::System.Convert.ToString); + } + if (content.Contains("OnboardingState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryPropertiesInternal)this).OnboardingState = (string) content.GetValueForProperty("OnboardingState",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryPropertiesInternal)this).OnboardingState, global::System.Convert.ToString); + } + if (content.Contains("RepoUrl")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryPropertiesInternal)this).RepoUrl = (string) content.GetValueForProperty("RepoUrl",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryPropertiesInternal)this).RepoUrl, global::System.Convert.ToString); + } + if (content.Contains("ParentOwnerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryPropertiesInternal)this).ParentOwnerName = (string) content.GetValueForProperty("ParentOwnerName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryPropertiesInternal)this).ParentOwnerName, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal GitHubRepositoryProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProvisioningStatusMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryPropertiesInternal)this).ProvisioningStatusMessage = (string) content.GetValueForProperty("ProvisioningStatusMessage",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryPropertiesInternal)this).ProvisioningStatusMessage, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningStatusUpdateTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryPropertiesInternal)this).ProvisioningStatusUpdateTimeUtc = (global::System.DateTime?) content.GetValueForProperty("ProvisioningStatusUpdateTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryPropertiesInternal)this).ProvisioningStatusUpdateTimeUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryPropertiesInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryPropertiesInternal)this).ProvisioningState, global::System.Convert.ToString); + } + if (content.Contains("RepoId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryPropertiesInternal)this).RepoId = (string) content.GetValueForProperty("RepoId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryPropertiesInternal)this).RepoId, global::System.Convert.ToString); + } + if (content.Contains("RepoName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryPropertiesInternal)this).RepoName = (string) content.GetValueForProperty("RepoName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryPropertiesInternal)this).RepoName, global::System.Convert.ToString); + } + if (content.Contains("RepoFullName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryPropertiesInternal)this).RepoFullName = (string) content.GetValueForProperty("RepoFullName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryPropertiesInternal)this).RepoFullName, global::System.Convert.ToString); + } + if (content.Contains("OnboardingState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryPropertiesInternal)this).OnboardingState = (string) content.GetValueForProperty("OnboardingState",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryPropertiesInternal)this).OnboardingState, global::System.Convert.ToString); + } + if (content.Contains("RepoUrl")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryPropertiesInternal)this).RepoUrl = (string) content.GetValueForProperty("RepoUrl",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryPropertiesInternal)this).RepoUrl, global::System.Convert.ToString); + } + if (content.Contains("ParentOwnerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryPropertiesInternal)this).ParentOwnerName = (string) content.GetValueForProperty("ParentOwnerName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryPropertiesInternal)this).ParentOwnerName, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// GitHub Repository properties. + [System.ComponentModel.TypeConverter(typeof(GitHubRepositoryPropertiesTypeConverter))] + public partial interface IGitHubRepositoryProperties + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitHubRepositoryProperties.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/GitHubRepositoryProperties.TypeConverter.cs new file mode 100644 index 000000000000..10404920da79 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitHubRepositoryProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class GitHubRepositoryPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return GitHubRepositoryProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return GitHubRepositoryProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return GitHubRepositoryProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitHubRepositoryProperties.cs b/src/Security/Security.Autorest/generated/api/Models/GitHubRepositoryProperties.cs new file mode 100644 index 000000000000..156d7eccc841 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitHubRepositoryProperties.cs @@ -0,0 +1,345 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// GitHub Repository properties. + public partial class GitHubRepositoryProperties : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryProperties, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryPropertiesInternal + { + + /// Internal Acessors for ProvisioningStatusMessage + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryPropertiesInternal.ProvisioningStatusMessage { get => this._provisioningStatusMessage; set { {_provisioningStatusMessage = value;} } } + + /// Internal Acessors for ProvisioningStatusUpdateTimeUtc + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryPropertiesInternal.ProvisioningStatusUpdateTimeUtc { get => this._provisioningStatusUpdateTimeUtc; set { {_provisioningStatusUpdateTimeUtc = value;} } } + + /// Internal Acessors for RepoFullName + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryPropertiesInternal.RepoFullName { get => this._repoFullName; set { {_repoFullName = value;} } } + + /// Internal Acessors for RepoId + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryPropertiesInternal.RepoId { get => this._repoId; set { {_repoId = value;} } } + + /// Internal Acessors for RepoName + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryPropertiesInternal.RepoName { get => this._repoName; set { {_repoName = value;} } } + + /// Internal Acessors for RepoUrl + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryPropertiesInternal.RepoUrl { get => this._repoUrl; set { {_repoUrl = value;} } } + + /// Backing field for property. + private string _onboardingState; + + /// + /// Details about resource onboarding status across all connectors. + /// + /// OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to + /// top-level resources. + /// Onboarded - this resource has already been onboarded by the specified connector. + /// NotOnboarded - this resource has not been onboarded to any connector. + /// NotApplicable - the onboarding state is not applicable to the current endpoint. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string OnboardingState { get => this._onboardingState; set => this._onboardingState = value; } + + /// Backing field for property. + private string _parentOwnerName; + + /// Gets or sets parent GitHub Owner name. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string ParentOwnerName { get => this._parentOwnerName; set => this._parentOwnerName = value; } + + /// Backing field for property. + private string _provisioningState; + + /// + /// The provisioning state of the resource. + /// + /// Pending - Provisioning pending. + /// Failed - Provisioning failed. + /// Succeeded - Successful provisioning. + /// Canceled - Provisioning canceled. + /// PendingDeletion - Deletion pending. + /// DeletionSuccess - Deletion successful. + /// DeletionFailure - Deletion failure. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string ProvisioningState { get => this._provisioningState; set => this._provisioningState = value; } + + /// Backing field for property. + private string _provisioningStatusMessage; + + /// Gets or sets resource status message. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string ProvisioningStatusMessage { get => this._provisioningStatusMessage; } + + /// Backing field for property. + private global::System.DateTime? _provisioningStatusUpdateTimeUtc; + + /// Gets or sets time when resource was last checked. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public global::System.DateTime? ProvisioningStatusUpdateTimeUtc { get => this._provisioningStatusUpdateTimeUtc; } + + /// Backing field for property. + private string _repoFullName; + + /// + /// Gets or sets GitHub Full Name. + /// Repository name, prefixed with Owner name. + /// Eg: "my-org/new-repo-1". + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string RepoFullName { get => this._repoFullName; } + + /// Backing field for property. + private string _repoId; + + /// + /// Gets or sets GitHub Repository id. + /// + /// This is a numeric id defined by Github. + /// Eg: "123456". + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string RepoId { get => this._repoId; } + + /// Backing field for property. + private string _repoName; + + /// + /// Gets or sets GitHub Repository name. + /// Eg: "new-repo-1". + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string RepoName { get => this._repoName; } + + /// Backing field for property. + private string _repoUrl; + + /// Gets or sets GitHub Repository url. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string RepoUrl { get => this._repoUrl; } + + /// Creates an new instance. + public GitHubRepositoryProperties() + { + + } + } + /// GitHub Repository properties. + public partial interface IGitHubRepositoryProperties : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// + /// Details about resource onboarding status across all connectors. + /// + /// OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to + /// top-level resources. + /// Onboarded - this resource has already been onboarded by the specified connector. + /// NotOnboarded - this resource has not been onboarded to any connector. + /// NotApplicable - the onboarding state is not applicable to the current endpoint. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Details about resource onboarding status across all connectors. + + OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to top-level resources. + Onboarded - this resource has already been onboarded by the specified connector. + NotOnboarded - this resource has not been onboarded to any connector. + NotApplicable - the onboarding state is not applicable to the current endpoint.", + SerializedName = @"onboardingState", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("NotApplicable", "OnboardedByOtherConnector", "Onboarded", "NotOnboarded")] + string OnboardingState { get; set; } + /// Gets or sets parent GitHub Owner name. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Gets or sets parent GitHub Owner name.", + SerializedName = @"parentOwnerName", + PossibleTypes = new [] { typeof(string) })] + string ParentOwnerName { get; set; } + /// + /// The provisioning state of the resource. + /// + /// Pending - Provisioning pending. + /// Failed - Provisioning failed. + /// Succeeded - Successful provisioning. + /// Canceled - Provisioning canceled. + /// PendingDeletion - Deletion pending. + /// DeletionSuccess - Deletion successful. + /// DeletionFailure - Deletion failure. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The provisioning state of the resource. + + Pending - Provisioning pending. + Failed - Provisioning failed. + Succeeded - Successful provisioning. + Canceled - Provisioning canceled. + PendingDeletion - Deletion pending. + DeletionSuccess - Deletion successful. + DeletionFailure - Deletion failure.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Succeeded", "Failed", "Canceled", "Pending", "PendingDeletion", "DeletionSuccess", "DeletionFailure")] + string ProvisioningState { get; set; } + /// Gets or sets resource status message. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets resource status message.", + SerializedName = @"provisioningStatusMessage", + PossibleTypes = new [] { typeof(string) })] + string ProvisioningStatusMessage { get; } + /// Gets or sets time when resource was last checked. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets time when resource was last checked.", + SerializedName = @"provisioningStatusUpdateTimeUtc", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? ProvisioningStatusUpdateTimeUtc { get; } + /// + /// Gets or sets GitHub Full Name. + /// Repository name, prefixed with Owner name. + /// Eg: "my-org/new-repo-1". + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets GitHub Full Name. + Repository name, prefixed with Owner name. + Eg: ""my-org/new-repo-1"".", + SerializedName = @"repoFullName", + PossibleTypes = new [] { typeof(string) })] + string RepoFullName { get; } + /// + /// Gets or sets GitHub Repository id. + /// + /// This is a numeric id defined by Github. + /// Eg: "123456". + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets GitHub Repository id. + + This is a numeric id defined by Github. + Eg: ""123456"".", + SerializedName = @"repoId", + PossibleTypes = new [] { typeof(string) })] + string RepoId { get; } + /// + /// Gets or sets GitHub Repository name. + /// Eg: "new-repo-1". + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets GitHub Repository name. + Eg: ""new-repo-1"".", + SerializedName = @"repoName", + PossibleTypes = new [] { typeof(string) })] + string RepoName { get; } + /// Gets or sets GitHub Repository url. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets GitHub Repository url.", + SerializedName = @"repoUrl", + PossibleTypes = new [] { typeof(string) })] + string RepoUrl { get; } + + } + /// GitHub Repository properties. + internal partial interface IGitHubRepositoryPropertiesInternal + + { + /// + /// Details about resource onboarding status across all connectors. + /// + /// OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to + /// top-level resources. + /// Onboarded - this resource has already been onboarded by the specified connector. + /// NotOnboarded - this resource has not been onboarded to any connector. + /// NotApplicable - the onboarding state is not applicable to the current endpoint. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("NotApplicable", "OnboardedByOtherConnector", "Onboarded", "NotOnboarded")] + string OnboardingState { get; set; } + /// Gets or sets parent GitHub Owner name. + string ParentOwnerName { get; set; } + /// + /// The provisioning state of the resource. + /// + /// Pending - Provisioning pending. + /// Failed - Provisioning failed. + /// Succeeded - Successful provisioning. + /// Canceled - Provisioning canceled. + /// PendingDeletion - Deletion pending. + /// DeletionSuccess - Deletion successful. + /// DeletionFailure - Deletion failure. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Succeeded", "Failed", "Canceled", "Pending", "PendingDeletion", "DeletionSuccess", "DeletionFailure")] + string ProvisioningState { get; set; } + /// Gets or sets resource status message. + string ProvisioningStatusMessage { get; set; } + /// Gets or sets time when resource was last checked. + global::System.DateTime? ProvisioningStatusUpdateTimeUtc { get; set; } + /// + /// Gets or sets GitHub Full Name. + /// Repository name, prefixed with Owner name. + /// Eg: "my-org/new-repo-1". + /// + string RepoFullName { get; set; } + /// + /// Gets or sets GitHub Repository id. + /// + /// This is a numeric id defined by Github. + /// Eg: "123456". + /// + string RepoId { get; set; } + /// + /// Gets or sets GitHub Repository name. + /// Eg: "new-repo-1". + /// + string RepoName { get; set; } + /// Gets or sets GitHub Repository url. + string RepoUrl { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitHubRepositoryProperties.json.cs b/src/Security/Security.Autorest/generated/api/Models/GitHubRepositoryProperties.json.cs new file mode 100644 index 000000000000..aac8635416bc --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitHubRepositoryProperties.json.cs @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// GitHub Repository properties. + public partial class GitHubRepositoryProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new GitHubRepositoryProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal GitHubRepositoryProperties(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_provisioningStatusMessage = If( json?.PropertyT("provisioningStatusMessage"), out var __jsonProvisioningStatusMessage) ? (string)__jsonProvisioningStatusMessage : (string)_provisioningStatusMessage;} + {_provisioningStatusUpdateTimeUtc = If( json?.PropertyT("provisioningStatusUpdateTimeUtc"), out var __jsonProvisioningStatusUpdateTimeUtc) ? global::System.DateTime.TryParse((string)__jsonProvisioningStatusUpdateTimeUtc, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonProvisioningStatusUpdateTimeUtcValue) ? __jsonProvisioningStatusUpdateTimeUtcValue : _provisioningStatusUpdateTimeUtc : _provisioningStatusUpdateTimeUtc;} + {_provisioningState = If( json?.PropertyT("provisioningState"), out var __jsonProvisioningState) ? (string)__jsonProvisioningState : (string)_provisioningState;} + {_repoId = If( json?.PropertyT("repoId"), out var __jsonRepoId) ? (string)__jsonRepoId : (string)_repoId;} + {_repoName = If( json?.PropertyT("repoName"), out var __jsonRepoName) ? (string)__jsonRepoName : (string)_repoName;} + {_repoFullName = If( json?.PropertyT("repoFullName"), out var __jsonRepoFullName) ? (string)__jsonRepoFullName : (string)_repoFullName;} + {_onboardingState = If( json?.PropertyT("onboardingState"), out var __jsonOnboardingState) ? (string)__jsonOnboardingState : (string)_onboardingState;} + {_repoUrl = If( json?.PropertyT("repoUrl"), out var __jsonRepoUrl) ? (string)__jsonRepoUrl : (string)_repoUrl;} + {_parentOwnerName = If( json?.PropertyT("parentOwnerName"), out var __jsonParentOwnerName) ? (string)__jsonParentOwnerName : (string)_parentOwnerName;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._provisioningStatusMessage)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._provisioningStatusMessage.ToString()) : null, "provisioningStatusMessage" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._provisioningStatusUpdateTimeUtc ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._provisioningStatusUpdateTimeUtc?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "provisioningStatusUpdateTimeUtc" ,container.Add ); + } + AddIf( null != (((object)this._provisioningState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._provisioningState.ToString()) : null, "provisioningState" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._repoId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._repoId.ToString()) : null, "repoId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._repoName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._repoName.ToString()) : null, "repoName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._repoFullName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._repoFullName.ToString()) : null, "repoFullName" ,container.Add ); + } + AddIf( null != (((object)this._onboardingState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._onboardingState.ToString()) : null, "onboardingState" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._repoUrl)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._repoUrl.ToString()) : null, "repoUrl" ,container.Add ); + } + AddIf( null != (((object)this._parentOwnerName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._parentOwnerName.ToString()) : null, "parentOwnerName" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitHubScopeEnvironment.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/GitHubScopeEnvironment.PowerShell.cs new file mode 100644 index 000000000000..3f5df09294b8 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitHubScopeEnvironment.PowerShell.cs @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The github scope connector's environment data + [System.ComponentModel.TypeConverter(typeof(GitHubScopeEnvironmentTypeConverter))] + public partial class GitHubScopeEnvironment + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubScopeEnvironment DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new GitHubScopeEnvironment(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubScopeEnvironment DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new GitHubScopeEnvironment(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubScopeEnvironment FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal GitHubScopeEnvironment(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("EnvironmentType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironmentInternal)this).EnvironmentType = (string) content.GetValueForProperty("EnvironmentType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironmentInternal)this).EnvironmentType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal GitHubScopeEnvironment(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("EnvironmentType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironmentInternal)this).EnvironmentType = (string) content.GetValueForProperty("EnvironmentType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironmentInternal)this).EnvironmentType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The github scope connector's environment data + [System.ComponentModel.TypeConverter(typeof(GitHubScopeEnvironmentTypeConverter))] + public partial interface IGitHubScopeEnvironment + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitHubScopeEnvironment.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/GitHubScopeEnvironment.TypeConverter.cs new file mode 100644 index 000000000000..ddc6ec37d1d0 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitHubScopeEnvironment.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class GitHubScopeEnvironmentTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubScopeEnvironment ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubScopeEnvironment).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return GitHubScopeEnvironment.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return GitHubScopeEnvironment.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return GitHubScopeEnvironment.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitHubScopeEnvironment.cs b/src/Security/Security.Autorest/generated/api/Models/GitHubScopeEnvironment.cs new file mode 100644 index 000000000000..2d0eacd52dd9 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitHubScopeEnvironment.cs @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The github scope connector's environment data + public partial class GitHubScopeEnvironment : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubScopeEnvironment, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubScopeEnvironmentInternal, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironment __securityConnectorEnvironment = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SecurityConnectorEnvironment(); + + /// The type of the environment data. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Constant] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string EnvironmentType { get => "GithubScope"; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironmentInternal)__securityConnectorEnvironment).EnvironmentType = "GithubScope"; } + + /// Creates an new instance. + public GitHubScopeEnvironment() + { + this.__securityConnectorEnvironment.EnvironmentType = "GithubScope"; + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__securityConnectorEnvironment), __securityConnectorEnvironment); + await eventListener.AssertObjectIsValid(nameof(__securityConnectorEnvironment), __securityConnectorEnvironment); + } + } + /// The github scope connector's environment data + public partial interface IGitHubScopeEnvironment : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironment + { + + } + /// The github scope connector's environment data + internal partial interface IGitHubScopeEnvironmentInternal : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironmentInternal + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitHubScopeEnvironment.json.cs b/src/Security/Security.Autorest/generated/api/Models/GitHubScopeEnvironment.json.cs new file mode 100644 index 000000000000..bc51c32d36af --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitHubScopeEnvironment.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The github scope connector's environment data + public partial class GitHubScopeEnvironment + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubScopeEnvironment. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubScopeEnvironment. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubScopeEnvironment FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new GitHubScopeEnvironment(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal GitHubScopeEnvironment(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __securityConnectorEnvironment = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SecurityConnectorEnvironment(json); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __securityConnectorEnvironment?.ToJson(container, serializationMode); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitLabGroup.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/GitLabGroup.PowerShell.cs new file mode 100644 index 000000000000..058f3af8c21b --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitLabGroup.PowerShell.cs @@ -0,0 +1,300 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// GitLab Group resource. + [System.ComponentModel.TypeConverter(typeof(GitLabGroupTypeConverter))] + public partial class GitLabGroup + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroup DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new GitLabGroup(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroup DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new GitLabGroup(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroup FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal GitLabGroup(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitLabGroupPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("OnboardingState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupInternal)this).OnboardingState = (string) content.GetValueForProperty("OnboardingState",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupInternal)this).OnboardingState, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ProvisioningStatusMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupInternal)this).ProvisioningStatusMessage = (string) content.GetValueForProperty("ProvisioningStatusMessage",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupInternal)this).ProvisioningStatusMessage, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningStatusUpdateTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupInternal)this).ProvisioningStatusUpdateTimeUtc = (global::System.DateTime?) content.GetValueForProperty("ProvisioningStatusUpdateTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupInternal)this).ProvisioningStatusUpdateTimeUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupInternal)this).ProvisioningState, global::System.Convert.ToString); + } + if (content.Contains("FullyQualifiedName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupInternal)this).FullyQualifiedName = (string) content.GetValueForProperty("FullyQualifiedName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupInternal)this).FullyQualifiedName, global::System.Convert.ToString); + } + if (content.Contains("FullyQualifiedFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupInternal)this).FullyQualifiedFriendlyName = (string) content.GetValueForProperty("FullyQualifiedFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupInternal)this).FullyQualifiedFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("Url")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupInternal)this).Url = (string) content.GetValueForProperty("Url",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupInternal)this).Url, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal GitLabGroup(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitLabGroupPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("OnboardingState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupInternal)this).OnboardingState = (string) content.GetValueForProperty("OnboardingState",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupInternal)this).OnboardingState, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ProvisioningStatusMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupInternal)this).ProvisioningStatusMessage = (string) content.GetValueForProperty("ProvisioningStatusMessage",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupInternal)this).ProvisioningStatusMessage, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningStatusUpdateTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupInternal)this).ProvisioningStatusUpdateTimeUtc = (global::System.DateTime?) content.GetValueForProperty("ProvisioningStatusUpdateTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupInternal)this).ProvisioningStatusUpdateTimeUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupInternal)this).ProvisioningState, global::System.Convert.ToString); + } + if (content.Contains("FullyQualifiedName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupInternal)this).FullyQualifiedName = (string) content.GetValueForProperty("FullyQualifiedName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupInternal)this).FullyQualifiedName, global::System.Convert.ToString); + } + if (content.Contains("FullyQualifiedFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupInternal)this).FullyQualifiedFriendlyName = (string) content.GetValueForProperty("FullyQualifiedFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupInternal)this).FullyQualifiedFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("Url")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupInternal)this).Url = (string) content.GetValueForProperty("Url",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupInternal)this).Url, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// GitLab Group resource. + [System.ComponentModel.TypeConverter(typeof(GitLabGroupTypeConverter))] + public partial interface IGitLabGroup + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitLabGroup.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/GitLabGroup.TypeConverter.cs new file mode 100644 index 000000000000..ea59f51825fb --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitLabGroup.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class GitLabGroupTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroup ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroup).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return GitLabGroup.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return GitLabGroup.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return GitLabGroup.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitLabGroup.cs b/src/Security/Security.Autorest/generated/api/Models/GitLabGroup.cs new file mode 100644 index 000000000000..43bccf2a7569 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitLabGroup.cs @@ -0,0 +1,444 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// GitLab Group resource. + public partial class GitLabGroup : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroup, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupInternal, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IProxyResource __proxyResource = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ProxyResource(); + + /// + /// Gets or sets the human readable fully-qualified name of the Group object. + /// + /// This contains the entire namespace hierarchy as seen on GitLab UI where namespaces are separated by the '/' character. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string FullyQualifiedFriendlyName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupPropertiesInternal)Property).FullyQualifiedFriendlyName; } + + /// + /// Gets or sets the fully-qualified name of the Group object. + /// + /// This contains the entire namespace hierarchy where namespaces are separated by the '$' character. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string FullyQualifiedName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupPropertiesInternal)Property).FullyQualifiedName; } + + /// + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Id; } + + /// Internal Acessors for FullyQualifiedFriendlyName + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupInternal.FullyQualifiedFriendlyName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupPropertiesInternal)Property).FullyQualifiedFriendlyName; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupPropertiesInternal)Property).FullyQualifiedFriendlyName = value; } + + /// Internal Acessors for FullyQualifiedName + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupInternal.FullyQualifiedName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupPropertiesInternal)Property).FullyQualifiedName; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupPropertiesInternal)Property).FullyQualifiedName = value; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupProperties Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitLabGroupProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProvisioningStatusMessage + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupInternal.ProvisioningStatusMessage { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupPropertiesInternal)Property).ProvisioningStatusMessage; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupPropertiesInternal)Property).ProvisioningStatusMessage = value; } + + /// Internal Acessors for ProvisioningStatusUpdateTimeUtc + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupInternal.ProvisioningStatusUpdateTimeUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupPropertiesInternal)Property).ProvisioningStatusUpdateTimeUtc; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupPropertiesInternal)Property).ProvisioningStatusUpdateTimeUtc = value; } + + /// Internal Acessors for SystemData + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemData Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupInternal.SystemData { get => (this._systemData = this._systemData ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SystemData()); set { {_systemData = value;} } } + + /// Internal Acessors for Url + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupInternal.Url { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupPropertiesInternal)Property).Url; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupPropertiesInternal)Property).Url = value; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Name = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Type = value; } + + /// The name of the resource + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Name; } + + /// + /// Details about resource onboarding status across all connectors. + /// + /// OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to + /// top-level resources. + /// Onboarded - this resource has already been onboarded by the specified connector. + /// NotOnboarded - this resource has not been onboarded to any connector. + /// NotApplicable - the onboarding state is not applicable to the current endpoint. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string OnboardingState { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupPropertiesInternal)Property).OnboardingState; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupPropertiesInternal)Property).OnboardingState = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupProperties _property; + + /// GitLab Group properties. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitLabGroupProperties()); set => this._property = value; } + + /// + /// The provisioning state of the resource. + /// + /// Pending - Provisioning pending. + /// Failed - Provisioning failed. + /// Succeeded - Successful provisioning. + /// Canceled - Provisioning canceled. + /// PendingDeletion - Deletion pending. + /// DeletionSuccess - Deletion successful. + /// DeletionFailure - Deletion failure. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupPropertiesInternal)Property).ProvisioningState; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupPropertiesInternal)Property).ProvisioningState = value ?? null; } + + /// Gets or sets resource status message. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string ProvisioningStatusMessage { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupPropertiesInternal)Property).ProvisioningStatusMessage; } + + /// Gets or sets time when resource was last checked. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public global::System.DateTime? ProvisioningStatusUpdateTimeUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupPropertiesInternal)Property).ProvisioningStatusUpdateTimeUtc; } + + /// Gets the resource group name + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string ResourceGroupName { get => (new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Success ? new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Groups["resourceGroupName"].Value : null); } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemData _systemData; + + /// Metadata pertaining to creation and last modification of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemData SystemData { get => (this._systemData = this._systemData ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SystemData()); } + + /// The timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).CreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).CreatedAt = value ?? default(global::System.DateTime); } + + /// The identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).CreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).CreatedBy = value ?? null; } + + /// The type of identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).CreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).CreatedByType = value ?? null; } + + /// The timestamp of resource last modification (UTC) + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).LastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).LastModifiedAt = value ?? default(global::System.DateTime); } + + /// The identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).LastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).LastModifiedBy = value ?? null; } + + /// The type of identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).LastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).LastModifiedByType = value ?? null; } + + /// + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Type; } + + /// Gets or sets the url of the GitLab Group. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string Url { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupPropertiesInternal)Property).Url; } + + /// Creates an new instance. + public GitLabGroup() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__proxyResource), __proxyResource); + await eventListener.AssertObjectIsValid(nameof(__proxyResource), __proxyResource); + } + } + /// GitLab Group resource. + public partial interface IGitLabGroup : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IProxyResource + { + /// + /// Gets or sets the human readable fully-qualified name of the Group object. + /// + /// This contains the entire namespace hierarchy as seen on GitLab UI where namespaces are separated by the '/' character. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets the human readable fully-qualified name of the Group object. + + This contains the entire namespace hierarchy as seen on GitLab UI where namespaces are separated by the '/' character.", + SerializedName = @"fullyQualifiedFriendlyName", + PossibleTypes = new [] { typeof(string) })] + string FullyQualifiedFriendlyName { get; } + /// + /// Gets or sets the fully-qualified name of the Group object. + /// + /// This contains the entire namespace hierarchy where namespaces are separated by the '$' character. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets the fully-qualified name of the Group object. + + This contains the entire namespace hierarchy where namespaces are separated by the '$' character.", + SerializedName = @"fullyQualifiedName", + PossibleTypes = new [] { typeof(string) })] + string FullyQualifiedName { get; } + /// + /// Details about resource onboarding status across all connectors. + /// + /// OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to + /// top-level resources. + /// Onboarded - this resource has already been onboarded by the specified connector. + /// NotOnboarded - this resource has not been onboarded to any connector. + /// NotApplicable - the onboarding state is not applicable to the current endpoint. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Details about resource onboarding status across all connectors. + + OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to top-level resources. + Onboarded - this resource has already been onboarded by the specified connector. + NotOnboarded - this resource has not been onboarded to any connector. + NotApplicable - the onboarding state is not applicable to the current endpoint.", + SerializedName = @"onboardingState", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("NotApplicable", "OnboardedByOtherConnector", "Onboarded", "NotOnboarded")] + string OnboardingState { get; set; } + /// + /// The provisioning state of the resource. + /// + /// Pending - Provisioning pending. + /// Failed - Provisioning failed. + /// Succeeded - Successful provisioning. + /// Canceled - Provisioning canceled. + /// PendingDeletion - Deletion pending. + /// DeletionSuccess - Deletion successful. + /// DeletionFailure - Deletion failure. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The provisioning state of the resource. + + Pending - Provisioning pending. + Failed - Provisioning failed. + Succeeded - Successful provisioning. + Canceled - Provisioning canceled. + PendingDeletion - Deletion pending. + DeletionSuccess - Deletion successful. + DeletionFailure - Deletion failure.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Succeeded", "Failed", "Canceled", "Pending", "PendingDeletion", "DeletionSuccess", "DeletionFailure")] + string ProvisioningState { get; set; } + /// Gets or sets resource status message. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets resource status message.", + SerializedName = @"provisioningStatusMessage", + PossibleTypes = new [] { typeof(string) })] + string ProvisioningStatusMessage { get; } + /// Gets or sets time when resource was last checked. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets time when resource was last checked.", + SerializedName = @"provisioningStatusUpdateTimeUtc", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? ProvisioningStatusUpdateTimeUtc { get; } + /// The timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The timestamp of resource creation (UTC).", + SerializedName = @"createdAt", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? SystemDataCreatedAt { get; } + /// The identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The identity that created the resource.", + SerializedName = @"createdBy", + PossibleTypes = new [] { typeof(string) })] + string SystemDataCreatedBy { get; } + /// The type of identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The type of identity that created the resource.", + SerializedName = @"createdByType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string SystemDataCreatedByType { get; } + /// The timestamp of resource last modification (UTC) + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The timestamp of resource last modification (UTC)", + SerializedName = @"lastModifiedAt", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? SystemDataLastModifiedAt { get; } + /// The identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The identity that last modified the resource.", + SerializedName = @"lastModifiedBy", + PossibleTypes = new [] { typeof(string) })] + string SystemDataLastModifiedBy { get; } + /// The type of identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The type of identity that last modified the resource.", + SerializedName = @"lastModifiedByType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string SystemDataLastModifiedByType { get; } + /// Gets or sets the url of the GitLab Group. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets the url of the GitLab Group.", + SerializedName = @"url", + PossibleTypes = new [] { typeof(string) })] + string Url { get; } + + } + /// GitLab Group resource. + internal partial interface IGitLabGroupInternal : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IProxyResourceInternal + { + /// + /// Gets or sets the human readable fully-qualified name of the Group object. + /// + /// This contains the entire namespace hierarchy as seen on GitLab UI where namespaces are separated by the '/' character. + /// + string FullyQualifiedFriendlyName { get; set; } + /// + /// Gets or sets the fully-qualified name of the Group object. + /// + /// This contains the entire namespace hierarchy where namespaces are separated by the '$' character. + /// + string FullyQualifiedName { get; set; } + /// + /// Details about resource onboarding status across all connectors. + /// + /// OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to + /// top-level resources. + /// Onboarded - this resource has already been onboarded by the specified connector. + /// NotOnboarded - this resource has not been onboarded to any connector. + /// NotApplicable - the onboarding state is not applicable to the current endpoint. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("NotApplicable", "OnboardedByOtherConnector", "Onboarded", "NotOnboarded")] + string OnboardingState { get; set; } + /// GitLab Group properties. + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupProperties Property { get; set; } + /// + /// The provisioning state of the resource. + /// + /// Pending - Provisioning pending. + /// Failed - Provisioning failed. + /// Succeeded - Successful provisioning. + /// Canceled - Provisioning canceled. + /// PendingDeletion - Deletion pending. + /// DeletionSuccess - Deletion successful. + /// DeletionFailure - Deletion failure. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Succeeded", "Failed", "Canceled", "Pending", "PendingDeletion", "DeletionSuccess", "DeletionFailure")] + string ProvisioningState { get; set; } + /// Gets or sets resource status message. + string ProvisioningStatusMessage { get; set; } + /// Gets or sets time when resource was last checked. + global::System.DateTime? ProvisioningStatusUpdateTimeUtc { get; set; } + /// Metadata pertaining to creation and last modification of the resource. + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemData SystemData { get; set; } + /// The timestamp of resource creation (UTC). + global::System.DateTime? SystemDataCreatedAt { get; set; } + /// The identity that created the resource. + string SystemDataCreatedBy { get; set; } + /// The type of identity that created the resource. + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string SystemDataCreatedByType { get; set; } + /// The timestamp of resource last modification (UTC) + global::System.DateTime? SystemDataLastModifiedAt { get; set; } + /// The identity that last modified the resource. + string SystemDataLastModifiedBy { get; set; } + /// The type of identity that last modified the resource. + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string SystemDataLastModifiedByType { get; set; } + /// Gets or sets the url of the GitLab Group. + string Url { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitLabGroup.json.cs b/src/Security/Security.Autorest/generated/api/Models/GitLabGroup.json.cs new file mode 100644 index 000000000000..450f68476352 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitLabGroup.json.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// GitLab Group resource. + public partial class GitLabGroup + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroup. + /// + /// a to deserialize from. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroup. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroup FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new GitLabGroup(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal GitLabGroup(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __proxyResource = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ProxyResource(json); + {_systemData = If( json?.PropertyT("systemData"), out var __jsonSystemData) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SystemData.FromJson(__jsonSystemData) : _systemData;} + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitLabGroupProperties.FromJson(__jsonProperties) : _property;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __proxyResource?.ToJson(container, serializationMode); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._systemData ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._systemData.ToJson(null,serializationMode) : null, "systemData" ,container.Add ); + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitLabGroupConfiguration.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/GitLabGroupConfiguration.PowerShell.cs new file mode 100644 index 000000000000..713b264eaa85 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitLabGroupConfiguration.PowerShell.cs @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// GitLab Group Inventory Configuration. + [System.ComponentModel.TypeConverter(typeof(GitLabGroupConfigurationTypeConverter))] + public partial class GitLabGroupConfiguration + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupConfiguration DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new GitLabGroupConfiguration(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupConfiguration DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new GitLabGroupConfiguration(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupConfiguration FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal GitLabGroupConfiguration(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AutoDiscovery")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupConfigurationInternal)this).AutoDiscovery = (string) content.GetValueForProperty("AutoDiscovery",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupConfigurationInternal)this).AutoDiscovery, global::System.Convert.ToString); + } + if (content.Contains("ProjectConfig")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupConfigurationInternal)this).ProjectConfig = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupConfigurationProjectConfigs) content.GetValueForProperty("ProjectConfig",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupConfigurationInternal)this).ProjectConfig, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitLabGroupConfigurationProjectConfigsTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal GitLabGroupConfiguration(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AutoDiscovery")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupConfigurationInternal)this).AutoDiscovery = (string) content.GetValueForProperty("AutoDiscovery",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupConfigurationInternal)this).AutoDiscovery, global::System.Convert.ToString); + } + if (content.Contains("ProjectConfig")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupConfigurationInternal)this).ProjectConfig = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupConfigurationProjectConfigs) content.GetValueForProperty("ProjectConfig",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupConfigurationInternal)this).ProjectConfig, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitLabGroupConfigurationProjectConfigsTypeConverter.ConvertFrom); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// GitLab Group Inventory Configuration. + [System.ComponentModel.TypeConverter(typeof(GitLabGroupConfigurationTypeConverter))] + public partial interface IGitLabGroupConfiguration + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitLabGroupConfiguration.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/GitLabGroupConfiguration.TypeConverter.cs new file mode 100644 index 000000000000..98f60432ace4 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitLabGroupConfiguration.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class GitLabGroupConfigurationTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupConfiguration ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupConfiguration).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return GitLabGroupConfiguration.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return GitLabGroupConfiguration.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return GitLabGroupConfiguration.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitLabGroupConfiguration.cs b/src/Security/Security.Autorest/generated/api/Models/GitLabGroupConfiguration.cs new file mode 100644 index 000000000000..fa07d4c19c66 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitLabGroupConfiguration.cs @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// GitLab Group Inventory Configuration. + public partial class GitLabGroupConfiguration : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupConfiguration, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupConfigurationInternal + { + + /// Backing field for property. + private string _autoDiscovery; + + /// AutoDiscovery states. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string AutoDiscovery { get => this._autoDiscovery; set => this._autoDiscovery = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupConfigurationProjectConfigs _projectConfig; + + /// + /// GitLab Project Inventory Configuration. + /// Dictionary of GitLab fully-qualified project name to desired project configuration. + /// If AutoDiscovery is Enabled, this field should be null or empty. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupConfigurationProjectConfigs ProjectConfig { get => (this._projectConfig = this._projectConfig ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitLabGroupConfigurationProjectConfigs()); set => this._projectConfig = value; } + + /// Creates an new instance. + public GitLabGroupConfiguration() + { + + } + } + /// GitLab Group Inventory Configuration. + public partial interface IGitLabGroupConfiguration : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// AutoDiscovery states. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"AutoDiscovery states.", + SerializedName = @"autoDiscovery", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Disabled", "Enabled", "NotApplicable")] + string AutoDiscovery { get; set; } + /// + /// GitLab Project Inventory Configuration. + /// Dictionary of GitLab fully-qualified project name to desired project configuration. + /// If AutoDiscovery is Enabled, this field should be null or empty. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"GitLab Project Inventory Configuration. + Dictionary of GitLab fully-qualified project name to desired project configuration. + If AutoDiscovery is Enabled, this field should be null or empty.", + SerializedName = @"projectConfigs", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupConfigurationProjectConfigs) })] + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupConfigurationProjectConfigs ProjectConfig { get; set; } + + } + /// GitLab Group Inventory Configuration. + internal partial interface IGitLabGroupConfigurationInternal + + { + /// AutoDiscovery states. + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Disabled", "Enabled", "NotApplicable")] + string AutoDiscovery { get; set; } + /// + /// GitLab Project Inventory Configuration. + /// Dictionary of GitLab fully-qualified project name to desired project configuration. + /// If AutoDiscovery is Enabled, this field should be null or empty. + /// + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupConfigurationProjectConfigs ProjectConfig { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitLabGroupConfiguration.json.cs b/src/Security/Security.Autorest/generated/api/Models/GitLabGroupConfiguration.json.cs new file mode 100644 index 000000000000..773e43d14435 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitLabGroupConfiguration.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// GitLab Group Inventory Configuration. + public partial class GitLabGroupConfiguration + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupConfiguration. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupConfiguration. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupConfiguration FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new GitLabGroupConfiguration(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal GitLabGroupConfiguration(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_autoDiscovery = If( json?.PropertyT("autoDiscovery"), out var __jsonAutoDiscovery) ? (string)__jsonAutoDiscovery : (string)_autoDiscovery;} + {_projectConfig = If( json?.PropertyT("projectConfigs"), out var __jsonProjectConfigs) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitLabGroupConfigurationProjectConfigs.FromJson(__jsonProjectConfigs) : _projectConfig;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._autoDiscovery)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._autoDiscovery.ToString()) : null, "autoDiscovery" ,container.Add ); + AddIf( null != this._projectConfig ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._projectConfig.ToJson(null,serializationMode) : null, "projectConfigs" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitLabGroupConfigurationProjectConfigs.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/GitLabGroupConfigurationProjectConfigs.PowerShell.cs new file mode 100644 index 000000000000..06d99c7cb9cc --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitLabGroupConfigurationProjectConfigs.PowerShell.cs @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// GitLab Project Inventory Configuration. + /// Dictionary of GitLab fully-qualified project name to desired project configuration. + /// If AutoDiscovery is Enabled, this field should be null or empty. + /// + [System.ComponentModel.TypeConverter(typeof(GitLabGroupConfigurationProjectConfigsTypeConverter))] + public partial class GitLabGroupConfigurationProjectConfigs + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupConfigurationProjectConfigs DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new GitLabGroupConfigurationProjectConfigs(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupConfigurationProjectConfigs DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new GitLabGroupConfigurationProjectConfigs(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupConfigurationProjectConfigs FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal GitLabGroupConfigurationProjectConfigs(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal GitLabGroupConfigurationProjectConfigs(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// GitLab Project Inventory Configuration. + /// Dictionary of GitLab fully-qualified project name to desired project configuration. + /// If AutoDiscovery is Enabled, this field should be null or empty. + [System.ComponentModel.TypeConverter(typeof(GitLabGroupConfigurationProjectConfigsTypeConverter))] + public partial interface IGitLabGroupConfigurationProjectConfigs + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitLabGroupConfigurationProjectConfigs.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/GitLabGroupConfigurationProjectConfigs.TypeConverter.cs new file mode 100644 index 000000000000..5d7f0b2d7a55 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitLabGroupConfigurationProjectConfigs.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class GitLabGroupConfigurationProjectConfigsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupConfigurationProjectConfigs ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupConfigurationProjectConfigs).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return GitLabGroupConfigurationProjectConfigs.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return GitLabGroupConfigurationProjectConfigs.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return GitLabGroupConfigurationProjectConfigs.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitLabGroupConfigurationProjectConfigs.cs b/src/Security/Security.Autorest/generated/api/Models/GitLabGroupConfigurationProjectConfigs.cs new file mode 100644 index 000000000000..c0ae509a7a92 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitLabGroupConfigurationProjectConfigs.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// + /// GitLab Project Inventory Configuration. + /// Dictionary of GitLab fully-qualified project name to desired project configuration. + /// If AutoDiscovery is Enabled, this field should be null or empty. + /// + public partial class GitLabGroupConfigurationProjectConfigs : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupConfigurationProjectConfigs, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupConfigurationProjectConfigsInternal + { + + /// Creates an new instance. + public GitLabGroupConfigurationProjectConfigs() + { + + } + } + /// GitLab Project Inventory Configuration. + /// Dictionary of GitLab fully-qualified project name to desired project configuration. + /// If AutoDiscovery is Enabled, this field should be null or empty. + public partial interface IGitLabGroupConfigurationProjectConfigs : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray + { + + } + /// GitLab Project Inventory Configuration. + /// Dictionary of GitLab fully-qualified project name to desired project configuration. + /// If AutoDiscovery is Enabled, this field should be null or empty. + internal partial interface IGitLabGroupConfigurationProjectConfigsInternal + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitLabGroupConfigurationProjectConfigs.dictionary.cs b/src/Security/Security.Autorest/generated/api/Models/GitLabGroupConfigurationProjectConfigs.dictionary.cs new file mode 100644 index 000000000000..ba4e5fa8ce46 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitLabGroupConfigurationProjectConfigs.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + public partial class GitLabGroupConfigurationProjectConfigs : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IBaseResourceConfiguration this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IBaseResourceConfiguration value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IBaseResourceConfiguration value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitLabGroupConfigurationProjectConfigs source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitLabGroupConfigurationProjectConfigs.json.cs b/src/Security/Security.Autorest/generated/api/Models/GitLabGroupConfigurationProjectConfigs.json.cs new file mode 100644 index 000000000000..1af3cb525fcd --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitLabGroupConfigurationProjectConfigs.json.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// + /// GitLab Project Inventory Configuration. + /// Dictionary of GitLab fully-qualified project name to desired project configuration. + /// If AutoDiscovery is Enabled, this field should be null or empty. + /// + public partial class GitLabGroupConfigurationProjectConfigs + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupConfigurationProjectConfigs. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupConfigurationProjectConfigs. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupConfigurationProjectConfigs FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new GitLabGroupConfigurationProjectConfigs(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + /// + internal GitLabGroupConfigurationProjectConfigs(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray)this).AdditionalProperties, (j) => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.BaseResourceConfiguration.FromJson(j) ,exclusions ); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitLabGroupListResponse.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/GitLabGroupListResponse.PowerShell.cs new file mode 100644 index 000000000000..af78b159107f --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitLabGroupListResponse.PowerShell.cs @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// List of RP resources which supports pagination. + [System.ComponentModel.TypeConverter(typeof(GitLabGroupListResponseTypeConverter))] + public partial class GitLabGroupListResponse + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupListResponse DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new GitLabGroupListResponse(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupListResponse DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new GitLabGroupListResponse(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupListResponse FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal GitLabGroupListResponse(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupListResponseInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupListResponseInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitLabGroupTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupListResponseInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupListResponseInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal GitLabGroupListResponse(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupListResponseInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupListResponseInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitLabGroupTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupListResponseInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupListResponseInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// List of RP resources which supports pagination. + [System.ComponentModel.TypeConverter(typeof(GitLabGroupListResponseTypeConverter))] + public partial interface IGitLabGroupListResponse + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitLabGroupListResponse.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/GitLabGroupListResponse.TypeConverter.cs new file mode 100644 index 000000000000..76424ffde4cc --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitLabGroupListResponse.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class GitLabGroupListResponseTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupListResponse ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupListResponse).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return GitLabGroupListResponse.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return GitLabGroupListResponse.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return GitLabGroupListResponse.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitLabGroupListResponse.cs b/src/Security/Security.Autorest/generated/api/Models/GitLabGroupListResponse.cs new file mode 100644 index 000000000000..c298f8fd66da --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitLabGroupListResponse.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// List of RP resources which supports pagination. + public partial class GitLabGroupListResponse : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupListResponse, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupListResponseInternal + { + + /// Backing field for property. + private string _nextLink; + + /// Gets or sets next link to scroll over the results. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private System.Collections.Generic.List _value; + + /// Gets or sets list of resources. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public System.Collections.Generic.List Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public GitLabGroupListResponse() + { + + } + } + /// List of RP resources which supports pagination. + public partial interface IGitLabGroupListResponse : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// Gets or sets next link to scroll over the results. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Gets or sets next link to scroll over the results.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// Gets or sets list of resources. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Gets or sets list of resources.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroup) })] + System.Collections.Generic.List Value { get; set; } + + } + /// List of RP resources which supports pagination. + internal partial interface IGitLabGroupListResponseInternal + + { + /// Gets or sets next link to scroll over the results. + string NextLink { get; set; } + /// Gets or sets list of resources. + System.Collections.Generic.List Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitLabGroupListResponse.json.cs b/src/Security/Security.Autorest/generated/api/Models/GitLabGroupListResponse.json.cs new file mode 100644 index 000000000000..ecd497331b07 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitLabGroupListResponse.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// List of RP resources which supports pagination. + public partial class GitLabGroupListResponse + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupListResponse. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupListResponse. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupListResponse FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new GitLabGroupListResponse(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal GitLabGroupListResponse(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroup) (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitLabGroup.FromJson(__u) )) ))() : null : _value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)_nextLink;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitLabGroupProperties.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/GitLabGroupProperties.PowerShell.cs new file mode 100644 index 000000000000..7156bbd2f98c --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitLabGroupProperties.PowerShell.cs @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// GitLab Group properties. + [System.ComponentModel.TypeConverter(typeof(GitLabGroupPropertiesTypeConverter))] + public partial class GitLabGroupProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new GitLabGroupProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new GitLabGroupProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal GitLabGroupProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProvisioningStatusMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupPropertiesInternal)this).ProvisioningStatusMessage = (string) content.GetValueForProperty("ProvisioningStatusMessage",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupPropertiesInternal)this).ProvisioningStatusMessage, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningStatusUpdateTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupPropertiesInternal)this).ProvisioningStatusUpdateTimeUtc = (global::System.DateTime?) content.GetValueForProperty("ProvisioningStatusUpdateTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupPropertiesInternal)this).ProvisioningStatusUpdateTimeUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupPropertiesInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupPropertiesInternal)this).ProvisioningState, global::System.Convert.ToString); + } + if (content.Contains("FullyQualifiedName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupPropertiesInternal)this).FullyQualifiedName = (string) content.GetValueForProperty("FullyQualifiedName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupPropertiesInternal)this).FullyQualifiedName, global::System.Convert.ToString); + } + if (content.Contains("FullyQualifiedFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupPropertiesInternal)this).FullyQualifiedFriendlyName = (string) content.GetValueForProperty("FullyQualifiedFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupPropertiesInternal)this).FullyQualifiedFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("Url")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupPropertiesInternal)this).Url = (string) content.GetValueForProperty("Url",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupPropertiesInternal)this).Url, global::System.Convert.ToString); + } + if (content.Contains("OnboardingState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupPropertiesInternal)this).OnboardingState = (string) content.GetValueForProperty("OnboardingState",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupPropertiesInternal)this).OnboardingState, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal GitLabGroupProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProvisioningStatusMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupPropertiesInternal)this).ProvisioningStatusMessage = (string) content.GetValueForProperty("ProvisioningStatusMessage",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupPropertiesInternal)this).ProvisioningStatusMessage, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningStatusUpdateTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupPropertiesInternal)this).ProvisioningStatusUpdateTimeUtc = (global::System.DateTime?) content.GetValueForProperty("ProvisioningStatusUpdateTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupPropertiesInternal)this).ProvisioningStatusUpdateTimeUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupPropertiesInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupPropertiesInternal)this).ProvisioningState, global::System.Convert.ToString); + } + if (content.Contains("FullyQualifiedName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupPropertiesInternal)this).FullyQualifiedName = (string) content.GetValueForProperty("FullyQualifiedName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupPropertiesInternal)this).FullyQualifiedName, global::System.Convert.ToString); + } + if (content.Contains("FullyQualifiedFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupPropertiesInternal)this).FullyQualifiedFriendlyName = (string) content.GetValueForProperty("FullyQualifiedFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupPropertiesInternal)this).FullyQualifiedFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("Url")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupPropertiesInternal)this).Url = (string) content.GetValueForProperty("Url",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupPropertiesInternal)this).Url, global::System.Convert.ToString); + } + if (content.Contains("OnboardingState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupPropertiesInternal)this).OnboardingState = (string) content.GetValueForProperty("OnboardingState",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupPropertiesInternal)this).OnboardingState, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// GitLab Group properties. + [System.ComponentModel.TypeConverter(typeof(GitLabGroupPropertiesTypeConverter))] + public partial interface IGitLabGroupProperties + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitLabGroupProperties.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/GitLabGroupProperties.TypeConverter.cs new file mode 100644 index 000000000000..e567288370e8 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitLabGroupProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class GitLabGroupPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return GitLabGroupProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return GitLabGroupProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return GitLabGroupProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitLabGroupProperties.cs b/src/Security/Security.Autorest/generated/api/Models/GitLabGroupProperties.cs new file mode 100644 index 000000000000..7e4ae91f4bd3 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitLabGroupProperties.cs @@ -0,0 +1,288 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// GitLab Group properties. + public partial class GitLabGroupProperties : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupProperties, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupPropertiesInternal + { + + /// Backing field for property. + private string _fullyQualifiedFriendlyName; + + /// + /// Gets or sets the human readable fully-qualified name of the Group object. + /// + /// This contains the entire namespace hierarchy as seen on GitLab UI where namespaces are separated by the '/' character. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string FullyQualifiedFriendlyName { get => this._fullyQualifiedFriendlyName; } + + /// Backing field for property. + private string _fullyQualifiedName; + + /// + /// Gets or sets the fully-qualified name of the Group object. + /// + /// This contains the entire namespace hierarchy where namespaces are separated by the '$' character. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string FullyQualifiedName { get => this._fullyQualifiedName; } + + /// Internal Acessors for FullyQualifiedFriendlyName + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupPropertiesInternal.FullyQualifiedFriendlyName { get => this._fullyQualifiedFriendlyName; set { {_fullyQualifiedFriendlyName = value;} } } + + /// Internal Acessors for FullyQualifiedName + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupPropertiesInternal.FullyQualifiedName { get => this._fullyQualifiedName; set { {_fullyQualifiedName = value;} } } + + /// Internal Acessors for ProvisioningStatusMessage + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupPropertiesInternal.ProvisioningStatusMessage { get => this._provisioningStatusMessage; set { {_provisioningStatusMessage = value;} } } + + /// Internal Acessors for ProvisioningStatusUpdateTimeUtc + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupPropertiesInternal.ProvisioningStatusUpdateTimeUtc { get => this._provisioningStatusUpdateTimeUtc; set { {_provisioningStatusUpdateTimeUtc = value;} } } + + /// Internal Acessors for Url + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupPropertiesInternal.Url { get => this._url; set { {_url = value;} } } + + /// Backing field for property. + private string _onboardingState; + + /// + /// Details about resource onboarding status across all connectors. + /// + /// OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to + /// top-level resources. + /// Onboarded - this resource has already been onboarded by the specified connector. + /// NotOnboarded - this resource has not been onboarded to any connector. + /// NotApplicable - the onboarding state is not applicable to the current endpoint. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string OnboardingState { get => this._onboardingState; set => this._onboardingState = value; } + + /// Backing field for property. + private string _provisioningState; + + /// + /// The provisioning state of the resource. + /// + /// Pending - Provisioning pending. + /// Failed - Provisioning failed. + /// Succeeded - Successful provisioning. + /// Canceled - Provisioning canceled. + /// PendingDeletion - Deletion pending. + /// DeletionSuccess - Deletion successful. + /// DeletionFailure - Deletion failure. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string ProvisioningState { get => this._provisioningState; set => this._provisioningState = value; } + + /// Backing field for property. + private string _provisioningStatusMessage; + + /// Gets or sets resource status message. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string ProvisioningStatusMessage { get => this._provisioningStatusMessage; } + + /// Backing field for property. + private global::System.DateTime? _provisioningStatusUpdateTimeUtc; + + /// Gets or sets time when resource was last checked. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public global::System.DateTime? ProvisioningStatusUpdateTimeUtc { get => this._provisioningStatusUpdateTimeUtc; } + + /// Backing field for property. + private string _url; + + /// Gets or sets the url of the GitLab Group. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string Url { get => this._url; } + + /// Creates an new instance. + public GitLabGroupProperties() + { + + } + } + /// GitLab Group properties. + public partial interface IGitLabGroupProperties : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// + /// Gets or sets the human readable fully-qualified name of the Group object. + /// + /// This contains the entire namespace hierarchy as seen on GitLab UI where namespaces are separated by the '/' character. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets the human readable fully-qualified name of the Group object. + + This contains the entire namespace hierarchy as seen on GitLab UI where namespaces are separated by the '/' character.", + SerializedName = @"fullyQualifiedFriendlyName", + PossibleTypes = new [] { typeof(string) })] + string FullyQualifiedFriendlyName { get; } + /// + /// Gets or sets the fully-qualified name of the Group object. + /// + /// This contains the entire namespace hierarchy where namespaces are separated by the '$' character. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets the fully-qualified name of the Group object. + + This contains the entire namespace hierarchy where namespaces are separated by the '$' character.", + SerializedName = @"fullyQualifiedName", + PossibleTypes = new [] { typeof(string) })] + string FullyQualifiedName { get; } + /// + /// Details about resource onboarding status across all connectors. + /// + /// OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to + /// top-level resources. + /// Onboarded - this resource has already been onboarded by the specified connector. + /// NotOnboarded - this resource has not been onboarded to any connector. + /// NotApplicable - the onboarding state is not applicable to the current endpoint. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Details about resource onboarding status across all connectors. + + OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to top-level resources. + Onboarded - this resource has already been onboarded by the specified connector. + NotOnboarded - this resource has not been onboarded to any connector. + NotApplicable - the onboarding state is not applicable to the current endpoint.", + SerializedName = @"onboardingState", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("NotApplicable", "OnboardedByOtherConnector", "Onboarded", "NotOnboarded")] + string OnboardingState { get; set; } + /// + /// The provisioning state of the resource. + /// + /// Pending - Provisioning pending. + /// Failed - Provisioning failed. + /// Succeeded - Successful provisioning. + /// Canceled - Provisioning canceled. + /// PendingDeletion - Deletion pending. + /// DeletionSuccess - Deletion successful. + /// DeletionFailure - Deletion failure. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The provisioning state of the resource. + + Pending - Provisioning pending. + Failed - Provisioning failed. + Succeeded - Successful provisioning. + Canceled - Provisioning canceled. + PendingDeletion - Deletion pending. + DeletionSuccess - Deletion successful. + DeletionFailure - Deletion failure.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Succeeded", "Failed", "Canceled", "Pending", "PendingDeletion", "DeletionSuccess", "DeletionFailure")] + string ProvisioningState { get; set; } + /// Gets or sets resource status message. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets resource status message.", + SerializedName = @"provisioningStatusMessage", + PossibleTypes = new [] { typeof(string) })] + string ProvisioningStatusMessage { get; } + /// Gets or sets time when resource was last checked. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets time when resource was last checked.", + SerializedName = @"provisioningStatusUpdateTimeUtc", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? ProvisioningStatusUpdateTimeUtc { get; } + /// Gets or sets the url of the GitLab Group. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets the url of the GitLab Group.", + SerializedName = @"url", + PossibleTypes = new [] { typeof(string) })] + string Url { get; } + + } + /// GitLab Group properties. + internal partial interface IGitLabGroupPropertiesInternal + + { + /// + /// Gets or sets the human readable fully-qualified name of the Group object. + /// + /// This contains the entire namespace hierarchy as seen on GitLab UI where namespaces are separated by the '/' character. + /// + string FullyQualifiedFriendlyName { get; set; } + /// + /// Gets or sets the fully-qualified name of the Group object. + /// + /// This contains the entire namespace hierarchy where namespaces are separated by the '$' character. + /// + string FullyQualifiedName { get; set; } + /// + /// Details about resource onboarding status across all connectors. + /// + /// OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to + /// top-level resources. + /// Onboarded - this resource has already been onboarded by the specified connector. + /// NotOnboarded - this resource has not been onboarded to any connector. + /// NotApplicable - the onboarding state is not applicable to the current endpoint. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("NotApplicable", "OnboardedByOtherConnector", "Onboarded", "NotOnboarded")] + string OnboardingState { get; set; } + /// + /// The provisioning state of the resource. + /// + /// Pending - Provisioning pending. + /// Failed - Provisioning failed. + /// Succeeded - Successful provisioning. + /// Canceled - Provisioning canceled. + /// PendingDeletion - Deletion pending. + /// DeletionSuccess - Deletion successful. + /// DeletionFailure - Deletion failure. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Succeeded", "Failed", "Canceled", "Pending", "PendingDeletion", "DeletionSuccess", "DeletionFailure")] + string ProvisioningState { get; set; } + /// Gets or sets resource status message. + string ProvisioningStatusMessage { get; set; } + /// Gets or sets time when resource was last checked. + global::System.DateTime? ProvisioningStatusUpdateTimeUtc { get; set; } + /// Gets or sets the url of the GitLab Group. + string Url { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitLabGroupProperties.json.cs b/src/Security/Security.Autorest/generated/api/Models/GitLabGroupProperties.json.cs new file mode 100644 index 000000000000..3770309fd441 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitLabGroupProperties.json.cs @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// GitLab Group properties. + public partial class GitLabGroupProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new GitLabGroupProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal GitLabGroupProperties(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_provisioningStatusMessage = If( json?.PropertyT("provisioningStatusMessage"), out var __jsonProvisioningStatusMessage) ? (string)__jsonProvisioningStatusMessage : (string)_provisioningStatusMessage;} + {_provisioningStatusUpdateTimeUtc = If( json?.PropertyT("provisioningStatusUpdateTimeUtc"), out var __jsonProvisioningStatusUpdateTimeUtc) ? global::System.DateTime.TryParse((string)__jsonProvisioningStatusUpdateTimeUtc, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonProvisioningStatusUpdateTimeUtcValue) ? __jsonProvisioningStatusUpdateTimeUtcValue : _provisioningStatusUpdateTimeUtc : _provisioningStatusUpdateTimeUtc;} + {_provisioningState = If( json?.PropertyT("provisioningState"), out var __jsonProvisioningState) ? (string)__jsonProvisioningState : (string)_provisioningState;} + {_fullyQualifiedName = If( json?.PropertyT("fullyQualifiedName"), out var __jsonFullyQualifiedName) ? (string)__jsonFullyQualifiedName : (string)_fullyQualifiedName;} + {_fullyQualifiedFriendlyName = If( json?.PropertyT("fullyQualifiedFriendlyName"), out var __jsonFullyQualifiedFriendlyName) ? (string)__jsonFullyQualifiedFriendlyName : (string)_fullyQualifiedFriendlyName;} + {_url = If( json?.PropertyT("url"), out var __jsonUrl) ? (string)__jsonUrl : (string)_url;} + {_onboardingState = If( json?.PropertyT("onboardingState"), out var __jsonOnboardingState) ? (string)__jsonOnboardingState : (string)_onboardingState;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._provisioningStatusMessage)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._provisioningStatusMessage.ToString()) : null, "provisioningStatusMessage" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._provisioningStatusUpdateTimeUtc ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._provisioningStatusUpdateTimeUtc?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "provisioningStatusUpdateTimeUtc" ,container.Add ); + } + AddIf( null != (((object)this._provisioningState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._provisioningState.ToString()) : null, "provisioningState" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._fullyQualifiedName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._fullyQualifiedName.ToString()) : null, "fullyQualifiedName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._fullyQualifiedFriendlyName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._fullyQualifiedFriendlyName.ToString()) : null, "fullyQualifiedFriendlyName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._url)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._url.ToString()) : null, "url" ,container.Add ); + } + AddIf( null != (((object)this._onboardingState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._onboardingState.ToString()) : null, "onboardingState" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitLabProject.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/GitLabProject.PowerShell.cs new file mode 100644 index 000000000000..c2631a20b06a --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitLabProject.PowerShell.cs @@ -0,0 +1,308 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// GitLab Project resource. + [System.ComponentModel.TypeConverter(typeof(GitLabProjectTypeConverter))] + public partial class GitLabProject + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProject DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new GitLabProject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProject DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new GitLabProject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProject FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal GitLabProject(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitLabProjectPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("OnboardingState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal)this).OnboardingState = (string) content.GetValueForProperty("OnboardingState",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal)this).OnboardingState, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ProvisioningStatusMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal)this).ProvisioningStatusMessage = (string) content.GetValueForProperty("ProvisioningStatusMessage",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal)this).ProvisioningStatusMessage, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningStatusUpdateTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal)this).ProvisioningStatusUpdateTimeUtc = (global::System.DateTime?) content.GetValueForProperty("ProvisioningStatusUpdateTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal)this).ProvisioningStatusUpdateTimeUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal)this).ProvisioningState, global::System.Convert.ToString); + } + if (content.Contains("FullyQualifiedName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal)this).FullyQualifiedName = (string) content.GetValueForProperty("FullyQualifiedName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal)this).FullyQualifiedName, global::System.Convert.ToString); + } + if (content.Contains("FullyQualifiedFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal)this).FullyQualifiedFriendlyName = (string) content.GetValueForProperty("FullyQualifiedFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal)this).FullyQualifiedFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("FullyQualifiedParentGroupName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal)this).FullyQualifiedParentGroupName = (string) content.GetValueForProperty("FullyQualifiedParentGroupName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal)this).FullyQualifiedParentGroupName, global::System.Convert.ToString); + } + if (content.Contains("Url")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal)this).Url = (string) content.GetValueForProperty("Url",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal)this).Url, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal GitLabProject(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitLabProjectPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("OnboardingState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal)this).OnboardingState = (string) content.GetValueForProperty("OnboardingState",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal)this).OnboardingState, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ProvisioningStatusMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal)this).ProvisioningStatusMessage = (string) content.GetValueForProperty("ProvisioningStatusMessage",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal)this).ProvisioningStatusMessage, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningStatusUpdateTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal)this).ProvisioningStatusUpdateTimeUtc = (global::System.DateTime?) content.GetValueForProperty("ProvisioningStatusUpdateTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal)this).ProvisioningStatusUpdateTimeUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal)this).ProvisioningState, global::System.Convert.ToString); + } + if (content.Contains("FullyQualifiedName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal)this).FullyQualifiedName = (string) content.GetValueForProperty("FullyQualifiedName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal)this).FullyQualifiedName, global::System.Convert.ToString); + } + if (content.Contains("FullyQualifiedFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal)this).FullyQualifiedFriendlyName = (string) content.GetValueForProperty("FullyQualifiedFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal)this).FullyQualifiedFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("FullyQualifiedParentGroupName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal)this).FullyQualifiedParentGroupName = (string) content.GetValueForProperty("FullyQualifiedParentGroupName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal)this).FullyQualifiedParentGroupName, global::System.Convert.ToString); + } + if (content.Contains("Url")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal)this).Url = (string) content.GetValueForProperty("Url",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal)this).Url, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// GitLab Project resource. + [System.ComponentModel.TypeConverter(typeof(GitLabProjectTypeConverter))] + public partial interface IGitLabProject + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitLabProject.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/GitLabProject.TypeConverter.cs new file mode 100644 index 000000000000..c86c4eb459c7 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitLabProject.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class GitLabProjectTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProject ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProject).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return GitLabProject.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return GitLabProject.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return GitLabProject.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitLabProject.cs b/src/Security/Security.Autorest/generated/api/Models/GitLabProject.cs new file mode 100644 index 000000000000..acbae4410f7b --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitLabProject.cs @@ -0,0 +1,478 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// GitLab Project resource. + public partial class GitLabProject : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProject, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IProxyResource __proxyResource = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ProxyResource(); + + /// + /// Gets or sets the human readable fully-qualified name of the Project object. + /// + /// This contains the entire namespace hierarchy as seen on GitLab UI where entities are separated by the '/' character. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string FullyQualifiedFriendlyName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectPropertiesInternal)Property).FullyQualifiedFriendlyName; } + + /// + /// Gets or sets the fully-qualified name of the project object. + /// + /// This contains the entire hierarchy where entities are separated by the '$' character. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string FullyQualifiedName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectPropertiesInternal)Property).FullyQualifiedName; } + + /// + /// Gets or sets the fully-qualified name of the project's parent group object. + /// + /// This contains the entire hierarchy where namespaces are separated by the '$' character. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string FullyQualifiedParentGroupName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectPropertiesInternal)Property).FullyQualifiedParentGroupName; } + + /// + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Id; } + + /// Internal Acessors for FullyQualifiedFriendlyName + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal.FullyQualifiedFriendlyName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectPropertiesInternal)Property).FullyQualifiedFriendlyName; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectPropertiesInternal)Property).FullyQualifiedFriendlyName = value; } + + /// Internal Acessors for FullyQualifiedName + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal.FullyQualifiedName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectPropertiesInternal)Property).FullyQualifiedName; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectPropertiesInternal)Property).FullyQualifiedName = value; } + + /// Internal Acessors for FullyQualifiedParentGroupName + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal.FullyQualifiedParentGroupName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectPropertiesInternal)Property).FullyQualifiedParentGroupName; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectPropertiesInternal)Property).FullyQualifiedParentGroupName = value; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectProperties Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitLabProjectProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProvisioningStatusMessage + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal.ProvisioningStatusMessage { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectPropertiesInternal)Property).ProvisioningStatusMessage; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectPropertiesInternal)Property).ProvisioningStatusMessage = value; } + + /// Internal Acessors for ProvisioningStatusUpdateTimeUtc + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal.ProvisioningStatusUpdateTimeUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectPropertiesInternal)Property).ProvisioningStatusUpdateTimeUtc; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectPropertiesInternal)Property).ProvisioningStatusUpdateTimeUtc = value; } + + /// Internal Acessors for SystemData + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemData Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal.SystemData { get => (this._systemData = this._systemData ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SystemData()); set { {_systemData = value;} } } + + /// Internal Acessors for Url + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectInternal.Url { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectPropertiesInternal)Property).Url; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectPropertiesInternal)Property).Url = value; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Name = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Type = value; } + + /// The name of the resource + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Name; } + + /// + /// Details about resource onboarding status across all connectors. + /// + /// OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to + /// top-level resources. + /// Onboarded - this resource has already been onboarded by the specified connector. + /// NotOnboarded - this resource has not been onboarded to any connector. + /// NotApplicable - the onboarding state is not applicable to the current endpoint. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string OnboardingState { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectPropertiesInternal)Property).OnboardingState; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectPropertiesInternal)Property).OnboardingState = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectProperties _property; + + /// GitLab Project properties. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitLabProjectProperties()); set => this._property = value; } + + /// + /// The provisioning state of the resource. + /// + /// Pending - Provisioning pending. + /// Failed - Provisioning failed. + /// Succeeded - Successful provisioning. + /// Canceled - Provisioning canceled. + /// PendingDeletion - Deletion pending. + /// DeletionSuccess - Deletion successful. + /// DeletionFailure - Deletion failure. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectPropertiesInternal)Property).ProvisioningState; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectPropertiesInternal)Property).ProvisioningState = value ?? null; } + + /// Gets or sets resource status message. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string ProvisioningStatusMessage { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectPropertiesInternal)Property).ProvisioningStatusMessage; } + + /// Gets or sets time when resource was last checked. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public global::System.DateTime? ProvisioningStatusUpdateTimeUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectPropertiesInternal)Property).ProvisioningStatusUpdateTimeUtc; } + + /// Gets the resource group name + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string ResourceGroupName { get => (new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Success ? new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Groups["resourceGroupName"].Value : null); } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemData _systemData; + + /// Metadata pertaining to creation and last modification of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemData SystemData { get => (this._systemData = this._systemData ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SystemData()); } + + /// The timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).CreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).CreatedAt = value ?? default(global::System.DateTime); } + + /// The identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).CreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).CreatedBy = value ?? null; } + + /// The type of identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).CreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).CreatedByType = value ?? null; } + + /// The timestamp of resource last modification (UTC) + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).LastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).LastModifiedAt = value ?? default(global::System.DateTime); } + + /// The identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).LastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).LastModifiedBy = value ?? null; } + + /// The type of identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).LastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).LastModifiedByType = value ?? null; } + + /// + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__proxyResource).Type; } + + /// Gets or sets the url of the GitLab Project. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string Url { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectPropertiesInternal)Property).Url; } + + /// Creates an new instance. + public GitLabProject() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__proxyResource), __proxyResource); + await eventListener.AssertObjectIsValid(nameof(__proxyResource), __proxyResource); + } + } + /// GitLab Project resource. + public partial interface IGitLabProject : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IProxyResource + { + /// + /// Gets or sets the human readable fully-qualified name of the Project object. + /// + /// This contains the entire namespace hierarchy as seen on GitLab UI where entities are separated by the '/' character. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets the human readable fully-qualified name of the Project object. + + This contains the entire namespace hierarchy as seen on GitLab UI where entities are separated by the '/' character.", + SerializedName = @"fullyQualifiedFriendlyName", + PossibleTypes = new [] { typeof(string) })] + string FullyQualifiedFriendlyName { get; } + /// + /// Gets or sets the fully-qualified name of the project object. + /// + /// This contains the entire hierarchy where entities are separated by the '$' character. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets the fully-qualified name of the project object. + + This contains the entire hierarchy where entities are separated by the '$' character.", + SerializedName = @"fullyQualifiedName", + PossibleTypes = new [] { typeof(string) })] + string FullyQualifiedName { get; } + /// + /// Gets or sets the fully-qualified name of the project's parent group object. + /// + /// This contains the entire hierarchy where namespaces are separated by the '$' character. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets the fully-qualified name of the project's parent group object. + + This contains the entire hierarchy where namespaces are separated by the '$' character.", + SerializedName = @"fullyQualifiedParentGroupName", + PossibleTypes = new [] { typeof(string) })] + string FullyQualifiedParentGroupName { get; } + /// + /// Details about resource onboarding status across all connectors. + /// + /// OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to + /// top-level resources. + /// Onboarded - this resource has already been onboarded by the specified connector. + /// NotOnboarded - this resource has not been onboarded to any connector. + /// NotApplicable - the onboarding state is not applicable to the current endpoint. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Details about resource onboarding status across all connectors. + + OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to top-level resources. + Onboarded - this resource has already been onboarded by the specified connector. + NotOnboarded - this resource has not been onboarded to any connector. + NotApplicable - the onboarding state is not applicable to the current endpoint.", + SerializedName = @"onboardingState", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("NotApplicable", "OnboardedByOtherConnector", "Onboarded", "NotOnboarded")] + string OnboardingState { get; set; } + /// + /// The provisioning state of the resource. + /// + /// Pending - Provisioning pending. + /// Failed - Provisioning failed. + /// Succeeded - Successful provisioning. + /// Canceled - Provisioning canceled. + /// PendingDeletion - Deletion pending. + /// DeletionSuccess - Deletion successful. + /// DeletionFailure - Deletion failure. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The provisioning state of the resource. + + Pending - Provisioning pending. + Failed - Provisioning failed. + Succeeded - Successful provisioning. + Canceled - Provisioning canceled. + PendingDeletion - Deletion pending. + DeletionSuccess - Deletion successful. + DeletionFailure - Deletion failure.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Succeeded", "Failed", "Canceled", "Pending", "PendingDeletion", "DeletionSuccess", "DeletionFailure")] + string ProvisioningState { get; set; } + /// Gets or sets resource status message. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets resource status message.", + SerializedName = @"provisioningStatusMessage", + PossibleTypes = new [] { typeof(string) })] + string ProvisioningStatusMessage { get; } + /// Gets or sets time when resource was last checked. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets time when resource was last checked.", + SerializedName = @"provisioningStatusUpdateTimeUtc", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? ProvisioningStatusUpdateTimeUtc { get; } + /// The timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The timestamp of resource creation (UTC).", + SerializedName = @"createdAt", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? SystemDataCreatedAt { get; } + /// The identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The identity that created the resource.", + SerializedName = @"createdBy", + PossibleTypes = new [] { typeof(string) })] + string SystemDataCreatedBy { get; } + /// The type of identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The type of identity that created the resource.", + SerializedName = @"createdByType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string SystemDataCreatedByType { get; } + /// The timestamp of resource last modification (UTC) + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The timestamp of resource last modification (UTC)", + SerializedName = @"lastModifiedAt", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? SystemDataLastModifiedAt { get; } + /// The identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The identity that last modified the resource.", + SerializedName = @"lastModifiedBy", + PossibleTypes = new [] { typeof(string) })] + string SystemDataLastModifiedBy { get; } + /// The type of identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The type of identity that last modified the resource.", + SerializedName = @"lastModifiedByType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string SystemDataLastModifiedByType { get; } + /// Gets or sets the url of the GitLab Project. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets the url of the GitLab Project.", + SerializedName = @"url", + PossibleTypes = new [] { typeof(string) })] + string Url { get; } + + } + /// GitLab Project resource. + internal partial interface IGitLabProjectInternal : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IProxyResourceInternal + { + /// + /// Gets or sets the human readable fully-qualified name of the Project object. + /// + /// This contains the entire namespace hierarchy as seen on GitLab UI where entities are separated by the '/' character. + /// + string FullyQualifiedFriendlyName { get; set; } + /// + /// Gets or sets the fully-qualified name of the project object. + /// + /// This contains the entire hierarchy where entities are separated by the '$' character. + /// + string FullyQualifiedName { get; set; } + /// + /// Gets or sets the fully-qualified name of the project's parent group object. + /// + /// This contains the entire hierarchy where namespaces are separated by the '$' character. + /// + string FullyQualifiedParentGroupName { get; set; } + /// + /// Details about resource onboarding status across all connectors. + /// + /// OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to + /// top-level resources. + /// Onboarded - this resource has already been onboarded by the specified connector. + /// NotOnboarded - this resource has not been onboarded to any connector. + /// NotApplicable - the onboarding state is not applicable to the current endpoint. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("NotApplicable", "OnboardedByOtherConnector", "Onboarded", "NotOnboarded")] + string OnboardingState { get; set; } + /// GitLab Project properties. + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectProperties Property { get; set; } + /// + /// The provisioning state of the resource. + /// + /// Pending - Provisioning pending. + /// Failed - Provisioning failed. + /// Succeeded - Successful provisioning. + /// Canceled - Provisioning canceled. + /// PendingDeletion - Deletion pending. + /// DeletionSuccess - Deletion successful. + /// DeletionFailure - Deletion failure. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Succeeded", "Failed", "Canceled", "Pending", "PendingDeletion", "DeletionSuccess", "DeletionFailure")] + string ProvisioningState { get; set; } + /// Gets or sets resource status message. + string ProvisioningStatusMessage { get; set; } + /// Gets or sets time when resource was last checked. + global::System.DateTime? ProvisioningStatusUpdateTimeUtc { get; set; } + /// Metadata pertaining to creation and last modification of the resource. + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemData SystemData { get; set; } + /// The timestamp of resource creation (UTC). + global::System.DateTime? SystemDataCreatedAt { get; set; } + /// The identity that created the resource. + string SystemDataCreatedBy { get; set; } + /// The type of identity that created the resource. + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string SystemDataCreatedByType { get; set; } + /// The timestamp of resource last modification (UTC) + global::System.DateTime? SystemDataLastModifiedAt { get; set; } + /// The identity that last modified the resource. + string SystemDataLastModifiedBy { get; set; } + /// The type of identity that last modified the resource. + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string SystemDataLastModifiedByType { get; set; } + /// Gets or sets the url of the GitLab Project. + string Url { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitLabProject.json.cs b/src/Security/Security.Autorest/generated/api/Models/GitLabProject.json.cs new file mode 100644 index 000000000000..d26905c148e5 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitLabProject.json.cs @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// GitLab Project resource. + public partial class GitLabProject + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProject. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProject. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProject FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new GitLabProject(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal GitLabProject(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __proxyResource = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ProxyResource(json); + {_systemData = If( json?.PropertyT("systemData"), out var __jsonSystemData) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SystemData.FromJson(__jsonSystemData) : _systemData;} + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitLabProjectProperties.FromJson(__jsonProperties) : _property;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __proxyResource?.ToJson(container, serializationMode); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._systemData ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._systemData.ToJson(null,serializationMode) : null, "systemData" ,container.Add ); + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitLabProjectListResponse.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/GitLabProjectListResponse.PowerShell.cs new file mode 100644 index 000000000000..0dd45dc27711 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitLabProjectListResponse.PowerShell.cs @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// List of RP resources which supports pagination. + [System.ComponentModel.TypeConverter(typeof(GitLabProjectListResponseTypeConverter))] + public partial class GitLabProjectListResponse + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectListResponse DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new GitLabProjectListResponse(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectListResponse DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new GitLabProjectListResponse(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectListResponse FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal GitLabProjectListResponse(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectListResponseInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectListResponseInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitLabProjectTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectListResponseInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectListResponseInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal GitLabProjectListResponse(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectListResponseInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectListResponseInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitLabProjectTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectListResponseInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectListResponseInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// List of RP resources which supports pagination. + [System.ComponentModel.TypeConverter(typeof(GitLabProjectListResponseTypeConverter))] + public partial interface IGitLabProjectListResponse + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitLabProjectListResponse.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/GitLabProjectListResponse.TypeConverter.cs new file mode 100644 index 000000000000..723bb3ec2be7 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitLabProjectListResponse.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class GitLabProjectListResponseTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectListResponse ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectListResponse).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return GitLabProjectListResponse.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return GitLabProjectListResponse.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return GitLabProjectListResponse.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitLabProjectListResponse.cs b/src/Security/Security.Autorest/generated/api/Models/GitLabProjectListResponse.cs new file mode 100644 index 000000000000..189f7aa23a7e --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitLabProjectListResponse.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// List of RP resources which supports pagination. + public partial class GitLabProjectListResponse : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectListResponse, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectListResponseInternal + { + + /// Backing field for property. + private string _nextLink; + + /// Gets or sets next link to scroll over the results. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private System.Collections.Generic.List _value; + + /// Gets or sets list of resources. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public System.Collections.Generic.List Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public GitLabProjectListResponse() + { + + } + } + /// List of RP resources which supports pagination. + public partial interface IGitLabProjectListResponse : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// Gets or sets next link to scroll over the results. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Gets or sets next link to scroll over the results.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// Gets or sets list of resources. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Gets or sets list of resources.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProject) })] + System.Collections.Generic.List Value { get; set; } + + } + /// List of RP resources which supports pagination. + internal partial interface IGitLabProjectListResponseInternal + + { + /// Gets or sets next link to scroll over the results. + string NextLink { get; set; } + /// Gets or sets list of resources. + System.Collections.Generic.List Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitLabProjectListResponse.json.cs b/src/Security/Security.Autorest/generated/api/Models/GitLabProjectListResponse.json.cs new file mode 100644 index 000000000000..38283ca5f460 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitLabProjectListResponse.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// List of RP resources which supports pagination. + public partial class GitLabProjectListResponse + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectListResponse. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectListResponse. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectListResponse FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new GitLabProjectListResponse(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal GitLabProjectListResponse(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProject) (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitLabProject.FromJson(__u) )) ))() : null : _value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)_nextLink;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitLabProjectProperties.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/GitLabProjectProperties.PowerShell.cs new file mode 100644 index 000000000000..f899369fe01f --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitLabProjectProperties.PowerShell.cs @@ -0,0 +1,220 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// GitLab Project properties. + [System.ComponentModel.TypeConverter(typeof(GitLabProjectPropertiesTypeConverter))] + public partial class GitLabProjectProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new GitLabProjectProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new GitLabProjectProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal GitLabProjectProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProvisioningStatusMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectPropertiesInternal)this).ProvisioningStatusMessage = (string) content.GetValueForProperty("ProvisioningStatusMessage",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectPropertiesInternal)this).ProvisioningStatusMessage, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningStatusUpdateTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectPropertiesInternal)this).ProvisioningStatusUpdateTimeUtc = (global::System.DateTime?) content.GetValueForProperty("ProvisioningStatusUpdateTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectPropertiesInternal)this).ProvisioningStatusUpdateTimeUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectPropertiesInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectPropertiesInternal)this).ProvisioningState, global::System.Convert.ToString); + } + if (content.Contains("FullyQualifiedName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectPropertiesInternal)this).FullyQualifiedName = (string) content.GetValueForProperty("FullyQualifiedName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectPropertiesInternal)this).FullyQualifiedName, global::System.Convert.ToString); + } + if (content.Contains("FullyQualifiedFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectPropertiesInternal)this).FullyQualifiedFriendlyName = (string) content.GetValueForProperty("FullyQualifiedFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectPropertiesInternal)this).FullyQualifiedFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("FullyQualifiedParentGroupName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectPropertiesInternal)this).FullyQualifiedParentGroupName = (string) content.GetValueForProperty("FullyQualifiedParentGroupName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectPropertiesInternal)this).FullyQualifiedParentGroupName, global::System.Convert.ToString); + } + if (content.Contains("Url")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectPropertiesInternal)this).Url = (string) content.GetValueForProperty("Url",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectPropertiesInternal)this).Url, global::System.Convert.ToString); + } + if (content.Contains("OnboardingState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectPropertiesInternal)this).OnboardingState = (string) content.GetValueForProperty("OnboardingState",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectPropertiesInternal)this).OnboardingState, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal GitLabProjectProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProvisioningStatusMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectPropertiesInternal)this).ProvisioningStatusMessage = (string) content.GetValueForProperty("ProvisioningStatusMessage",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectPropertiesInternal)this).ProvisioningStatusMessage, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningStatusUpdateTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectPropertiesInternal)this).ProvisioningStatusUpdateTimeUtc = (global::System.DateTime?) content.GetValueForProperty("ProvisioningStatusUpdateTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectPropertiesInternal)this).ProvisioningStatusUpdateTimeUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectPropertiesInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectPropertiesInternal)this).ProvisioningState, global::System.Convert.ToString); + } + if (content.Contains("FullyQualifiedName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectPropertiesInternal)this).FullyQualifiedName = (string) content.GetValueForProperty("FullyQualifiedName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectPropertiesInternal)this).FullyQualifiedName, global::System.Convert.ToString); + } + if (content.Contains("FullyQualifiedFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectPropertiesInternal)this).FullyQualifiedFriendlyName = (string) content.GetValueForProperty("FullyQualifiedFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectPropertiesInternal)this).FullyQualifiedFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("FullyQualifiedParentGroupName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectPropertiesInternal)this).FullyQualifiedParentGroupName = (string) content.GetValueForProperty("FullyQualifiedParentGroupName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectPropertiesInternal)this).FullyQualifiedParentGroupName, global::System.Convert.ToString); + } + if (content.Contains("Url")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectPropertiesInternal)this).Url = (string) content.GetValueForProperty("Url",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectPropertiesInternal)this).Url, global::System.Convert.ToString); + } + if (content.Contains("OnboardingState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectPropertiesInternal)this).OnboardingState = (string) content.GetValueForProperty("OnboardingState",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectPropertiesInternal)this).OnboardingState, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// GitLab Project properties. + [System.ComponentModel.TypeConverter(typeof(GitLabProjectPropertiesTypeConverter))] + public partial interface IGitLabProjectProperties + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitLabProjectProperties.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/GitLabProjectProperties.TypeConverter.cs new file mode 100644 index 000000000000..41033282ab08 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitLabProjectProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class GitLabProjectPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return GitLabProjectProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return GitLabProjectProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return GitLabProjectProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitLabProjectProperties.cs b/src/Security/Security.Autorest/generated/api/Models/GitLabProjectProperties.cs new file mode 100644 index 000000000000..f7abd1bdbfc1 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitLabProjectProperties.cs @@ -0,0 +1,325 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// GitLab Project properties. + public partial class GitLabProjectProperties : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectProperties, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectPropertiesInternal + { + + /// Backing field for property. + private string _fullyQualifiedFriendlyName; + + /// + /// Gets or sets the human readable fully-qualified name of the Project object. + /// + /// This contains the entire namespace hierarchy as seen on GitLab UI where entities are separated by the '/' character. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string FullyQualifiedFriendlyName { get => this._fullyQualifiedFriendlyName; } + + /// Backing field for property. + private string _fullyQualifiedName; + + /// + /// Gets or sets the fully-qualified name of the project object. + /// + /// This contains the entire hierarchy where entities are separated by the '$' character. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string FullyQualifiedName { get => this._fullyQualifiedName; } + + /// Backing field for property. + private string _fullyQualifiedParentGroupName; + + /// + /// Gets or sets the fully-qualified name of the project's parent group object. + /// + /// This contains the entire hierarchy where namespaces are separated by the '$' character. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string FullyQualifiedParentGroupName { get => this._fullyQualifiedParentGroupName; } + + /// Internal Acessors for FullyQualifiedFriendlyName + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectPropertiesInternal.FullyQualifiedFriendlyName { get => this._fullyQualifiedFriendlyName; set { {_fullyQualifiedFriendlyName = value;} } } + + /// Internal Acessors for FullyQualifiedName + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectPropertiesInternal.FullyQualifiedName { get => this._fullyQualifiedName; set { {_fullyQualifiedName = value;} } } + + /// Internal Acessors for FullyQualifiedParentGroupName + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectPropertiesInternal.FullyQualifiedParentGroupName { get => this._fullyQualifiedParentGroupName; set { {_fullyQualifiedParentGroupName = value;} } } + + /// Internal Acessors for ProvisioningStatusMessage + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectPropertiesInternal.ProvisioningStatusMessage { get => this._provisioningStatusMessage; set { {_provisioningStatusMessage = value;} } } + + /// Internal Acessors for ProvisioningStatusUpdateTimeUtc + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectPropertiesInternal.ProvisioningStatusUpdateTimeUtc { get => this._provisioningStatusUpdateTimeUtc; set { {_provisioningStatusUpdateTimeUtc = value;} } } + + /// Internal Acessors for Url + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectPropertiesInternal.Url { get => this._url; set { {_url = value;} } } + + /// Backing field for property. + private string _onboardingState; + + /// + /// Details about resource onboarding status across all connectors. + /// + /// OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to + /// top-level resources. + /// Onboarded - this resource has already been onboarded by the specified connector. + /// NotOnboarded - this resource has not been onboarded to any connector. + /// NotApplicable - the onboarding state is not applicable to the current endpoint. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string OnboardingState { get => this._onboardingState; set => this._onboardingState = value; } + + /// Backing field for property. + private string _provisioningState; + + /// + /// The provisioning state of the resource. + /// + /// Pending - Provisioning pending. + /// Failed - Provisioning failed. + /// Succeeded - Successful provisioning. + /// Canceled - Provisioning canceled. + /// PendingDeletion - Deletion pending. + /// DeletionSuccess - Deletion successful. + /// DeletionFailure - Deletion failure. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string ProvisioningState { get => this._provisioningState; set => this._provisioningState = value; } + + /// Backing field for property. + private string _provisioningStatusMessage; + + /// Gets or sets resource status message. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string ProvisioningStatusMessage { get => this._provisioningStatusMessage; } + + /// Backing field for property. + private global::System.DateTime? _provisioningStatusUpdateTimeUtc; + + /// Gets or sets time when resource was last checked. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public global::System.DateTime? ProvisioningStatusUpdateTimeUtc { get => this._provisioningStatusUpdateTimeUtc; } + + /// Backing field for property. + private string _url; + + /// Gets or sets the url of the GitLab Project. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string Url { get => this._url; } + + /// Creates an new instance. + public GitLabProjectProperties() + { + + } + } + /// GitLab Project properties. + public partial interface IGitLabProjectProperties : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// + /// Gets or sets the human readable fully-qualified name of the Project object. + /// + /// This contains the entire namespace hierarchy as seen on GitLab UI where entities are separated by the '/' character. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets the human readable fully-qualified name of the Project object. + + This contains the entire namespace hierarchy as seen on GitLab UI where entities are separated by the '/' character.", + SerializedName = @"fullyQualifiedFriendlyName", + PossibleTypes = new [] { typeof(string) })] + string FullyQualifiedFriendlyName { get; } + /// + /// Gets or sets the fully-qualified name of the project object. + /// + /// This contains the entire hierarchy where entities are separated by the '$' character. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets the fully-qualified name of the project object. + + This contains the entire hierarchy where entities are separated by the '$' character.", + SerializedName = @"fullyQualifiedName", + PossibleTypes = new [] { typeof(string) })] + string FullyQualifiedName { get; } + /// + /// Gets or sets the fully-qualified name of the project's parent group object. + /// + /// This contains the entire hierarchy where namespaces are separated by the '$' character. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets the fully-qualified name of the project's parent group object. + + This contains the entire hierarchy where namespaces are separated by the '$' character.", + SerializedName = @"fullyQualifiedParentGroupName", + PossibleTypes = new [] { typeof(string) })] + string FullyQualifiedParentGroupName { get; } + /// + /// Details about resource onboarding status across all connectors. + /// + /// OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to + /// top-level resources. + /// Onboarded - this resource has already been onboarded by the specified connector. + /// NotOnboarded - this resource has not been onboarded to any connector. + /// NotApplicable - the onboarding state is not applicable to the current endpoint. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Details about resource onboarding status across all connectors. + + OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to top-level resources. + Onboarded - this resource has already been onboarded by the specified connector. + NotOnboarded - this resource has not been onboarded to any connector. + NotApplicable - the onboarding state is not applicable to the current endpoint.", + SerializedName = @"onboardingState", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("NotApplicable", "OnboardedByOtherConnector", "Onboarded", "NotOnboarded")] + string OnboardingState { get; set; } + /// + /// The provisioning state of the resource. + /// + /// Pending - Provisioning pending. + /// Failed - Provisioning failed. + /// Succeeded - Successful provisioning. + /// Canceled - Provisioning canceled. + /// PendingDeletion - Deletion pending. + /// DeletionSuccess - Deletion successful. + /// DeletionFailure - Deletion failure. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The provisioning state of the resource. + + Pending - Provisioning pending. + Failed - Provisioning failed. + Succeeded - Successful provisioning. + Canceled - Provisioning canceled. + PendingDeletion - Deletion pending. + DeletionSuccess - Deletion successful. + DeletionFailure - Deletion failure.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Succeeded", "Failed", "Canceled", "Pending", "PendingDeletion", "DeletionSuccess", "DeletionFailure")] + string ProvisioningState { get; set; } + /// Gets or sets resource status message. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets resource status message.", + SerializedName = @"provisioningStatusMessage", + PossibleTypes = new [] { typeof(string) })] + string ProvisioningStatusMessage { get; } + /// Gets or sets time when resource was last checked. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets time when resource was last checked.", + SerializedName = @"provisioningStatusUpdateTimeUtc", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? ProvisioningStatusUpdateTimeUtc { get; } + /// Gets or sets the url of the GitLab Project. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets the url of the GitLab Project.", + SerializedName = @"url", + PossibleTypes = new [] { typeof(string) })] + string Url { get; } + + } + /// GitLab Project properties. + internal partial interface IGitLabProjectPropertiesInternal + + { + /// + /// Gets or sets the human readable fully-qualified name of the Project object. + /// + /// This contains the entire namespace hierarchy as seen on GitLab UI where entities are separated by the '/' character. + /// + string FullyQualifiedFriendlyName { get; set; } + /// + /// Gets or sets the fully-qualified name of the project object. + /// + /// This contains the entire hierarchy where entities are separated by the '$' character. + /// + string FullyQualifiedName { get; set; } + /// + /// Gets or sets the fully-qualified name of the project's parent group object. + /// + /// This contains the entire hierarchy where namespaces are separated by the '$' character. + /// + string FullyQualifiedParentGroupName { get; set; } + /// + /// Details about resource onboarding status across all connectors. + /// + /// OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to + /// top-level resources. + /// Onboarded - this resource has already been onboarded by the specified connector. + /// NotOnboarded - this resource has not been onboarded to any connector. + /// NotApplicable - the onboarding state is not applicable to the current endpoint. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("NotApplicable", "OnboardedByOtherConnector", "Onboarded", "NotOnboarded")] + string OnboardingState { get; set; } + /// + /// The provisioning state of the resource. + /// + /// Pending - Provisioning pending. + /// Failed - Provisioning failed. + /// Succeeded - Successful provisioning. + /// Canceled - Provisioning canceled. + /// PendingDeletion - Deletion pending. + /// DeletionSuccess - Deletion successful. + /// DeletionFailure - Deletion failure. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Succeeded", "Failed", "Canceled", "Pending", "PendingDeletion", "DeletionSuccess", "DeletionFailure")] + string ProvisioningState { get; set; } + /// Gets or sets resource status message. + string ProvisioningStatusMessage { get; set; } + /// Gets or sets time when resource was last checked. + global::System.DateTime? ProvisioningStatusUpdateTimeUtc { get; set; } + /// Gets or sets the url of the GitLab Project. + string Url { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitLabProjectProperties.json.cs b/src/Security/Security.Autorest/generated/api/Models/GitLabProjectProperties.json.cs new file mode 100644 index 000000000000..11c002c08dcc --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitLabProjectProperties.json.cs @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// GitLab Project properties. + public partial class GitLabProjectProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new GitLabProjectProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal GitLabProjectProperties(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_provisioningStatusMessage = If( json?.PropertyT("provisioningStatusMessage"), out var __jsonProvisioningStatusMessage) ? (string)__jsonProvisioningStatusMessage : (string)_provisioningStatusMessage;} + {_provisioningStatusUpdateTimeUtc = If( json?.PropertyT("provisioningStatusUpdateTimeUtc"), out var __jsonProvisioningStatusUpdateTimeUtc) ? global::System.DateTime.TryParse((string)__jsonProvisioningStatusUpdateTimeUtc, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonProvisioningStatusUpdateTimeUtcValue) ? __jsonProvisioningStatusUpdateTimeUtcValue : _provisioningStatusUpdateTimeUtc : _provisioningStatusUpdateTimeUtc;} + {_provisioningState = If( json?.PropertyT("provisioningState"), out var __jsonProvisioningState) ? (string)__jsonProvisioningState : (string)_provisioningState;} + {_fullyQualifiedName = If( json?.PropertyT("fullyQualifiedName"), out var __jsonFullyQualifiedName) ? (string)__jsonFullyQualifiedName : (string)_fullyQualifiedName;} + {_fullyQualifiedFriendlyName = If( json?.PropertyT("fullyQualifiedFriendlyName"), out var __jsonFullyQualifiedFriendlyName) ? (string)__jsonFullyQualifiedFriendlyName : (string)_fullyQualifiedFriendlyName;} + {_fullyQualifiedParentGroupName = If( json?.PropertyT("fullyQualifiedParentGroupName"), out var __jsonFullyQualifiedParentGroupName) ? (string)__jsonFullyQualifiedParentGroupName : (string)_fullyQualifiedParentGroupName;} + {_url = If( json?.PropertyT("url"), out var __jsonUrl) ? (string)__jsonUrl : (string)_url;} + {_onboardingState = If( json?.PropertyT("onboardingState"), out var __jsonOnboardingState) ? (string)__jsonOnboardingState : (string)_onboardingState;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._provisioningStatusMessage)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._provisioningStatusMessage.ToString()) : null, "provisioningStatusMessage" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._provisioningStatusUpdateTimeUtc ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._provisioningStatusUpdateTimeUtc?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "provisioningStatusUpdateTimeUtc" ,container.Add ); + } + AddIf( null != (((object)this._provisioningState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._provisioningState.ToString()) : null, "provisioningState" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._fullyQualifiedName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._fullyQualifiedName.ToString()) : null, "fullyQualifiedName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._fullyQualifiedFriendlyName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._fullyQualifiedFriendlyName.ToString()) : null, "fullyQualifiedFriendlyName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._fullyQualifiedParentGroupName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._fullyQualifiedParentGroupName.ToString()) : null, "fullyQualifiedParentGroupName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._url)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._url.ToString()) : null, "url" ,container.Add ); + } + AddIf( null != (((object)this._onboardingState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._onboardingState.ToString()) : null, "onboardingState" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitLabScopeEnvironment.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/GitLabScopeEnvironment.PowerShell.cs new file mode 100644 index 000000000000..9c6c7b418a3b --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitLabScopeEnvironment.PowerShell.cs @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The GitLab scope connector's environment data + [System.ComponentModel.TypeConverter(typeof(GitLabScopeEnvironmentTypeConverter))] + public partial class GitLabScopeEnvironment + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabScopeEnvironment DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new GitLabScopeEnvironment(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabScopeEnvironment DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new GitLabScopeEnvironment(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabScopeEnvironment FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal GitLabScopeEnvironment(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("EnvironmentType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironmentInternal)this).EnvironmentType = (string) content.GetValueForProperty("EnvironmentType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironmentInternal)this).EnvironmentType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal GitLabScopeEnvironment(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("EnvironmentType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironmentInternal)this).EnvironmentType = (string) content.GetValueForProperty("EnvironmentType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironmentInternal)this).EnvironmentType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The GitLab scope connector's environment data + [System.ComponentModel.TypeConverter(typeof(GitLabScopeEnvironmentTypeConverter))] + public partial interface IGitLabScopeEnvironment + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitLabScopeEnvironment.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/GitLabScopeEnvironment.TypeConverter.cs new file mode 100644 index 000000000000..352f4e2d3244 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitLabScopeEnvironment.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class GitLabScopeEnvironmentTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabScopeEnvironment ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabScopeEnvironment).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return GitLabScopeEnvironment.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return GitLabScopeEnvironment.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return GitLabScopeEnvironment.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitLabScopeEnvironment.cs b/src/Security/Security.Autorest/generated/api/Models/GitLabScopeEnvironment.cs new file mode 100644 index 000000000000..032b0bb68066 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitLabScopeEnvironment.cs @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The GitLab scope connector's environment data + public partial class GitLabScopeEnvironment : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabScopeEnvironment, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabScopeEnvironmentInternal, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironment __securityConnectorEnvironment = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SecurityConnectorEnvironment(); + + /// The type of the environment data. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Constant] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string EnvironmentType { get => "GitlabScope"; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironmentInternal)__securityConnectorEnvironment).EnvironmentType = "GitlabScope"; } + + /// Creates an new instance. + public GitLabScopeEnvironment() + { + this.__securityConnectorEnvironment.EnvironmentType = "GitlabScope"; + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__securityConnectorEnvironment), __securityConnectorEnvironment); + await eventListener.AssertObjectIsValid(nameof(__securityConnectorEnvironment), __securityConnectorEnvironment); + } + } + /// The GitLab scope connector's environment data + public partial interface IGitLabScopeEnvironment : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironment + { + + } + /// The GitLab scope connector's environment data + internal partial interface IGitLabScopeEnvironmentInternal : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironmentInternal + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/GitLabScopeEnvironment.json.cs b/src/Security/Security.Autorest/generated/api/Models/GitLabScopeEnvironment.json.cs new file mode 100644 index 000000000000..5ce9ec988f9c --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/GitLabScopeEnvironment.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The GitLab scope connector's environment data + public partial class GitLabScopeEnvironment + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabScopeEnvironment. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabScopeEnvironment. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabScopeEnvironment FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new GitLabScopeEnvironment(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal GitLabScopeEnvironment(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __securityConnectorEnvironment = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SecurityConnectorEnvironment(json); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __securityConnectorEnvironment?.ToJson(container, serializationMode); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/InformationProtectionAwsOffering.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/InformationProtectionAwsOffering.PowerShell.cs new file mode 100644 index 000000000000..5531c1d36b04 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/InformationProtectionAwsOffering.PowerShell.cs @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The information protection for AWS offering + [System.ComponentModel.TypeConverter(typeof(InformationProtectionAwsOfferingTypeConverter))] + public partial class InformationProtectionAwsOffering + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IInformationProtectionAwsOffering DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InformationProtectionAwsOffering(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IInformationProtectionAwsOffering DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InformationProtectionAwsOffering(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IInformationProtectionAwsOffering FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InformationProtectionAwsOffering(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InformationProtection")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IInformationProtectionAwsOfferingInternal)this).InformationProtection = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IInformationProtectionAwsOfferingInformationProtection) content.GetValueForProperty("InformationProtection",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IInformationProtectionAwsOfferingInternal)this).InformationProtection, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.InformationProtectionAwsOfferingInformationProtectionTypeConverter.ConvertFrom); + } + if (content.Contains("OfferingType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType = (string) content.GetValueForProperty("OfferingType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType, global::System.Convert.ToString); + } + if (content.Contains("Description")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description, global::System.Convert.ToString); + } + if (content.Contains("InformationProtectionCloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IInformationProtectionAwsOfferingInternal)this).InformationProtectionCloudRoleArn = (string) content.GetValueForProperty("InformationProtectionCloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IInformationProtectionAwsOfferingInternal)this).InformationProtectionCloudRoleArn, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InformationProtectionAwsOffering(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InformationProtection")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IInformationProtectionAwsOfferingInternal)this).InformationProtection = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IInformationProtectionAwsOfferingInformationProtection) content.GetValueForProperty("InformationProtection",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IInformationProtectionAwsOfferingInternal)this).InformationProtection, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.InformationProtectionAwsOfferingInformationProtectionTypeConverter.ConvertFrom); + } + if (content.Contains("OfferingType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType = (string) content.GetValueForProperty("OfferingType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).OfferingType, global::System.Convert.ToString); + } + if (content.Contains("Description")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)this).Description, global::System.Convert.ToString); + } + if (content.Contains("InformationProtectionCloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IInformationProtectionAwsOfferingInternal)this).InformationProtectionCloudRoleArn = (string) content.GetValueForProperty("InformationProtectionCloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IInformationProtectionAwsOfferingInternal)this).InformationProtectionCloudRoleArn, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The information protection for AWS offering + [System.ComponentModel.TypeConverter(typeof(InformationProtectionAwsOfferingTypeConverter))] + public partial interface IInformationProtectionAwsOffering + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/InformationProtectionAwsOffering.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/InformationProtectionAwsOffering.TypeConverter.cs new file mode 100644 index 000000000000..f25558043e29 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/InformationProtectionAwsOffering.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InformationProtectionAwsOfferingTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IInformationProtectionAwsOffering ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IInformationProtectionAwsOffering).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InformationProtectionAwsOffering.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InformationProtectionAwsOffering.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InformationProtectionAwsOffering.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/InformationProtectionAwsOffering.cs b/src/Security/Security.Autorest/generated/api/Models/InformationProtectionAwsOffering.cs new file mode 100644 index 000000000000..44b06b4e276d --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/InformationProtectionAwsOffering.cs @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The information protection for AWS offering + public partial class InformationProtectionAwsOffering : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IInformationProtectionAwsOffering, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IInformationProtectionAwsOfferingInternal, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOffering __cloudOffering = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CloudOffering(); + + /// The offering description. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string Description { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)__cloudOffering).Description; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IInformationProtectionAwsOfferingInformationProtection _informationProtection; + + /// The native cloud connection configuration + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IInformationProtectionAwsOfferingInformationProtection InformationProtection { get => (this._informationProtection = this._informationProtection ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.InformationProtectionAwsOfferingInformationProtection()); set => this._informationProtection = value; } + + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string InformationProtectionCloudRoleArn { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IInformationProtectionAwsOfferingInformationProtectionInternal)InformationProtection).CloudRoleArn; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IInformationProtectionAwsOfferingInformationProtectionInternal)InformationProtection).CloudRoleArn = value ?? null; } + + /// Internal Acessors for Description + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal.Description { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)__cloudOffering).Description; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)__cloudOffering).Description = value; } + + /// Internal Acessors for InformationProtection + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IInformationProtectionAwsOfferingInformationProtection Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IInformationProtectionAwsOfferingInternal.InformationProtection { get => (this._informationProtection = this._informationProtection ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.InformationProtectionAwsOfferingInformationProtection()); set { {_informationProtection = value;} } } + + /// The type of the security offering. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Constant] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string OfferingType { get => "InformationProtectionAws"; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal)__cloudOffering).OfferingType = "InformationProtectionAws"; } + + /// Creates an new instance. + public InformationProtectionAwsOffering() + { + this.__cloudOffering.OfferingType = "InformationProtectionAws"; + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__cloudOffering), __cloudOffering); + await eventListener.AssertObjectIsValid(nameof(__cloudOffering), __cloudOffering); + } + } + /// The information protection for AWS offering + public partial interface IInformationProtectionAwsOffering : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOffering + { + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The cloud role ARN in AWS for this feature", + SerializedName = @"cloudRoleArn", + PossibleTypes = new [] { typeof(string) })] + string InformationProtectionCloudRoleArn { get; set; } + + } + /// The information protection for AWS offering + internal partial interface IInformationProtectionAwsOfferingInternal : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOfferingInternal + { + /// The native cloud connection configuration + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IInformationProtectionAwsOfferingInformationProtection InformationProtection { get; set; } + /// The cloud role ARN in AWS for this feature + string InformationProtectionCloudRoleArn { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/InformationProtectionAwsOffering.json.cs b/src/Security/Security.Autorest/generated/api/Models/InformationProtectionAwsOffering.json.cs new file mode 100644 index 000000000000..277796ecd1a1 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/InformationProtectionAwsOffering.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The information protection for AWS offering + public partial class InformationProtectionAwsOffering + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IInformationProtectionAwsOffering. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IInformationProtectionAwsOffering. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IInformationProtectionAwsOffering FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new InformationProtectionAwsOffering(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal InformationProtectionAwsOffering(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __cloudOffering = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CloudOffering(json); + {_informationProtection = If( json?.PropertyT("informationProtection"), out var __jsonInformationProtection) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.InformationProtectionAwsOfferingInformationProtection.FromJson(__jsonInformationProtection) : _informationProtection;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __cloudOffering?.ToJson(container, serializationMode); + AddIf( null != this._informationProtection ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._informationProtection.ToJson(null,serializationMode) : null, "informationProtection" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/InformationProtectionAwsOfferingInformationProtection.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/InformationProtectionAwsOfferingInformationProtection.PowerShell.cs new file mode 100644 index 000000000000..38faf8044939 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/InformationProtectionAwsOfferingInformationProtection.PowerShell.cs @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The native cloud connection configuration + [System.ComponentModel.TypeConverter(typeof(InformationProtectionAwsOfferingInformationProtectionTypeConverter))] + public partial class InformationProtectionAwsOfferingInformationProtection + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IInformationProtectionAwsOfferingInformationProtection DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InformationProtectionAwsOfferingInformationProtection(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IInformationProtectionAwsOfferingInformationProtection DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InformationProtectionAwsOfferingInformationProtection(content); + } + + /// + /// Creates a new instance of , deserializing the content + /// from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IInformationProtectionAwsOfferingInformationProtection FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InformationProtectionAwsOfferingInformationProtection(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IInformationProtectionAwsOfferingInformationProtectionInternal)this).CloudRoleArn = (string) content.GetValueForProperty("CloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IInformationProtectionAwsOfferingInformationProtectionInternal)this).CloudRoleArn, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InformationProtectionAwsOfferingInformationProtection(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CloudRoleArn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IInformationProtectionAwsOfferingInformationProtectionInternal)this).CloudRoleArn = (string) content.GetValueForProperty("CloudRoleArn",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IInformationProtectionAwsOfferingInformationProtectionInternal)this).CloudRoleArn, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The native cloud connection configuration + [System.ComponentModel.TypeConverter(typeof(InformationProtectionAwsOfferingInformationProtectionTypeConverter))] + public partial interface IInformationProtectionAwsOfferingInformationProtection + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/InformationProtectionAwsOfferingInformationProtection.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/InformationProtectionAwsOfferingInformationProtection.TypeConverter.cs new file mode 100644 index 000000000000..087ebb63fe80 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/InformationProtectionAwsOfferingInformationProtection.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InformationProtectionAwsOfferingInformationProtectionTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IInformationProtectionAwsOfferingInformationProtection ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IInformationProtectionAwsOfferingInformationProtection).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InformationProtectionAwsOfferingInformationProtection.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InformationProtectionAwsOfferingInformationProtection.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InformationProtectionAwsOfferingInformationProtection.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/InformationProtectionAwsOfferingInformationProtection.cs b/src/Security/Security.Autorest/generated/api/Models/InformationProtectionAwsOfferingInformationProtection.cs new file mode 100644 index 000000000000..0c6cb74452ed --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/InformationProtectionAwsOfferingInformationProtection.cs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The native cloud connection configuration + public partial class InformationProtectionAwsOfferingInformationProtection : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IInformationProtectionAwsOfferingInformationProtection, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IInformationProtectionAwsOfferingInformationProtectionInternal + { + + /// Backing field for property. + private string _cloudRoleArn; + + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string CloudRoleArn { get => this._cloudRoleArn; set => this._cloudRoleArn = value; } + + /// + /// Creates an new instance. + /// + public InformationProtectionAwsOfferingInformationProtection() + { + + } + } + /// The native cloud connection configuration + public partial interface IInformationProtectionAwsOfferingInformationProtection : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// The cloud role ARN in AWS for this feature + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The cloud role ARN in AWS for this feature", + SerializedName = @"cloudRoleArn", + PossibleTypes = new [] { typeof(string) })] + string CloudRoleArn { get; set; } + + } + /// The native cloud connection configuration + internal partial interface IInformationProtectionAwsOfferingInformationProtectionInternal + + { + /// The cloud role ARN in AWS for this feature + string CloudRoleArn { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/InformationProtectionAwsOfferingInformationProtection.json.cs b/src/Security/Security.Autorest/generated/api/Models/InformationProtectionAwsOfferingInformationProtection.json.cs new file mode 100644 index 000000000000..ceb4c7f2c589 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/InformationProtectionAwsOfferingInformationProtection.json.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The native cloud connection configuration + public partial class InformationProtectionAwsOfferingInformationProtection + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IInformationProtectionAwsOfferingInformationProtection. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IInformationProtectionAwsOfferingInformationProtection. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IInformationProtectionAwsOfferingInformationProtection FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new InformationProtectionAwsOfferingInformationProtection(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal InformationProtectionAwsOfferingInformationProtection(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_cloudRoleArn = If( json?.PropertyT("cloudRoleArn"), out var __jsonCloudRoleArn) ? (string)__jsonCloudRoleArn : (string)_cloudRoleArn;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._cloudRoleArn)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._cloudRoleArn.ToString()) : null, "cloudRoleArn" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/OperationStatusResult.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/OperationStatusResult.PowerShell.cs new file mode 100644 index 000000000000..6a02f75afc75 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/OperationStatusResult.PowerShell.cs @@ -0,0 +1,260 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The current status of an async operation. + [System.ComponentModel.TypeConverter(typeof(OperationStatusResultTypeConverter))] + public partial class OperationStatusResult + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResult DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new OperationStatusResult(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResult DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new OperationStatusResult(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResult FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal OperationStatusResult(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResultInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetail) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResultInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorDetailTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResultInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResultInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResultInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResultInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResultInternal)this).Status = (string) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResultInternal)this).Status, global::System.Convert.ToString); + } + if (content.Contains("PercentComplete")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResultInternal)this).PercentComplete = (float?) content.GetValueForProperty("PercentComplete",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResultInternal)this).PercentComplete, (__y)=> (float) global::System.Convert.ChangeType(__y, typeof(float))); + } + if (content.Contains("StartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResultInternal)this).StartTime = (global::System.DateTime?) content.GetValueForProperty("StartTime",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResultInternal)this).StartTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("EndTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResultInternal)this).EndTime = (global::System.DateTime?) content.GetValueForProperty("EndTime",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResultInternal)this).EndTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("Operation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResultInternal)this).Operation = (System.Collections.Generic.List) content.GetValueForProperty("Operation",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResultInternal)this).Operation, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.OperationStatusResultTypeConverter.ConvertFrom)); + } + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResultInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResultInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResultInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResultInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResultInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResultInternal)this).Target, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResultInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResultInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorDetailTypeConverter.ConvertFrom)); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResultInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResultInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorAdditionalInfoTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal OperationStatusResult(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResultInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetail) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResultInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorDetailTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResultInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResultInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResultInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResultInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResultInternal)this).Status = (string) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResultInternal)this).Status, global::System.Convert.ToString); + } + if (content.Contains("PercentComplete")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResultInternal)this).PercentComplete = (float?) content.GetValueForProperty("PercentComplete",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResultInternal)this).PercentComplete, (__y)=> (float) global::System.Convert.ChangeType(__y, typeof(float))); + } + if (content.Contains("StartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResultInternal)this).StartTime = (global::System.DateTime?) content.GetValueForProperty("StartTime",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResultInternal)this).StartTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("EndTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResultInternal)this).EndTime = (global::System.DateTime?) content.GetValueForProperty("EndTime",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResultInternal)this).EndTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("Operation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResultInternal)this).Operation = (System.Collections.Generic.List) content.GetValueForProperty("Operation",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResultInternal)this).Operation, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.OperationStatusResultTypeConverter.ConvertFrom)); + } + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResultInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResultInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResultInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResultInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResultInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResultInternal)this).Target, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResultInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResultInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorDetailTypeConverter.ConvertFrom)); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResultInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResultInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorAdditionalInfoTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The current status of an async operation. + [System.ComponentModel.TypeConverter(typeof(OperationStatusResultTypeConverter))] + public partial interface IOperationStatusResult + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/OperationStatusResult.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/OperationStatusResult.TypeConverter.cs new file mode 100644 index 000000000000..ce0a1843ddeb --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/OperationStatusResult.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class OperationStatusResultTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResult ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResult).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return OperationStatusResult.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return OperationStatusResult.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return OperationStatusResult.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/OperationStatusResult.cs b/src/Security/Security.Autorest/generated/api/Models/OperationStatusResult.cs new file mode 100644 index 000000000000..123a2232c3d8 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/OperationStatusResult.cs @@ -0,0 +1,290 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The current status of an async operation. + public partial class OperationStatusResult : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResult, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResultInternal + { + + /// The error additional info. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public System.Collections.Generic.List AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailInternal)Error).AdditionalInfo; } + + /// The error code. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailInternal)Error).Code; } + + /// The error details. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public System.Collections.Generic.List Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailInternal)Error).Detail; } + + /// Backing field for property. + private global::System.DateTime? _endTime; + + /// The end time of the operation. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public global::System.DateTime? EndTime { get => this._endTime; set => this._endTime = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetail _error; + + /// If present, details of the operation error. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetail Error { get => (this._error = this._error ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorDetail()); set => this._error = value; } + + /// Backing field for property. + private string _id; + + /// Fully qualified ID for the async operation. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string Id { get => this._id; set => this._id = value; } + + /// The error message. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailInternal)Error).Message; } + + /// Internal Acessors for AdditionalInfo + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResultInternal.AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailInternal)Error).AdditionalInfo; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailInternal)Error).AdditionalInfo = value; } + + /// Internal Acessors for Code + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResultInternal.Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailInternal)Error).Code; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailInternal)Error).Code = value; } + + /// Internal Acessors for Detail + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResultInternal.Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailInternal)Error).Detail; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailInternal)Error).Detail = value; } + + /// Internal Acessors for Error + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetail Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResultInternal.Error { get => (this._error = this._error ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorDetail()); set { {_error = value;} } } + + /// Internal Acessors for Message + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResultInternal.Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailInternal)Error).Message; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailInternal)Error).Message = value; } + + /// Internal Acessors for Target + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResultInternal.Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailInternal)Error).Target; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailInternal)Error).Target = value; } + + /// Backing field for property. + private string _name; + + /// Name of the async operation. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string Name { get => this._name; set => this._name = value; } + + /// Backing field for property. + private System.Collections.Generic.List _operation; + + /// The operations list. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public System.Collections.Generic.List Operation { get => this._operation; set => this._operation = value; } + + /// Backing field for property. + private float? _percentComplete; + + /// Percent of the operation that is complete. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public float? PercentComplete { get => this._percentComplete; set => this._percentComplete = value; } + + /// Gets the resource group name + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string ResourceGroupName { get => (new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Success ? new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Groups["resourceGroupName"].Value : null); } + + /// Backing field for property. + private global::System.DateTime? _startTime; + + /// The start time of the operation. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public global::System.DateTime? StartTime { get => this._startTime; set => this._startTime = value; } + + /// Backing field for property. + private string _status; + + /// Operation status. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string Status { get => this._status; set => this._status = value; } + + /// The error target. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + public string Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetailInternal)Error).Target; } + + /// Creates an new instance. + public OperationStatusResult() + { + + } + } + /// The current status of an async operation. + public partial interface IOperationStatusResult : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// The error additional info. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The error additional info.", + SerializedName = @"additionalInfo", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorAdditionalInfo) })] + System.Collections.Generic.List AdditionalInfo { get; } + /// The error code. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The error code.", + SerializedName = @"code", + PossibleTypes = new [] { typeof(string) })] + string Code { get; } + /// The error details. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The error details.", + SerializedName = @"details", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetail) })] + System.Collections.Generic.List Detail { get; } + /// The end time of the operation. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The end time of the operation.", + SerializedName = @"endTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? EndTime { get; set; } + /// Fully qualified ID for the async operation. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Fully qualified ID for the async operation.", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string Id { get; set; } + /// The error message. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The error message.", + SerializedName = @"message", + PossibleTypes = new [] { typeof(string) })] + string Message { get; } + /// Name of the async operation. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Name of the async operation.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; set; } + /// The operations list. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The operations list.", + SerializedName = @"operations", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResult) })] + System.Collections.Generic.List Operation { get; set; } + /// Percent of the operation that is complete. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Percent of the operation that is complete.", + SerializedName = @"percentComplete", + PossibleTypes = new [] { typeof(float) })] + float? PercentComplete { get; set; } + /// The start time of the operation. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The start time of the operation.", + SerializedName = @"startTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? StartTime { get; set; } + /// Operation status. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Operation status.", + SerializedName = @"status", + PossibleTypes = new [] { typeof(string) })] + string Status { get; set; } + /// The error target. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The error target.", + SerializedName = @"target", + PossibleTypes = new [] { typeof(string) })] + string Target { get; } + + } + /// The current status of an async operation. + internal partial interface IOperationStatusResultInternal + + { + /// The error additional info. + System.Collections.Generic.List AdditionalInfo { get; set; } + /// The error code. + string Code { get; set; } + /// The error details. + System.Collections.Generic.List Detail { get; set; } + /// The end time of the operation. + global::System.DateTime? EndTime { get; set; } + /// If present, details of the operation error. + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorDetail Error { get; set; } + /// Fully qualified ID for the async operation. + string Id { get; set; } + /// The error message. + string Message { get; set; } + /// Name of the async operation. + string Name { get; set; } + /// The operations list. + System.Collections.Generic.List Operation { get; set; } + /// Percent of the operation that is complete. + float? PercentComplete { get; set; } + /// The start time of the operation. + global::System.DateTime? StartTime { get; set; } + /// Operation status. + string Status { get; set; } + /// The error target. + string Target { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/OperationStatusResult.json.cs b/src/Security/Security.Autorest/generated/api/Models/OperationStatusResult.json.cs new file mode 100644 index 000000000000..f6f62293ed8d --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/OperationStatusResult.json.cs @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The current status of an async operation. + public partial class OperationStatusResult + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResult. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResult. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResult FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new OperationStatusResult(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal OperationStatusResult(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_error = If( json?.PropertyT("error"), out var __jsonError) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorDetail.FromJson(__jsonError) : _error;} + {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)_id;} + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)_name;} + {_status = If( json?.PropertyT("status"), out var __jsonStatus) ? (string)__jsonStatus : (string)_status;} + {_percentComplete = If( json?.PropertyT("percentComplete"), out var __jsonPercentComplete) ? (float?)__jsonPercentComplete : _percentComplete;} + {_startTime = If( json?.PropertyT("startTime"), out var __jsonStartTime) ? global::System.DateTime.TryParse((string)__jsonStartTime, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonStartTimeValue) ? __jsonStartTimeValue : _startTime : _startTime;} + {_endTime = If( json?.PropertyT("endTime"), out var __jsonEndTime) ? global::System.DateTime.TryParse((string)__jsonEndTime, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonEndTimeValue) ? __jsonEndTimeValue : _endTime : _endTime;} + {_operation = If( json?.PropertyT("operations"), out var __jsonOperations) ? If( __jsonOperations as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IOperationStatusResult) (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.OperationStatusResult.FromJson(__u) )) ))() : null : _operation;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._error ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._error.ToJson(null,serializationMode) : null, "error" ,container.Add ); + AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + AddIf( null != (((object)this._status)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._status.ToString()) : null, "status" ,container.Add ); + AddIf( null != this._percentComplete ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNumber((float)this._percentComplete) : null, "percentComplete" ,container.Add ); + AddIf( null != this._startTime ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._startTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "startTime" ,container.Add ); + AddIf( null != this._endTime ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._endTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "endTime" ,container.Add ); + if (null != this._operation) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.XNodeArray(); + foreach( var __x in this._operation ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("operations",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/ProxyResource.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/ProxyResource.PowerShell.cs new file mode 100644 index 000000000000..be8b015ca3d4 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/ProxyResource.PowerShell.cs @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location + /// + [System.ComponentModel.TypeConverter(typeof(ProxyResourceTypeConverter))] + public partial class ProxyResource + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IProxyResource DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ProxyResource(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IProxyResource DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ProxyResource(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IProxyResource FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ProxyResource(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Type, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ProxyResource(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Type, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location + [System.ComponentModel.TypeConverter(typeof(ProxyResourceTypeConverter))] + public partial interface IProxyResource + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/ProxyResource.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/ProxyResource.TypeConverter.cs new file mode 100644 index 000000000000..2018efd729fa --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/ProxyResource.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ProxyResourceTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IProxyResource ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IProxyResource).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ProxyResource.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ProxyResource.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ProxyResource.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/ProxyResource.cs b/src/Security/Security.Autorest/generated/api/Models/ProxyResource.cs new file mode 100644 index 000000000000..55521cdfcc7a --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/ProxyResource.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// + /// The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location + /// + public partial class ProxyResource : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IProxyResource, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IProxyResourceInternal, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGenerated __resourceAutoGenerated = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ResourceAutoGenerated(); + + /// + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__resourceAutoGenerated).Id; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__resourceAutoGenerated).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__resourceAutoGenerated).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__resourceAutoGenerated).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__resourceAutoGenerated).Name = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__resourceAutoGenerated).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__resourceAutoGenerated).Type = value; } + + /// The name of the resource + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__resourceAutoGenerated).Name; } + + /// + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)__resourceAutoGenerated).Type; } + + /// Creates an new instance. + public ProxyResource() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__resourceAutoGenerated), __resourceAutoGenerated); + await eventListener.AssertObjectIsValid(nameof(__resourceAutoGenerated), __resourceAutoGenerated); + } + } + /// The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location + public partial interface IProxyResource : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGenerated + { + + } + /// The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location + internal partial interface IProxyResourceInternal : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/ProxyResource.json.cs b/src/Security/Security.Autorest/generated/api/Models/ProxyResource.json.cs new file mode 100644 index 000000000000..69855c28b4a8 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/ProxyResource.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// + /// The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location + /// + public partial class ProxyResource + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IProxyResource. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IProxyResource. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IProxyResource FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new ProxyResource(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal ProxyResource(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __resourceAutoGenerated = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ResourceAutoGenerated(json); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __resourceAutoGenerated?.ToJson(container, serializationMode); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/Resource.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/Resource.PowerShell.cs new file mode 100644 index 000000000000..2b3bd10ebac2 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/Resource.PowerShell.cs @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// Describes an Azure resource. + [System.ComponentModel.TypeConverter(typeof(ResourceTypeConverter))] + public partial class Resource + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResource DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new Resource(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResource DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new Resource(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResource FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal Resource(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)this).Type, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal Resource(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)this).Type, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// Describes an Azure resource. + [System.ComponentModel.TypeConverter(typeof(ResourceTypeConverter))] + public partial interface IResource + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/Resource.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/Resource.TypeConverter.cs new file mode 100644 index 000000000000..1a88b943b7f0 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/Resource.TypeConverter.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ResourceTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResource ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResource).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return Resource.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return Resource.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return Resource.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/Resource.cs b/src/Security/Security.Autorest/generated/api/Models/Resource.cs new file mode 100644 index 000000000000..b6394b7574ae --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/Resource.cs @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// Describes an Azure resource. + public partial class Resource : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResource, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal + { + + /// Backing field for property. + private string _id; + + /// Resource Id + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string Id { get => this._id; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal.Id { get => this._id; set { {_id = value;} } } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal.Name { get => this._name; set { {_name = value;} } } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal.Type { get => this._type; set { {_type = value;} } } + + /// Backing field for property. + private string _name; + + /// Resource name + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string Name { get => this._name; } + + /// Backing field for property. + private string _type; + + /// Resource type + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string Type { get => this._type; } + + /// Creates an new instance. + public Resource() + { + + } + } + /// Describes an Azure resource. + public partial interface IResource : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// Resource Id + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Resource Id", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string Id { get; } + /// Resource name + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Resource name", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; } + /// Resource type + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Resource type", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string Type { get; } + + } + /// Describes an Azure resource. + internal partial interface IResourceInternal + + { + /// Resource Id + string Id { get; set; } + /// Resource name + string Name { get; set; } + /// Resource type + string Type { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/Resource.json.cs b/src/Security/Security.Autorest/generated/api/Models/Resource.json.cs new file mode 100644 index 000000000000..e800ed190016 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/Resource.json.cs @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// Describes an Azure resource. + public partial class Resource + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResource. + /// + /// a to deserialize from. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResource. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResource FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new Resource(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal Resource(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)_id;} + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)_name;} + {_type = If( json?.PropertyT("type"), out var __jsonType) ? (string)__jsonType : (string)_type;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._type.ToString()) : null, "type" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/ResourceAutoGenerated.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/ResourceAutoGenerated.PowerShell.cs new file mode 100644 index 000000000000..520fd7aee6bb --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/ResourceAutoGenerated.PowerShell.cs @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// Common fields that are returned in the response for all Azure Resource Manager resources + /// + [System.ComponentModel.TypeConverter(typeof(ResourceAutoGeneratedTypeConverter))] + public partial class ResourceAutoGenerated + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGenerated DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ResourceAutoGenerated(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGenerated DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ResourceAutoGenerated(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGenerated FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ResourceAutoGenerated(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Type, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ResourceAutoGenerated(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal)this).Type, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// Common fields that are returned in the response for all Azure Resource Manager resources + [System.ComponentModel.TypeConverter(typeof(ResourceAutoGeneratedTypeConverter))] + public partial interface IResourceAutoGenerated + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/ResourceAutoGenerated.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/ResourceAutoGenerated.TypeConverter.cs new file mode 100644 index 000000000000..8497bc18cceb --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/ResourceAutoGenerated.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ResourceAutoGeneratedTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGenerated ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGenerated).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ResourceAutoGenerated.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ResourceAutoGenerated.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ResourceAutoGenerated.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/ResourceAutoGenerated.cs b/src/Security/Security.Autorest/generated/api/Models/ResourceAutoGenerated.cs new file mode 100644 index 000000000000..f85f6d62c2bc --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/ResourceAutoGenerated.cs @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// + /// Common fields that are returned in the response for all Azure Resource Manager resources + /// + public partial class ResourceAutoGenerated : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGenerated, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal + { + + /// Backing field for property. + private string _id; + + /// + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string Id { get => this._id; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal.Id { get => this._id; set { {_id = value;} } } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal.Name { get => this._name; set { {_name = value;} } } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGeneratedInternal.Type { get => this._type; set { {_type = value;} } } + + /// Backing field for property. + private string _name; + + /// The name of the resource + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string Name { get => this._name; } + + /// Backing field for property. + private string _type; + + /// + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string Type { get => this._type; } + + /// Creates an new instance. + public ResourceAutoGenerated() + { + + } + } + /// Common fields that are returned in the response for all Azure Resource Manager resources + public partial interface IResourceAutoGenerated : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string Id { get; } + /// The name of the resource + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The name of the resource", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; } + /// + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The type of the resource. E.g. ""Microsoft.Compute/virtualMachines"" or ""Microsoft.Storage/storageAccounts""", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string Type { get; } + + } + /// Common fields that are returned in the response for all Azure Resource Manager resources + internal partial interface IResourceAutoGeneratedInternal + + { + /// + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// + string Id { get; set; } + /// The name of the resource + string Name { get; set; } + /// + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + /// + string Type { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/ResourceAutoGenerated.json.cs b/src/Security/Security.Autorest/generated/api/Models/ResourceAutoGenerated.json.cs new file mode 100644 index 000000000000..8548b1fe335b --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/ResourceAutoGenerated.json.cs @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// + /// Common fields that are returned in the response for all Azure Resource Manager resources + /// + public partial class ResourceAutoGenerated + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGenerated. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGenerated. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceAutoGenerated FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new ResourceAutoGenerated(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal ResourceAutoGenerated(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)_id;} + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)_name;} + {_type = If( json?.PropertyT("type"), out var __jsonType) ? (string)__jsonType : (string)_type;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._type.ToString()) : null, "type" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/ResourceKind.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/ResourceKind.PowerShell.cs new file mode 100644 index 000000000000..aa85b666d5a9 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/ResourceKind.PowerShell.cs @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// Describes an Azure resource with kind + [System.ComponentModel.TypeConverter(typeof(ResourceKindTypeConverter))] + public partial class ResourceKind + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceKind DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ResourceKind(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceKind DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ResourceKind(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceKind FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ResourceKind(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Kind")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceKindInternal)this).Kind = (string) content.GetValueForProperty("Kind",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceKindInternal)this).Kind, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ResourceKind(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Kind")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceKindInternal)this).Kind = (string) content.GetValueForProperty("Kind",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceKindInternal)this).Kind, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// Describes an Azure resource with kind + [System.ComponentModel.TypeConverter(typeof(ResourceKindTypeConverter))] + public partial interface IResourceKind + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/ResourceKind.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/ResourceKind.TypeConverter.cs new file mode 100644 index 000000000000..c7538cb669f0 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/ResourceKind.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ResourceKindTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceKind ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceKind).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ResourceKind.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ResourceKind.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ResourceKind.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/ResourceKind.cs b/src/Security/Security.Autorest/generated/api/Models/ResourceKind.cs new file mode 100644 index 000000000000..6d6d81107d6b --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/ResourceKind.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// Describes an Azure resource with kind + public partial class ResourceKind : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceKind, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceKindInternal + { + + /// Backing field for property. + private string _kind; + + /// Kind of the resource + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string Kind { get => this._kind; set => this._kind = value; } + + /// Creates an new instance. + public ResourceKind() + { + + } + } + /// Describes an Azure resource with kind + public partial interface IResourceKind : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// Kind of the resource + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Kind of the resource", + SerializedName = @"kind", + PossibleTypes = new [] { typeof(string) })] + string Kind { get; set; } + + } + /// Describes an Azure resource with kind + internal partial interface IResourceKindInternal + + { + /// Kind of the resource + string Kind { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/ResourceKind.json.cs b/src/Security/Security.Autorest/generated/api/Models/ResourceKind.json.cs new file mode 100644 index 000000000000..bab5b40d298c --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/ResourceKind.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// Describes an Azure resource with kind + public partial class ResourceKind + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceKind. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceKind. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceKind FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new ResourceKind(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal ResourceKind(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_kind = If( json?.PropertyT("kind"), out var __jsonKind) ? (string)__jsonKind : (string)_kind;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._kind)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._kind.ToString()) : null, "kind" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/SecurityConnector.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/SecurityConnector.PowerShell.cs new file mode 100644 index 000000000000..6ac6e6a958b8 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/SecurityConnector.PowerShell.cs @@ -0,0 +1,316 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The security connector resource. + [System.ComponentModel.TypeConverter(typeof(SecurityConnectorTypeConverter))] + public partial class SecurityConnector + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnector DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new SecurityConnector(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnector DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new SecurityConnector(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnector FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal SecurityConnector(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SecurityConnectorPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureTrackedResourceLocationInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureTrackedResourceLocationInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("Kind")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceKindInternal)this).Kind = (string) content.GetValueForProperty("Kind",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceKindInternal)this).Kind, global::System.Convert.ToString); + } + if (content.Contains("Etag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IETagInternal)this).Etag = (string) content.GetValueForProperty("Etag",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IETagInternal)this).Etag, global::System.Convert.ToString); + } + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITags1Internal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITags1Internal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.TagsTypeConverter.ConvertFrom); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("HierarchyIdentifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorInternal)this).HierarchyIdentifier = (string) content.GetValueForProperty("HierarchyIdentifier",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorInternal)this).HierarchyIdentifier, global::System.Convert.ToString); + } + if (content.Contains("HierarchyIdentifierTrialEndDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorInternal)this).HierarchyIdentifierTrialEndDate = (global::System.DateTime?) content.GetValueForProperty("HierarchyIdentifierTrialEndDate",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorInternal)this).HierarchyIdentifierTrialEndDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("EnvironmentName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorInternal)this).EnvironmentName = (string) content.GetValueForProperty("EnvironmentName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorInternal)this).EnvironmentName, global::System.Convert.ToString); + } + if (content.Contains("Offering")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorInternal)this).Offering = (System.Collections.Generic.List) content.GetValueForProperty("Offering",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorInternal)this).Offering, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CloudOfferingTypeConverter.ConvertFrom)); + } + if (content.Contains("EnvironmentData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorInternal)this).EnvironmentData = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironment) content.GetValueForProperty("EnvironmentData",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorInternal)this).EnvironmentData, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SecurityConnectorEnvironmentTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal SecurityConnector(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SecurityConnectorPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureTrackedResourceLocationInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureTrackedResourceLocationInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("Kind")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceKindInternal)this).Kind = (string) content.GetValueForProperty("Kind",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceKindInternal)this).Kind, global::System.Convert.ToString); + } + if (content.Contains("Etag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IETagInternal)this).Etag = (string) content.GetValueForProperty("Etag",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IETagInternal)this).Etag, global::System.Convert.ToString); + } + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITags1Internal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITags1Internal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.TagsTypeConverter.ConvertFrom); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("HierarchyIdentifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorInternal)this).HierarchyIdentifier = (string) content.GetValueForProperty("HierarchyIdentifier",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorInternal)this).HierarchyIdentifier, global::System.Convert.ToString); + } + if (content.Contains("HierarchyIdentifierTrialEndDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorInternal)this).HierarchyIdentifierTrialEndDate = (global::System.DateTime?) content.GetValueForProperty("HierarchyIdentifierTrialEndDate",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorInternal)this).HierarchyIdentifierTrialEndDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("EnvironmentName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorInternal)this).EnvironmentName = (string) content.GetValueForProperty("EnvironmentName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorInternal)this).EnvironmentName, global::System.Convert.ToString); + } + if (content.Contains("Offering")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorInternal)this).Offering = (System.Collections.Generic.List) content.GetValueForProperty("Offering",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorInternal)this).Offering, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CloudOfferingTypeConverter.ConvertFrom)); + } + if (content.Contains("EnvironmentData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorInternal)this).EnvironmentData = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironment) content.GetValueForProperty("EnvironmentData",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorInternal)this).EnvironmentData, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SecurityConnectorEnvironmentTypeConverter.ConvertFrom); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The security connector resource. + [System.ComponentModel.TypeConverter(typeof(SecurityConnectorTypeConverter))] + public partial interface ISecurityConnector + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/SecurityConnector.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/SecurityConnector.TypeConverter.cs new file mode 100644 index 000000000000..3ce5923ed9f4 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/SecurityConnector.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class SecurityConnectorTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnector ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnector).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return SecurityConnector.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return SecurityConnector.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return SecurityConnector.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/SecurityConnector.cs b/src/Security/Security.Autorest/generated/api/Models/SecurityConnector.cs new file mode 100644 index 000000000000..e608756ebde5 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/SecurityConnector.cs @@ -0,0 +1,352 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The security connector resource. + public partial class SecurityConnector : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnector, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorInternal, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITrackedResource __trackedResource = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.TrackedResource(); + + /// The security connector environment data. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.DoNotFormat] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironment EnvironmentData { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorPropertiesInternal)Property).EnvironmentData; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorPropertiesInternal)Property).EnvironmentData = value ?? null /* model class */; } + + /// The multi cloud resource's cloud name. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.FormatTable(Index = 2)] + public string EnvironmentName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorPropertiesInternal)Property).EnvironmentName; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorPropertiesInternal)Property).EnvironmentName = value ?? null; } + + /// + /// Entity tag is used for comparing two or more entities from the same requested resource. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.DoNotFormat] + public string Etag { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IETagInternal)__trackedResource).Etag; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IETagInternal)__trackedResource).Etag = value ?? null; } + + /// + /// The multi cloud resource identifier (account id in case of AWS connector, project number in case of GCP connector). + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.FormatTable(Index = 4)] + public string HierarchyIdentifier { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorPropertiesInternal)Property).HierarchyIdentifier; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorPropertiesInternal)Property).HierarchyIdentifier = value ?? null; } + + /// + /// The date on which the trial period will end, if applicable. Trial period exists for 30 days after upgrading to payed offerings. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.DoNotFormat] + public global::System.DateTime? HierarchyIdentifierTrialEndDate { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorPropertiesInternal)Property).HierarchyIdentifierTrialEndDate; } + + /// Resource Id + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.DoNotFormat] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)__trackedResource).Id; } + + /// Kind of the resource + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.DoNotFormat] + public string Kind { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceKindInternal)__trackedResource).Kind; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceKindInternal)__trackedResource).Kind = value ?? null; } + + /// Location where the resource is stored + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.FormatTable(Index = 3)] + public string Location { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureTrackedResourceLocationInternal)__trackedResource).Location; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureTrackedResourceLocationInternal)__trackedResource).Location = value ?? null; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)__trackedResource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)__trackedResource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)__trackedResource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)__trackedResource).Name = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)__trackedResource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)__trackedResource).Type = value; } + + /// Internal Acessors for HierarchyIdentifierTrialEndDate + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorInternal.HierarchyIdentifierTrialEndDate { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorPropertiesInternal)Property).HierarchyIdentifierTrialEndDate; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorPropertiesInternal)Property).HierarchyIdentifierTrialEndDate = value; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorProperties Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SecurityConnectorProperties()); set { {_property = value;} } } + + /// Internal Acessors for SystemData + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemData Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorInternal.SystemData { get => (this._systemData = this._systemData ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SystemData()); set { {_systemData = value;} } } + + /// Resource name + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.FormatTable(Index = 0)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)__trackedResource).Name; } + + /// A collection of offerings for the security connector. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.DoNotFormat] + public System.Collections.Generic.List Offering { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorPropertiesInternal)Property).Offering; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorPropertiesInternal)Property).Offering = value ?? null /* arrayOf */; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorProperties _property; + + /// Security connector data + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.DoNotFormat] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SecurityConnectorProperties()); set => this._property = value; } + + /// Gets the resource group name + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.FormatTable(Index = 1)] + public string ResourceGroupName { get => (new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Success ? new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Groups["resourceGroupName"].Value : null); } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemData _systemData; + + /// + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.DoNotFormat] + internal Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemData SystemData { get => (this._systemData = this._systemData ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SystemData()); } + + /// The timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.DoNotFormat] + public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).CreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).CreatedAt = value ?? default(global::System.DateTime); } + + /// The identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.DoNotFormat] + public string SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).CreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).CreatedBy = value ?? null; } + + /// The type of identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.DoNotFormat] + public string SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).CreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).CreatedByType = value ?? null; } + + /// The timestamp of resource last modification (UTC) + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.DoNotFormat] + public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).LastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).LastModifiedAt = value ?? default(global::System.DateTime); } + + /// The identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.DoNotFormat] + public string SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).LastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).LastModifiedBy = value ?? null; } + + /// The type of identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.DoNotFormat] + public string SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).LastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)SystemData).LastModifiedByType = value ?? null; } + + /// A list of key value pairs that describe the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.DoNotFormat] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITags Tag { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITags1Internal)__trackedResource).Tag; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITags1Internal)__trackedResource).Tag = value ?? null /* model class */; } + + /// Resource type + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.DoNotFormat] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)__trackedResource).Type; } + + /// Creates an new instance. + public SecurityConnector() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__trackedResource), __trackedResource); + await eventListener.AssertObjectIsValid(nameof(__trackedResource), __trackedResource); + } + } + /// The security connector resource. + public partial interface ISecurityConnector : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITrackedResource + { + /// The security connector environment data. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The security connector environment data.", + SerializedName = @"environmentData", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironment) })] + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironment EnvironmentData { get; set; } + /// The multi cloud resource's cloud name. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The multi cloud resource's cloud name.", + SerializedName = @"environmentName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Azure", "AWS", "GCP", "Github", "AzureDevOps", "GitLab")] + string EnvironmentName { get; set; } + /// + /// The multi cloud resource identifier (account id in case of AWS connector, project number in case of GCP connector). + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The multi cloud resource identifier (account id in case of AWS connector, project number in case of GCP connector).", + SerializedName = @"hierarchyIdentifier", + PossibleTypes = new [] { typeof(string) })] + string HierarchyIdentifier { get; set; } + /// + /// The date on which the trial period will end, if applicable. Trial period exists for 30 days after upgrading to payed offerings. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The date on which the trial period will end, if applicable. Trial period exists for 30 days after upgrading to payed offerings.", + SerializedName = @"hierarchyIdentifierTrialEndDate", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? HierarchyIdentifierTrialEndDate { get; } + /// A collection of offerings for the security connector. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"A collection of offerings for the security connector.", + SerializedName = @"offerings", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOffering) })] + System.Collections.Generic.List Offering { get; set; } + /// The timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The timestamp of resource creation (UTC).", + SerializedName = @"createdAt", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? SystemDataCreatedAt { get; } + /// The identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The identity that created the resource.", + SerializedName = @"createdBy", + PossibleTypes = new [] { typeof(string) })] + string SystemDataCreatedBy { get; } + /// The type of identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The type of identity that created the resource.", + SerializedName = @"createdByType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string SystemDataCreatedByType { get; } + /// The timestamp of resource last modification (UTC) + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The timestamp of resource last modification (UTC)", + SerializedName = @"lastModifiedAt", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? SystemDataLastModifiedAt { get; } + /// The identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The identity that last modified the resource.", + SerializedName = @"lastModifiedBy", + PossibleTypes = new [] { typeof(string) })] + string SystemDataLastModifiedBy { get; } + /// The type of identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The type of identity that last modified the resource.", + SerializedName = @"lastModifiedByType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string SystemDataLastModifiedByType { get; } + + } + /// The security connector resource. + internal partial interface ISecurityConnectorInternal : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITrackedResourceInternal + { + /// The security connector environment data. + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironment EnvironmentData { get; set; } + /// The multi cloud resource's cloud name. + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Azure", "AWS", "GCP", "Github", "AzureDevOps", "GitLab")] + string EnvironmentName { get; set; } + /// + /// The multi cloud resource identifier (account id in case of AWS connector, project number in case of GCP connector). + /// + string HierarchyIdentifier { get; set; } + /// + /// The date on which the trial period will end, if applicable. Trial period exists for 30 days after upgrading to payed offerings. + /// + global::System.DateTime? HierarchyIdentifierTrialEndDate { get; set; } + /// A collection of offerings for the security connector. + System.Collections.Generic.List Offering { get; set; } + /// Security connector data + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorProperties Property { get; set; } + /// + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemData SystemData { get; set; } + /// The timestamp of resource creation (UTC). + global::System.DateTime? SystemDataCreatedAt { get; set; } + /// The identity that created the resource. + string SystemDataCreatedBy { get; set; } + /// The type of identity that created the resource. + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string SystemDataCreatedByType { get; set; } + /// The timestamp of resource last modification (UTC) + global::System.DateTime? SystemDataLastModifiedAt { get; set; } + /// The identity that last modified the resource. + string SystemDataLastModifiedBy { get; set; } + /// The type of identity that last modified the resource. + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string SystemDataLastModifiedByType { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/SecurityConnector.json.cs b/src/Security/Security.Autorest/generated/api/Models/SecurityConnector.json.cs new file mode 100644 index 000000000000..b1e7e384ebeb --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/SecurityConnector.json.cs @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The security connector resource. + public partial class SecurityConnector + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnector. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnector. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnector FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new SecurityConnector(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal SecurityConnector(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __trackedResource = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.TrackedResource(json); + {_systemData = If( json?.PropertyT("systemData"), out var __jsonSystemData) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SystemData.FromJson(__jsonSystemData) : _systemData;} + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SecurityConnectorProperties.FromJson(__jsonProperties) : _property;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __trackedResource?.ToJson(container, serializationMode); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._systemData ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._systemData.ToJson(null,serializationMode) : null, "systemData" ,container.Add ); + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/SecurityConnectorEnvironment.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/SecurityConnectorEnvironment.PowerShell.cs new file mode 100644 index 000000000000..c23b1f122168 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/SecurityConnectorEnvironment.PowerShell.cs @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// The security connector environment data. + [System.ComponentModel.TypeConverter(typeof(SecurityConnectorEnvironmentTypeConverter))] + public partial class SecurityConnectorEnvironment + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironment DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new SecurityConnectorEnvironment(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironment DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new SecurityConnectorEnvironment(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironment FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal SecurityConnectorEnvironment(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("EnvironmentType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironmentInternal)this).EnvironmentType = (string) content.GetValueForProperty("EnvironmentType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironmentInternal)this).EnvironmentType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal SecurityConnectorEnvironment(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("EnvironmentType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironmentInternal)this).EnvironmentType = (string) content.GetValueForProperty("EnvironmentType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironmentInternal)this).EnvironmentType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The security connector environment data. + [System.ComponentModel.TypeConverter(typeof(SecurityConnectorEnvironmentTypeConverter))] + public partial interface ISecurityConnectorEnvironment + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/SecurityConnectorEnvironment.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/SecurityConnectorEnvironment.TypeConverter.cs new file mode 100644 index 000000000000..2821fd6e83a5 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/SecurityConnectorEnvironment.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class SecurityConnectorEnvironmentTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironment ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironment).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return SecurityConnectorEnvironment.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return SecurityConnectorEnvironment.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return SecurityConnectorEnvironment.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/SecurityConnectorEnvironment.cs b/src/Security/Security.Autorest/generated/api/Models/SecurityConnectorEnvironment.cs new file mode 100644 index 000000000000..6edc5768effd --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/SecurityConnectorEnvironment.cs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The security connector environment data. + public partial class SecurityConnectorEnvironment : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironment, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironmentInternal + { + + /// Backing field for property. + private string _environmentType; + + /// The type of the environment data. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string EnvironmentType { get => this._environmentType; set => this._environmentType = value; } + + /// Creates an new instance. + public SecurityConnectorEnvironment() + { + + } + } + /// The security connector environment data. + public partial interface ISecurityConnectorEnvironment : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// The type of the environment data. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The type of the environment data.", + SerializedName = @"environmentType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("AwsAccount", "GcpProject", "GithubScope", "AzureDevOpsScope", "GitlabScope")] + string EnvironmentType { get; set; } + + } + /// The security connector environment data. + internal partial interface ISecurityConnectorEnvironmentInternal + + { + /// The type of the environment data. + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("AwsAccount", "GcpProject", "GithubScope", "AzureDevOpsScope", "GitlabScope")] + string EnvironmentType { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/SecurityConnectorEnvironment.json.cs b/src/Security/Security.Autorest/generated/api/Models/SecurityConnectorEnvironment.json.cs new file mode 100644 index 000000000000..c142ab13be13 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/SecurityConnectorEnvironment.json.cs @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// The security connector environment data. + public partial class SecurityConnectorEnvironment + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironment. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironment interface is polymorphic, and + /// the precise model class that will get deserialized is determined at runtime based on the payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironment. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironment FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("environmentType") ) + { + case "AwsAccount": + { + return new AwsEnvironment(json); + } + case "GcpProject": + { + return new GcpProjectEnvironment(json); + } + case "AzureDevOpsScope": + { + return new AzureDevOpsScopeEnvironment(json); + } + case "GitlabScope": + { + return new GitLabScopeEnvironment(json); + } + case "GithubScope": + { + return new GitHubScopeEnvironment(json); + } + } + return new SecurityConnectorEnvironment(json); + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal SecurityConnectorEnvironment(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_environmentType = If( json?.PropertyT("environmentType"), out var __jsonEnvironmentType) ? (string)__jsonEnvironmentType : (string)_environmentType;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._environmentType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._environmentType.ToString()) : null, "environmentType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/SecurityConnectorProperties.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/SecurityConnectorProperties.PowerShell.cs new file mode 100644 index 000000000000..f93143f7fbcc --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/SecurityConnectorProperties.PowerShell.cs @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// A set of properties that defines the security connector configuration. + [System.ComponentModel.TypeConverter(typeof(SecurityConnectorPropertiesTypeConverter))] + public partial class SecurityConnectorProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new SecurityConnectorProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new SecurityConnectorProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal SecurityConnectorProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("HierarchyIdentifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorPropertiesInternal)this).HierarchyIdentifier = (string) content.GetValueForProperty("HierarchyIdentifier",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorPropertiesInternal)this).HierarchyIdentifier, global::System.Convert.ToString); + } + if (content.Contains("HierarchyIdentifierTrialEndDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorPropertiesInternal)this).HierarchyIdentifierTrialEndDate = (global::System.DateTime?) content.GetValueForProperty("HierarchyIdentifierTrialEndDate",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorPropertiesInternal)this).HierarchyIdentifierTrialEndDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("EnvironmentName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorPropertiesInternal)this).EnvironmentName = (string) content.GetValueForProperty("EnvironmentName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorPropertiesInternal)this).EnvironmentName, global::System.Convert.ToString); + } + if (content.Contains("Offering")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorPropertiesInternal)this).Offering = (System.Collections.Generic.List) content.GetValueForProperty("Offering",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorPropertiesInternal)this).Offering, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CloudOfferingTypeConverter.ConvertFrom)); + } + if (content.Contains("EnvironmentData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorPropertiesInternal)this).EnvironmentData = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironment) content.GetValueForProperty("EnvironmentData",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorPropertiesInternal)this).EnvironmentData, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SecurityConnectorEnvironmentTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal SecurityConnectorProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("HierarchyIdentifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorPropertiesInternal)this).HierarchyIdentifier = (string) content.GetValueForProperty("HierarchyIdentifier",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorPropertiesInternal)this).HierarchyIdentifier, global::System.Convert.ToString); + } + if (content.Contains("HierarchyIdentifierTrialEndDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorPropertiesInternal)this).HierarchyIdentifierTrialEndDate = (global::System.DateTime?) content.GetValueForProperty("HierarchyIdentifierTrialEndDate",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorPropertiesInternal)this).HierarchyIdentifierTrialEndDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("EnvironmentName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorPropertiesInternal)this).EnvironmentName = (string) content.GetValueForProperty("EnvironmentName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorPropertiesInternal)this).EnvironmentName, global::System.Convert.ToString); + } + if (content.Contains("Offering")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorPropertiesInternal)this).Offering = (System.Collections.Generic.List) content.GetValueForProperty("Offering",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorPropertiesInternal)this).Offering, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CloudOfferingTypeConverter.ConvertFrom)); + } + if (content.Contains("EnvironmentData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorPropertiesInternal)this).EnvironmentData = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironment) content.GetValueForProperty("EnvironmentData",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorPropertiesInternal)this).EnvironmentData, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SecurityConnectorEnvironmentTypeConverter.ConvertFrom); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// A set of properties that defines the security connector configuration. + [System.ComponentModel.TypeConverter(typeof(SecurityConnectorPropertiesTypeConverter))] + public partial interface ISecurityConnectorProperties + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/SecurityConnectorProperties.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/SecurityConnectorProperties.TypeConverter.cs new file mode 100644 index 000000000000..4b25d2ea111e --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/SecurityConnectorProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class SecurityConnectorPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return SecurityConnectorProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return SecurityConnectorProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return SecurityConnectorProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/SecurityConnectorProperties.cs b/src/Security/Security.Autorest/generated/api/Models/SecurityConnectorProperties.cs new file mode 100644 index 000000000000..9b480fcef076 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/SecurityConnectorProperties.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// A set of properties that defines the security connector configuration. + public partial class SecurityConnectorProperties : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorProperties, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorPropertiesInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironment _environmentData; + + /// The security connector environment data. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironment EnvironmentData { get => (this._environmentData = this._environmentData ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SecurityConnectorEnvironment()); set => this._environmentData = value; } + + /// Backing field for property. + private string _environmentName; + + /// The multi cloud resource's cloud name. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string EnvironmentName { get => this._environmentName; set => this._environmentName = value; } + + /// Backing field for property. + private string _hierarchyIdentifier; + + /// + /// The multi cloud resource identifier (account id in case of AWS connector, project number in case of GCP connector). + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string HierarchyIdentifier { get => this._hierarchyIdentifier; set => this._hierarchyIdentifier = value; } + + /// Backing field for property. + private global::System.DateTime? _hierarchyIdentifierTrialEndDate; + + /// + /// The date on which the trial period will end, if applicable. Trial period exists for 30 days after upgrading to payed offerings. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public global::System.DateTime? HierarchyIdentifierTrialEndDate { get => this._hierarchyIdentifierTrialEndDate; } + + /// Internal Acessors for HierarchyIdentifierTrialEndDate + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorPropertiesInternal.HierarchyIdentifierTrialEndDate { get => this._hierarchyIdentifierTrialEndDate; set { {_hierarchyIdentifierTrialEndDate = value;} } } + + /// Backing field for property. + private System.Collections.Generic.List _offering; + + /// A collection of offerings for the security connector. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public System.Collections.Generic.List Offering { get => this._offering; set => this._offering = value; } + + /// Creates an new instance. + public SecurityConnectorProperties() + { + + } + } + /// A set of properties that defines the security connector configuration. + public partial interface ISecurityConnectorProperties : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// The security connector environment data. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The security connector environment data.", + SerializedName = @"environmentData", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironment) })] + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironment EnvironmentData { get; set; } + /// The multi cloud resource's cloud name. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The multi cloud resource's cloud name.", + SerializedName = @"environmentName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Azure", "AWS", "GCP", "Github", "AzureDevOps", "GitLab")] + string EnvironmentName { get; set; } + /// + /// The multi cloud resource identifier (account id in case of AWS connector, project number in case of GCP connector). + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The multi cloud resource identifier (account id in case of AWS connector, project number in case of GCP connector).", + SerializedName = @"hierarchyIdentifier", + PossibleTypes = new [] { typeof(string) })] + string HierarchyIdentifier { get; set; } + /// + /// The date on which the trial period will end, if applicable. Trial period exists for 30 days after upgrading to payed offerings. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The date on which the trial period will end, if applicable. Trial period exists for 30 days after upgrading to payed offerings.", + SerializedName = @"hierarchyIdentifierTrialEndDate", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? HierarchyIdentifierTrialEndDate { get; } + /// A collection of offerings for the security connector. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"A collection of offerings for the security connector.", + SerializedName = @"offerings", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOffering) })] + System.Collections.Generic.List Offering { get; set; } + + } + /// A set of properties that defines the security connector configuration. + internal partial interface ISecurityConnectorPropertiesInternal + + { + /// The security connector environment data. + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironment EnvironmentData { get; set; } + /// The multi cloud resource's cloud name. + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Azure", "AWS", "GCP", "Github", "AzureDevOps", "GitLab")] + string EnvironmentName { get; set; } + /// + /// The multi cloud resource identifier (account id in case of AWS connector, project number in case of GCP connector). + /// + string HierarchyIdentifier { get; set; } + /// + /// The date on which the trial period will end, if applicable. Trial period exists for 30 days after upgrading to payed offerings. + /// + global::System.DateTime? HierarchyIdentifierTrialEndDate { get; set; } + /// A collection of offerings for the security connector. + System.Collections.Generic.List Offering { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/SecurityConnectorProperties.json.cs b/src/Security/Security.Autorest/generated/api/Models/SecurityConnectorProperties.json.cs new file mode 100644 index 000000000000..b17884650275 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/SecurityConnectorProperties.json.cs @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// A set of properties that defines the security connector configuration. + public partial class SecurityConnectorProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new SecurityConnectorProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal SecurityConnectorProperties(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_hierarchyIdentifier = If( json?.PropertyT("hierarchyIdentifier"), out var __jsonHierarchyIdentifier) ? (string)__jsonHierarchyIdentifier : (string)_hierarchyIdentifier;} + {_hierarchyIdentifierTrialEndDate = If( json?.PropertyT("hierarchyIdentifierTrialEndDate"), out var __jsonHierarchyIdentifierTrialEndDate) ? global::System.DateTime.TryParse((string)__jsonHierarchyIdentifierTrialEndDate, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonHierarchyIdentifierTrialEndDateValue) ? __jsonHierarchyIdentifierTrialEndDateValue : _hierarchyIdentifierTrialEndDate : _hierarchyIdentifierTrialEndDate;} + {_environmentName = If( json?.PropertyT("environmentName"), out var __jsonEnvironmentName) ? (string)__jsonEnvironmentName : (string)_environmentName;} + {_offering = If( json?.PropertyT("offerings"), out var __jsonOfferings) ? If( __jsonOfferings as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOffering) (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CloudOffering.FromJson(__u) )) ))() : null : _offering;} + {_environmentData = If( json?.PropertyT("environmentData"), out var __jsonEnvironmentData) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SecurityConnectorEnvironment.FromJson(__jsonEnvironmentData) : _environmentData;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._hierarchyIdentifier)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._hierarchyIdentifier.ToString()) : null, "hierarchyIdentifier" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._hierarchyIdentifierTrialEndDate ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._hierarchyIdentifierTrialEndDate?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "hierarchyIdentifierTrialEndDate" ,container.Add ); + } + AddIf( null != (((object)this._environmentName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._environmentName.ToString()) : null, "environmentName" ,container.Add ); + if (null != this._offering) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.XNodeArray(); + foreach( var __x in this._offering ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("offerings",__w); + } + AddIf( null != this._environmentData ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._environmentData.ToJson(null,serializationMode) : null, "environmentData" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/SecurityConnectorsList.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/SecurityConnectorsList.PowerShell.cs new file mode 100644 index 000000000000..80442cbeb47e --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/SecurityConnectorsList.PowerShell.cs @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// List of security connectors response. + [System.ComponentModel.TypeConverter(typeof(SecurityConnectorsListTypeConverter))] + public partial class SecurityConnectorsList + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorsList DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new SecurityConnectorsList(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorsList DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new SecurityConnectorsList(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorsList FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal SecurityConnectorsList(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorsListInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorsListInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SecurityConnectorTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorsListInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorsListInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal SecurityConnectorsList(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorsListInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorsListInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SecurityConnectorTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorsListInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorsListInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// List of security connectors response. + [System.ComponentModel.TypeConverter(typeof(SecurityConnectorsListTypeConverter))] + public partial interface ISecurityConnectorsList + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/SecurityConnectorsList.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/SecurityConnectorsList.TypeConverter.cs new file mode 100644 index 000000000000..8a568e7f23ab --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/SecurityConnectorsList.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class SecurityConnectorsListTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorsList ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorsList).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return SecurityConnectorsList.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return SecurityConnectorsList.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return SecurityConnectorsList.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/SecurityConnectorsList.cs b/src/Security/Security.Autorest/generated/api/Models/SecurityConnectorsList.cs new file mode 100644 index 000000000000..82ddd22a0cfb --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/SecurityConnectorsList.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// List of security connectors response. + public partial class SecurityConnectorsList : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorsList, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorsListInternal + { + + /// Internal Acessors for NextLink + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorsListInternal.NextLink { get => this._nextLink; set { {_nextLink = value;} } } + + /// Backing field for property. + private string _nextLink; + + /// The URI to fetch the next page. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; } + + /// Backing field for property. + private System.Collections.Generic.List _value; + + /// The list of security connectors under the given scope. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public System.Collections.Generic.List Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public SecurityConnectorsList() + { + + } + } + /// List of security connectors response. + public partial interface ISecurityConnectorsList : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// The URI to fetch the next page. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The URI to fetch the next page.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; } + /// The list of security connectors under the given scope. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The list of security connectors under the given scope.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnector) })] + System.Collections.Generic.List Value { get; set; } + + } + /// List of security connectors response. + internal partial interface ISecurityConnectorsListInternal + + { + /// The URI to fetch the next page. + string NextLink { get; set; } + /// The list of security connectors under the given scope. + System.Collections.Generic.List Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/SecurityConnectorsList.json.cs b/src/Security/Security.Autorest/generated/api/Models/SecurityConnectorsList.json.cs new file mode 100644 index 000000000000..1be789252691 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/SecurityConnectorsList.json.cs @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// List of security connectors response. + public partial class SecurityConnectorsList + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorsList. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorsList. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorsList FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new SecurityConnectorsList(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal SecurityConnectorsList(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnector) (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SecurityConnector.FromJson(__u) )) ))() : null : _value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)_nextLink;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/SecurityIdentity.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/SecurityIdentity.PowerShell.cs new file mode 100644 index 000000000000..77151213f1df --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/SecurityIdentity.PowerShell.cs @@ -0,0 +1,250 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + [System.ComponentModel.TypeConverter(typeof(SecurityIdentityTypeConverter))] + public partial class SecurityIdentity + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new SecurityIdentity(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new SecurityIdentity(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal SecurityIdentity(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SubscriptionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentityInternal)this).SubscriptionId = (string) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentityInternal)this).SubscriptionId, global::System.Convert.ToString); + } + if (content.Contains("ResourceGroupName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentityInternal)this).ResourceGroupName = (string) content.GetValueForProperty("ResourceGroupName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentityInternal)this).ResourceGroupName, global::System.Convert.ToString); + } + if (content.Contains("SecurityConnectorName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentityInternal)this).SecurityConnectorName = (string) content.GetValueForProperty("SecurityConnectorName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentityInternal)this).SecurityConnectorName, global::System.Convert.ToString); + } + if (content.Contains("OrgName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentityInternal)this).OrgName = (string) content.GetValueForProperty("OrgName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentityInternal)this).OrgName, global::System.Convert.ToString); + } + if (content.Contains("ProjectName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentityInternal)this).ProjectName = (string) content.GetValueForProperty("ProjectName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentityInternal)this).ProjectName, global::System.Convert.ToString); + } + if (content.Contains("RepoName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentityInternal)this).RepoName = (string) content.GetValueForProperty("RepoName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentityInternal)this).RepoName, global::System.Convert.ToString); + } + if (content.Contains("OwnerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentityInternal)this).OwnerName = (string) content.GetValueForProperty("OwnerName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentityInternal)this).OwnerName, global::System.Convert.ToString); + } + if (content.Contains("GroupFqName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentityInternal)this).GroupFqName = (string) content.GetValueForProperty("GroupFqName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentityInternal)this).GroupFqName, global::System.Convert.ToString); + } + if (content.Contains("OperationResultId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentityInternal)this).OperationResultId = (string) content.GetValueForProperty("OperationResultId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentityInternal)this).OperationResultId, global::System.Convert.ToString); + } + if (content.Contains("ServiceName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentityInternal)this).ServiceName = (string) content.GetValueForProperty("ServiceName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentityInternal)this).ServiceName, global::System.Convert.ToString); + } + if (content.Contains("ApiId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentityInternal)this).ApiId = (string) content.GetValueForProperty("ApiId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentityInternal)this).ApiId, global::System.Convert.ToString); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentityInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentityInternal)this).Id, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal SecurityIdentity(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SubscriptionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentityInternal)this).SubscriptionId = (string) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentityInternal)this).SubscriptionId, global::System.Convert.ToString); + } + if (content.Contains("ResourceGroupName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentityInternal)this).ResourceGroupName = (string) content.GetValueForProperty("ResourceGroupName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentityInternal)this).ResourceGroupName, global::System.Convert.ToString); + } + if (content.Contains("SecurityConnectorName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentityInternal)this).SecurityConnectorName = (string) content.GetValueForProperty("SecurityConnectorName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentityInternal)this).SecurityConnectorName, global::System.Convert.ToString); + } + if (content.Contains("OrgName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentityInternal)this).OrgName = (string) content.GetValueForProperty("OrgName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentityInternal)this).OrgName, global::System.Convert.ToString); + } + if (content.Contains("ProjectName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentityInternal)this).ProjectName = (string) content.GetValueForProperty("ProjectName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentityInternal)this).ProjectName, global::System.Convert.ToString); + } + if (content.Contains("RepoName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentityInternal)this).RepoName = (string) content.GetValueForProperty("RepoName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentityInternal)this).RepoName, global::System.Convert.ToString); + } + if (content.Contains("OwnerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentityInternal)this).OwnerName = (string) content.GetValueForProperty("OwnerName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentityInternal)this).OwnerName, global::System.Convert.ToString); + } + if (content.Contains("GroupFqName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentityInternal)this).GroupFqName = (string) content.GetValueForProperty("GroupFqName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentityInternal)this).GroupFqName, global::System.Convert.ToString); + } + if (content.Contains("OperationResultId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentityInternal)this).OperationResultId = (string) content.GetValueForProperty("OperationResultId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentityInternal)this).OperationResultId, global::System.Convert.ToString); + } + if (content.Contains("ServiceName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentityInternal)this).ServiceName = (string) content.GetValueForProperty("ServiceName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentityInternal)this).ServiceName, global::System.Convert.ToString); + } + if (content.Contains("ApiId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentityInternal)this).ApiId = (string) content.GetValueForProperty("ApiId",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentityInternal)this).ApiId, global::System.Convert.ToString); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentityInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentityInternal)this).Id, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + [System.ComponentModel.TypeConverter(typeof(SecurityIdentityTypeConverter))] + public partial interface ISecurityIdentity + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/SecurityIdentity.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/SecurityIdentity.TypeConverter.cs new file mode 100644 index 000000000000..c250c0679052 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/SecurityIdentity.TypeConverter.cs @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class SecurityIdentityTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + // we allow string conversion too. + if (type == typeof(global::System.String)) + { + return true; + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + // support direct string to id type conversion. + if (type == typeof(global::System.String)) + { + return new SecurityIdentity { Id = sourceValue }; + } + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return SecurityIdentity.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return SecurityIdentity.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return SecurityIdentity.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/SecurityIdentity.cs b/src/Security/Security.Autorest/generated/api/Models/SecurityIdentity.cs new file mode 100644 index 000000000000..a1c4874d60d0 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/SecurityIdentity.cs @@ -0,0 +1,286 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + public partial class SecurityIdentity : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentityInternal + { + + /// Backing field for property. + private string _apiId; + + /// + /// API revision identifier. Must be unique in the API Management service instance. Non-current revision has ;rev=n as a suffix + /// where n is the revision number. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string ApiId { get => this._apiId; set => this._apiId = value; } + + /// Backing field for property. + private string _groupFqName; + + /// The GitLab group fully-qualified name. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string GroupFqName { get => this._groupFqName; set => this._groupFqName = value; } + + /// Backing field for property. + private string _id; + + /// Resource identity path + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string Id { get => this._id; set => this._id = value; } + + /// Backing field for property. + private string _operationResultId; + + /// The operation result Id. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string OperationResultId { get => this._operationResultId; set => this._operationResultId = value; } + + /// Backing field for property. + private string _orgName; + + /// The Azure DevOps organization name. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string OrgName { get => this._orgName; set => this._orgName = value; } + + /// Backing field for property. + private string _ownerName; + + /// The GitHub owner name. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string OwnerName { get => this._ownerName; set => this._ownerName = value; } + + /// Backing field for property. + private string _projectName; + + /// The project name. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string ProjectName { get => this._projectName; set => this._projectName = value; } + + /// Backing field for property. + private string _repoName; + + /// The repository name. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string RepoName { get => this._repoName; set => this._repoName = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// + /// The name of the resource group within the user's subscription. The name is case insensitive. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _securityConnectorName; + + /// The security connector name. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string SecurityConnectorName { get => this._securityConnectorName; set => this._securityConnectorName = value; } + + /// Backing field for property. + private string _serviceName; + + /// The name of the API Management service. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string ServiceName { get => this._serviceName; set => this._serviceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// Azure subscription ID + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Creates an new instance. + public SecurityIdentity() + { + + } + } + public partial interface ISecurityIdentity : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// + /// API revision identifier. Must be unique in the API Management service instance. Non-current revision has ;rev=n as a suffix + /// where n is the revision number. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"API revision identifier. Must be unique in the API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number.", + SerializedName = @"apiId", + PossibleTypes = new [] { typeof(string) })] + string ApiId { get; set; } + /// The GitLab group fully-qualified name. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The GitLab group fully-qualified name.", + SerializedName = @"groupFQName", + PossibleTypes = new [] { typeof(string) })] + string GroupFqName { get; set; } + /// Resource identity path + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Resource identity path", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string Id { get; set; } + /// The operation result Id. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The operation result Id.", + SerializedName = @"operationResultId", + PossibleTypes = new [] { typeof(string) })] + string OperationResultId { get; set; } + /// The Azure DevOps organization name. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The Azure DevOps organization name.", + SerializedName = @"orgName", + PossibleTypes = new [] { typeof(string) })] + string OrgName { get; set; } + /// The GitHub owner name. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The GitHub owner name.", + SerializedName = @"ownerName", + PossibleTypes = new [] { typeof(string) })] + string OwnerName { get; set; } + /// The project name. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The project name.", + SerializedName = @"projectName", + PossibleTypes = new [] { typeof(string) })] + string ProjectName { get; set; } + /// The repository name. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The repository name.", + SerializedName = @"repoName", + PossibleTypes = new [] { typeof(string) })] + string RepoName { get; set; } + /// + /// The name of the resource group within the user's subscription. The name is case insensitive. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The name of the resource group within the user's subscription. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + string ResourceGroupName { get; set; } + /// The security connector name. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The security connector name.", + SerializedName = @"securityConnectorName", + PossibleTypes = new [] { typeof(string) })] + string SecurityConnectorName { get; set; } + /// The name of the API Management service. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The name of the API Management service.", + SerializedName = @"serviceName", + PossibleTypes = new [] { typeof(string) })] + string ServiceName { get; set; } + /// Azure subscription ID + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Azure subscription ID", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + string SubscriptionId { get; set; } + + } + internal partial interface ISecurityIdentityInternal + + { + /// + /// API revision identifier. Must be unique in the API Management service instance. Non-current revision has ;rev=n as a suffix + /// where n is the revision number. + /// + string ApiId { get; set; } + /// The GitLab group fully-qualified name. + string GroupFqName { get; set; } + /// Resource identity path + string Id { get; set; } + /// The operation result Id. + string OperationResultId { get; set; } + /// The Azure DevOps organization name. + string OrgName { get; set; } + /// The GitHub owner name. + string OwnerName { get; set; } + /// The project name. + string ProjectName { get; set; } + /// The repository name. + string RepoName { get; set; } + /// + /// The name of the resource group within the user's subscription. The name is case insensitive. + /// + string ResourceGroupName { get; set; } + /// The security connector name. + string SecurityConnectorName { get; set; } + /// The name of the API Management service. + string ServiceName { get; set; } + /// Azure subscription ID + string SubscriptionId { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/SecurityIdentity.json.cs b/src/Security/Security.Autorest/generated/api/Models/SecurityIdentity.json.cs new file mode 100644 index 000000000000..b8b70c44a10b --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/SecurityIdentity.json.cs @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + public partial class SecurityIdentity + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new SecurityIdentity(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal SecurityIdentity(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_subscriptionId = If( json?.PropertyT("subscriptionId"), out var __jsonSubscriptionId) ? (string)__jsonSubscriptionId : (string)_subscriptionId;} + {_resourceGroupName = If( json?.PropertyT("resourceGroupName"), out var __jsonResourceGroupName) ? (string)__jsonResourceGroupName : (string)_resourceGroupName;} + {_securityConnectorName = If( json?.PropertyT("securityConnectorName"), out var __jsonSecurityConnectorName) ? (string)__jsonSecurityConnectorName : (string)_securityConnectorName;} + {_orgName = If( json?.PropertyT("orgName"), out var __jsonOrgName) ? (string)__jsonOrgName : (string)_orgName;} + {_projectName = If( json?.PropertyT("projectName"), out var __jsonProjectName) ? (string)__jsonProjectName : (string)_projectName;} + {_repoName = If( json?.PropertyT("repoName"), out var __jsonRepoName) ? (string)__jsonRepoName : (string)_repoName;} + {_ownerName = If( json?.PropertyT("ownerName"), out var __jsonOwnerName) ? (string)__jsonOwnerName : (string)_ownerName;} + {_groupFqName = If( json?.PropertyT("groupFQName"), out var __jsonGroupFqName) ? (string)__jsonGroupFqName : (string)_groupFqName;} + {_operationResultId = If( json?.PropertyT("operationResultId"), out var __jsonOperationResultId) ? (string)__jsonOperationResultId : (string)_operationResultId;} + {_serviceName = If( json?.PropertyT("serviceName"), out var __jsonServiceName) ? (string)__jsonServiceName : (string)_serviceName;} + {_apiId = If( json?.PropertyT("apiId"), out var __jsonApiId) ? (string)__jsonApiId : (string)_apiId;} + {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)_id;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._subscriptionId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._subscriptionId.ToString()) : null, "subscriptionId" ,container.Add ); + AddIf( null != (((object)this._resourceGroupName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._resourceGroupName.ToString()) : null, "resourceGroupName" ,container.Add ); + AddIf( null != (((object)this._securityConnectorName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._securityConnectorName.ToString()) : null, "securityConnectorName" ,container.Add ); + AddIf( null != (((object)this._orgName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._orgName.ToString()) : null, "orgName" ,container.Add ); + AddIf( null != (((object)this._projectName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._projectName.ToString()) : null, "projectName" ,container.Add ); + AddIf( null != (((object)this._repoName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._repoName.ToString()) : null, "repoName" ,container.Add ); + AddIf( null != (((object)this._ownerName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._ownerName.ToString()) : null, "ownerName" ,container.Add ); + AddIf( null != (((object)this._groupFqName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._groupFqName.ToString()) : null, "groupFQName" ,container.Add ); + AddIf( null != (((object)this._operationResultId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._operationResultId.ToString()) : null, "operationResultId" ,container.Add ); + AddIf( null != (((object)this._serviceName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._serviceName.ToString()) : null, "serviceName" ,container.Add ); + AddIf( null != (((object)this._apiId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._apiId.ToString()) : null, "apiId" ,container.Add ); + AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/SystemData.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/SystemData.PowerShell.cs new file mode 100644 index 000000000000..cc79ff94eb33 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/SystemData.PowerShell.cs @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// Metadata pertaining to creation and last modification of the resource. + [System.ComponentModel.TypeConverter(typeof(SystemDataTypeConverter))] + public partial class SystemData + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemData DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new SystemData(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemData DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new SystemData(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemData FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal SystemData(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)this).CreatedBy = (string) content.GetValueForProperty("CreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)this).CreatedBy, global::System.Convert.ToString); + } + if (content.Contains("CreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)this).CreatedByType = (string) content.GetValueForProperty("CreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)this).CreatedByType, global::System.Convert.ToString); + } + if (content.Contains("CreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)this).CreatedAt = (global::System.DateTime?) content.GetValueForProperty("CreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)this).CreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)this).LastModifiedBy = (string) content.GetValueForProperty("LastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)this).LastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("LastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)this).LastModifiedByType = (string) content.GetValueForProperty("LastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)this).LastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("LastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)this).LastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("LastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)this).LastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal SystemData(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)this).CreatedBy = (string) content.GetValueForProperty("CreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)this).CreatedBy, global::System.Convert.ToString); + } + if (content.Contains("CreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)this).CreatedByType = (string) content.GetValueForProperty("CreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)this).CreatedByType, global::System.Convert.ToString); + } + if (content.Contains("CreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)this).CreatedAt = (global::System.DateTime?) content.GetValueForProperty("CreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)this).CreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)this).LastModifiedBy = (string) content.GetValueForProperty("LastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)this).LastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("LastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)this).LastModifiedByType = (string) content.GetValueForProperty("LastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)this).LastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("LastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)this).LastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("LastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal)this).LastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// Metadata pertaining to creation and last modification of the resource. + [System.ComponentModel.TypeConverter(typeof(SystemDataTypeConverter))] + public partial interface ISystemData + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/SystemData.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/SystemData.TypeConverter.cs new file mode 100644 index 000000000000..3bfced6d369e --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/SystemData.TypeConverter.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class SystemDataTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemData ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemData).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return SystemData.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return SystemData.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return SystemData.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/SystemData.cs b/src/Security/Security.Autorest/generated/api/Models/SystemData.cs new file mode 100644 index 000000000000..dadebcf791d5 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/SystemData.cs @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// Metadata pertaining to creation and last modification of the resource. + public partial class SystemData : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemData, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemDataInternal + { + + /// Backing field for property. + private global::System.DateTime? _createdAt; + + /// The timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public global::System.DateTime? CreatedAt { get => this._createdAt; set => this._createdAt = value; } + + /// Backing field for property. + private string _createdBy; + + /// The identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string CreatedBy { get => this._createdBy; set => this._createdBy = value; } + + /// Backing field for property. + private string _createdByType; + + /// The type of identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string CreatedByType { get => this._createdByType; set => this._createdByType = value; } + + /// Backing field for property. + private global::System.DateTime? _lastModifiedAt; + + /// The timestamp of resource last modification (UTC) + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public global::System.DateTime? LastModifiedAt { get => this._lastModifiedAt; set => this._lastModifiedAt = value; } + + /// Backing field for property. + private string _lastModifiedBy; + + /// The identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string LastModifiedBy { get => this._lastModifiedBy; set => this._lastModifiedBy = value; } + + /// Backing field for property. + private string _lastModifiedByType; + + /// The type of identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string LastModifiedByType { get => this._lastModifiedByType; set => this._lastModifiedByType = value; } + + /// Creates an new instance. + public SystemData() + { + + } + } + /// Metadata pertaining to creation and last modification of the resource. + public partial interface ISystemData : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// The timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The timestamp of resource creation (UTC).", + SerializedName = @"createdAt", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? CreatedAt { get; set; } + /// The identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The identity that created the resource.", + SerializedName = @"createdBy", + PossibleTypes = new [] { typeof(string) })] + string CreatedBy { get; set; } + /// The type of identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The type of identity that created the resource.", + SerializedName = @"createdByType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string CreatedByType { get; set; } + /// The timestamp of resource last modification (UTC) + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The timestamp of resource last modification (UTC)", + SerializedName = @"lastModifiedAt", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastModifiedAt { get; set; } + /// The identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The identity that last modified the resource.", + SerializedName = @"lastModifiedBy", + PossibleTypes = new [] { typeof(string) })] + string LastModifiedBy { get; set; } + /// The type of identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The type of identity that last modified the resource.", + SerializedName = @"lastModifiedByType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string LastModifiedByType { get; set; } + + } + /// Metadata pertaining to creation and last modification of the resource. + internal partial interface ISystemDataInternal + + { + /// The timestamp of resource creation (UTC). + global::System.DateTime? CreatedAt { get; set; } + /// The identity that created the resource. + string CreatedBy { get; set; } + /// The type of identity that created the resource. + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string CreatedByType { get; set; } + /// The timestamp of resource last modification (UTC) + global::System.DateTime? LastModifiedAt { get; set; } + /// The identity that last modified the resource. + string LastModifiedBy { get; set; } + /// The type of identity that last modified the resource. + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string LastModifiedByType { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/SystemData.json.cs b/src/Security/Security.Autorest/generated/api/Models/SystemData.json.cs new file mode 100644 index 000000000000..324bddb58095 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/SystemData.json.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// Metadata pertaining to creation and last modification of the resource. + public partial class SystemData + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemData. + /// + /// a to deserialize from. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemData. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISystemData FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new SystemData(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal SystemData(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_createdBy = If( json?.PropertyT("createdBy"), out var __jsonCreatedBy) ? (string)__jsonCreatedBy : (string)_createdBy;} + {_createdByType = If( json?.PropertyT("createdByType"), out var __jsonCreatedByType) ? (string)__jsonCreatedByType : (string)_createdByType;} + {_createdAt = If( json?.PropertyT("createdAt"), out var __jsonCreatedAt) ? global::System.DateTime.TryParse((string)__jsonCreatedAt, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonCreatedAtValue) ? __jsonCreatedAtValue : _createdAt : _createdAt;} + {_lastModifiedBy = If( json?.PropertyT("lastModifiedBy"), out var __jsonLastModifiedBy) ? (string)__jsonLastModifiedBy : (string)_lastModifiedBy;} + {_lastModifiedByType = If( json?.PropertyT("lastModifiedByType"), out var __jsonLastModifiedByType) ? (string)__jsonLastModifiedByType : (string)_lastModifiedByType;} + {_lastModifiedAt = If( json?.PropertyT("lastModifiedAt"), out var __jsonLastModifiedAt) ? global::System.DateTime.TryParse((string)__jsonLastModifiedAt, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastModifiedAtValue) ? __jsonLastModifiedAtValue : _lastModifiedAt : _lastModifiedAt;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._createdBy)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._createdBy.ToString()) : null, "createdBy" ,container.Add ); + AddIf( null != (((object)this._createdByType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._createdByType.ToString()) : null, "createdByType" ,container.Add ); + AddIf( null != this._createdAt ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._createdAt?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "createdAt" ,container.Add ); + AddIf( null != (((object)this._lastModifiedBy)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._lastModifiedBy.ToString()) : null, "lastModifiedBy" ,container.Add ); + AddIf( null != (((object)this._lastModifiedByType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._lastModifiedByType.ToString()) : null, "lastModifiedByType" ,container.Add ); + AddIf( null != this._lastModifiedAt ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._lastModifiedAt?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "lastModifiedAt" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/Tags.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/Tags.PowerShell.cs new file mode 100644 index 000000000000..90fe91b147de --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/Tags.PowerShell.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// A list of key value pairs that describe the resource. + [System.ComponentModel.TypeConverter(typeof(TagsTypeConverter))] + public partial class Tags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new Tags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new Tags(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal Tags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal Tags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// A list of key value pairs that describe the resource. + [System.ComponentModel.TypeConverter(typeof(TagsTypeConverter))] + public partial interface ITags + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/Tags.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/Tags.TypeConverter.cs new file mode 100644 index 000000000000..4108035ca4ec --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/Tags.TypeConverter.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class TagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return Tags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return Tags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return Tags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/Tags.cs b/src/Security/Security.Autorest/generated/api/Models/Tags.cs new file mode 100644 index 000000000000..50324abe9480 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/Tags.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// A list of key value pairs that describe the resource. + public partial class Tags : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITags, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITagsInternal + { + + /// Creates an new instance. + public Tags() + { + + } + } + /// A list of key value pairs that describe the resource. + public partial interface ITags : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray + { + + } + /// A list of key value pairs that describe the resource. + internal partial interface ITagsInternal + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/Tags.dictionary.cs b/src/Security/Security.Autorest/generated/api/Models/Tags.dictionary.cs new file mode 100644 index 000000000000..f892e2f3a76b --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/Tags.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + public partial class Tags : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.Tags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/Tags.json.cs b/src/Security/Security.Autorest/generated/api/Models/Tags.json.cs new file mode 100644 index 000000000000..7121be34faaa --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/Tags.json.cs @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// A list of key value pairs that describe the resource. + public partial class Tags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITags. + /// + /// a to deserialize from. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITags. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITags FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new Tags(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + /// + internal Tags(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/Tags1.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/Tags1.PowerShell.cs new file mode 100644 index 000000000000..057962973606 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/Tags1.PowerShell.cs @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// A list of key value pairs that describe the resource. + [System.ComponentModel.TypeConverter(typeof(Tags1TypeConverter))] + public partial class Tags1 + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITags1 DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new Tags1(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITags1 DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new Tags1(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITags1 FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal Tags1(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITags1Internal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITags1Internal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.TagsTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal Tags1(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITags1Internal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITags1Internal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.TagsTypeConverter.ConvertFrom); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// A list of key value pairs that describe the resource. + [System.ComponentModel.TypeConverter(typeof(Tags1TypeConverter))] + public partial interface ITags1 + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/Tags1.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/Tags1.TypeConverter.cs new file mode 100644 index 000000000000..d1038fa59650 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/Tags1.TypeConverter.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class Tags1TypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITags1 ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITags1).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return Tags1.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return Tags1.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return Tags1.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/Tags1.cs b/src/Security/Security.Autorest/generated/api/Models/Tags1.cs new file mode 100644 index 000000000000..575b539fff1b --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/Tags1.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// A list of key value pairs that describe the resource. + public partial class Tags1 : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITags1, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITags1Internal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITags _tag; + + /// A list of key value pairs that describe the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITags Tag { get => (this._tag = this._tag ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.Tags()); set => this._tag = value; } + + /// Creates an new instance. + public Tags1() + { + + } + } + /// A list of key value pairs that describe the resource. + public partial interface ITags1 : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// A list of key value pairs that describe the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"A list of key value pairs that describe the resource.", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITags) })] + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITags Tag { get; set; } + + } + /// A list of key value pairs that describe the resource. + internal partial interface ITags1Internal + + { + /// A list of key value pairs that describe the resource. + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITags Tag { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/Tags1.json.cs b/src/Security/Security.Autorest/generated/api/Models/Tags1.json.cs new file mode 100644 index 000000000000..aa87538727b2 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/Tags1.json.cs @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// A list of key value pairs that describe the resource. + public partial class Tags1 + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITags1. + /// + /// a to deserialize from. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITags1. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITags1 FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new Tags1(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal Tags1(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_tag = If( json?.PropertyT("tags"), out var __jsonTags) ? Microsoft.Azure.PowerShell.Cmdlets.Security.Models.Tags.FromJson(__jsonTags) : _tag;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._tag ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) this._tag.ToJson(null,serializationMode) : null, "tags" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/TargetBranchConfiguration.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/TargetBranchConfiguration.PowerShell.cs new file mode 100644 index 000000000000..c7b42255c27c --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/TargetBranchConfiguration.PowerShell.cs @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// Repository branch configuration for PR Annotations. + [System.ComponentModel.TypeConverter(typeof(TargetBranchConfigurationTypeConverter))] + public partial class TargetBranchConfiguration + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITargetBranchConfiguration DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new TargetBranchConfiguration(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITargetBranchConfiguration DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new TargetBranchConfiguration(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITargetBranchConfiguration FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal TargetBranchConfiguration(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("BranchName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITargetBranchConfigurationInternal)this).BranchName = (System.Collections.Generic.List) content.GetValueForProperty("BranchName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITargetBranchConfigurationInternal)this).BranchName, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("AnnotateDefaultBranch")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITargetBranchConfigurationInternal)this).AnnotateDefaultBranch = (string) content.GetValueForProperty("AnnotateDefaultBranch",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITargetBranchConfigurationInternal)this).AnnotateDefaultBranch, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal TargetBranchConfiguration(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("BranchName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITargetBranchConfigurationInternal)this).BranchName = (System.Collections.Generic.List) content.GetValueForProperty("BranchName",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITargetBranchConfigurationInternal)this).BranchName, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("AnnotateDefaultBranch")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITargetBranchConfigurationInternal)this).AnnotateDefaultBranch = (string) content.GetValueForProperty("AnnotateDefaultBranch",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITargetBranchConfigurationInternal)this).AnnotateDefaultBranch, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// Repository branch configuration for PR Annotations. + [System.ComponentModel.TypeConverter(typeof(TargetBranchConfigurationTypeConverter))] + public partial interface ITargetBranchConfiguration + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/TargetBranchConfiguration.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/TargetBranchConfiguration.TypeConverter.cs new file mode 100644 index 000000000000..f6067cab523d --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/TargetBranchConfiguration.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class TargetBranchConfigurationTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITargetBranchConfiguration ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITargetBranchConfiguration).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return TargetBranchConfiguration.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return TargetBranchConfiguration.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return TargetBranchConfiguration.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/TargetBranchConfiguration.cs b/src/Security/Security.Autorest/generated/api/Models/TargetBranchConfiguration.cs new file mode 100644 index 000000000000..3a1b1605a9e8 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/TargetBranchConfiguration.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// Repository branch configuration for PR Annotations. + public partial class TargetBranchConfiguration : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITargetBranchConfiguration, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITargetBranchConfigurationInternal + { + + /// Backing field for property. + private string _annotateDefaultBranch; + + /// + /// Configuration of PR Annotations on default branch. + /// + /// Enabled - PR Annotations are enabled on the resource's default branch. + /// Disabled - PR Annotations are disabled on the resource's default branch. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public string AnnotateDefaultBranch { get => this._annotateDefaultBranch; set => this._annotateDefaultBranch = value; } + + /// Backing field for property. + private System.Collections.Generic.List _branchName; + + /// Gets or sets branches that should have annotations. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Owned)] + public System.Collections.Generic.List BranchName { get => this._branchName; set => this._branchName = value; } + + /// Creates an new instance. + public TargetBranchConfiguration() + { + + } + } + /// Repository branch configuration for PR Annotations. + public partial interface ITargetBranchConfiguration : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable + { + /// + /// Configuration of PR Annotations on default branch. + /// + /// Enabled - PR Annotations are enabled on the resource's default branch. + /// Disabled - PR Annotations are disabled on the resource's default branch. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Configuration of PR Annotations on default branch. + + Enabled - PR Annotations are enabled on the resource's default branch. + Disabled - PR Annotations are disabled on the resource's default branch.", + SerializedName = @"annotateDefaultBranch", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Disabled", "Enabled")] + string AnnotateDefaultBranch { get; set; } + /// Gets or sets branches that should have annotations. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Gets or sets branches that should have annotations.", + SerializedName = @"branchNames", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List BranchName { get; set; } + + } + /// Repository branch configuration for PR Annotations. + internal partial interface ITargetBranchConfigurationInternal + + { + /// + /// Configuration of PR Annotations on default branch. + /// + /// Enabled - PR Annotations are enabled on the resource's default branch. + /// Disabled - PR Annotations are disabled on the resource's default branch. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Disabled", "Enabled")] + string AnnotateDefaultBranch { get; set; } + /// Gets or sets branches that should have annotations. + System.Collections.Generic.List BranchName { get; set; } + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/TargetBranchConfiguration.json.cs b/src/Security/Security.Autorest/generated/api/Models/TargetBranchConfiguration.json.cs new file mode 100644 index 000000000000..19256cdad4f1 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/TargetBranchConfiguration.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// Repository branch configuration for PR Annotations. + public partial class TargetBranchConfiguration + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITargetBranchConfiguration. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITargetBranchConfiguration. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITargetBranchConfiguration FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new TargetBranchConfiguration(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal TargetBranchConfiguration(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_branchName = If( json?.PropertyT("branchNames"), out var __jsonBranchNames) ? If( __jsonBranchNames as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : _branchName;} + {_annotateDefaultBranch = If( json?.PropertyT("annotateDefaultBranch"), out var __jsonAnnotateDefaultBranch) ? (string)__jsonAnnotateDefaultBranch : (string)_annotateDefaultBranch;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._branchName) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.XNodeArray(); + foreach( var __x in this._branchName ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("branchNames",__w); + } + AddIf( null != (((object)this._annotateDefaultBranch)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonString(this._annotateDefaultBranch.ToString()) : null, "annotateDefaultBranch" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/TrackedResource.PowerShell.cs b/src/Security/Security.Autorest/generated/api/Models/TrackedResource.PowerShell.cs new file mode 100644 index 000000000000..7f7dd022e739 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/TrackedResource.PowerShell.cs @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// Describes an Azure tracked resource. + [System.ComponentModel.TypeConverter(typeof(TrackedResourceTypeConverter))] + public partial class TrackedResource + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITrackedResource DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new TrackedResource(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITrackedResource DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new TrackedResource(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITrackedResource FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal TrackedResource(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureTrackedResourceLocationInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureTrackedResourceLocationInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("Kind")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceKindInternal)this).Kind = (string) content.GetValueForProperty("Kind",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceKindInternal)this).Kind, global::System.Convert.ToString); + } + if (content.Contains("Etag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IETagInternal)this).Etag = (string) content.GetValueForProperty("Etag",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IETagInternal)this).Etag, global::System.Convert.ToString); + } + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITags1Internal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITags1Internal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.TagsTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal TrackedResource(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureTrackedResourceLocationInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureTrackedResourceLocationInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("Kind")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceKindInternal)this).Kind = (string) content.GetValueForProperty("Kind",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceKindInternal)this).Kind, global::System.Convert.ToString); + } + if (content.Contains("Etag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IETagInternal)this).Etag = (string) content.GetValueForProperty("Etag",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IETagInternal)this).Etag, global::System.Convert.ToString); + } + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITags1Internal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITags1Internal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.TagsTypeConverter.ConvertFrom); + } + AfterDeserializePSObject(content); + } + } + /// Describes an Azure tracked resource. + [System.ComponentModel.TypeConverter(typeof(TrackedResourceTypeConverter))] + public partial interface ITrackedResource + + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/TrackedResource.TypeConverter.cs b/src/Security/Security.Autorest/generated/api/Models/TrackedResource.TypeConverter.cs new file mode 100644 index 000000000000..7b15d04fd465 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/TrackedResource.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class TrackedResourceTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITrackedResource ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITrackedResource).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return TrackedResource.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return TrackedResource.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return TrackedResource.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/TrackedResource.cs b/src/Security/Security.Autorest/generated/api/Models/TrackedResource.cs new file mode 100644 index 000000000000..31118a10f16e --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/TrackedResource.cs @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// Describes an Azure tracked resource. + public partial class TrackedResource : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITrackedResource, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITrackedResourceInternal, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureTrackedResourceLocation __azureTrackedResourceLocation = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureTrackedResourceLocation(); + + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IETag __eTag = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ETag(); + + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.Resource(); + + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceKind __resourceKind = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ResourceKind(); + + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITags1 __tags1 = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.Tags1(); + + /// + /// Entity tag is used for comparing two or more entities from the same requested resource. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string Etag { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IETagInternal)__eTag).Etag; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IETagInternal)__eTag).Etag = value ?? null; } + + /// Resource Id + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)__resource).Id; } + + /// Kind of the resource + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string Kind { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceKindInternal)__resourceKind).Kind; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceKindInternal)__resourceKind).Kind = value ?? null; } + + /// Location where the resource is stored + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string Location { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureTrackedResourceLocationInternal)__azureTrackedResourceLocation).Location; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureTrackedResourceLocationInternal)__azureTrackedResourceLocation).Location = value ?? null; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)__resource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)__resource).Name = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)__resource).Type = value; } + + /// Resource name + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)__resource).Name; } + + /// A list of key value pairs that describe the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITags Tag { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITags1Internal)__tags1).Tag; set => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITags1Internal)__tags1).Tag = value ?? null /* model class */; } + + /// Resource type + [Microsoft.Azure.PowerShell.Cmdlets.Security.Origin(Microsoft.Azure.PowerShell.Cmdlets.Security.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal)__resource).Type; } + + /// Creates an new instance. + public TrackedResource() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__resource), __resource); + await eventListener.AssertObjectIsValid(nameof(__resource), __resource); + await eventListener.AssertNotNull(nameof(__azureTrackedResourceLocation), __azureTrackedResourceLocation); + await eventListener.AssertObjectIsValid(nameof(__azureTrackedResourceLocation), __azureTrackedResourceLocation); + await eventListener.AssertNotNull(nameof(__resourceKind), __resourceKind); + await eventListener.AssertObjectIsValid(nameof(__resourceKind), __resourceKind); + await eventListener.AssertNotNull(nameof(__eTag), __eTag); + await eventListener.AssertObjectIsValid(nameof(__eTag), __eTag); + await eventListener.AssertNotNull(nameof(__tags1), __tags1); + await eventListener.AssertObjectIsValid(nameof(__tags1), __tags1); + } + } + /// Describes an Azure tracked resource. + public partial interface ITrackedResource : + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResource, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureTrackedResourceLocation, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceKind, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IETag, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITags1 + { + + } + /// Describes an Azure tracked resource. + internal partial interface ITrackedResourceInternal : + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceInternal, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureTrackedResourceLocationInternal, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IResourceKindInternal, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IETagInternal, + Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITags1Internal + { + + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Models/TrackedResource.json.cs b/src/Security/Security.Autorest/generated/api/Models/TrackedResource.json.cs new file mode 100644 index 000000000000..7ab19171bdb5 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Models/TrackedResource.json.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// Describes an Azure tracked resource. + public partial class TrackedResource + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITrackedResource. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITrackedResource. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITrackedResource FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new TrackedResource(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __resource?.ToJson(container, serializationMode); + __azureTrackedResourceLocation?.ToJson(container, serializationMode); + __resourceKind?.ToJson(container, serializationMode); + __eTag?.ToJson(container, serializationMode); + __tags1?.ToJson(container, serializationMode); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject instance to deserialize from. + internal TrackedResource(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __resource = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.Resource(json); + __azureTrackedResourceLocation = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureTrackedResourceLocation(json); + __resourceKind = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ResourceKind(json); + __eTag = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ETag(json); + __tags1 = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.Tags1(json); + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/api/Security.cs b/src/Security/Security.Autorest/generated/api/Security.cs new file mode 100644 index 000000000000..cce40b3809e2 --- /dev/null +++ b/src/Security/Security.Autorest/generated/api/Security.cs @@ -0,0 +1,16790 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// + /// Low-level API implementation for the Security service. + /// API spec for Microsoft.Security (Azure Security Center) resource provider + /// + public partial class Security + { + + /// + /// Offboard an Azure API Management API from Microsoft Defender for APIs. The system will stop monitoring the operations + /// within the Azure API Management API for intrusive behaviors. + /// + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// API revision identifier. Must be unique in the API Management service instance. Non-current revision + /// has ;rev=n as a suffix where n is the revision number. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ApiCollectionsApiCollectionApimDelete(string subscriptionId, string resourceGroupName, string serviceName, string apiId, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-11-15"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.ApiManagement/service/" + + global::System.Uri.EscapeDataString(serviceName) + + "/providers/Microsoft.Security/apiCollections/" + + global::System.Uri.EscapeDataString(apiId) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ApiCollectionsApiCollectionApimDelete_Call (request, onOk,onNoContent,onDefault,eventListener,sender); + } + } + + /// + /// Offboard an Azure API Management API from Microsoft Defender for APIs. The system will stop monitoring the operations + /// within the Azure API Management API for intrusive behaviors. + /// + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ApiCollectionsApiCollectionApimDeleteViaIdentity(global::System.String viaIdentity, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-11-15"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.ApiManagement/service/(?[^/]+)/providers/Microsoft.Security/apiCollections/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/providers/Microsoft.Security/apiCollections/{apiId}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var serviceName = _match.Groups["serviceName"].Value; + var apiId = _match.Groups["apiId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.ApiManagement/service/" + + serviceName + + "/providers/Microsoft.Security/apiCollections/" + + apiId + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ApiCollectionsApiCollectionApimDelete_Call (request, onOk,onNoContent,onDefault,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ApiCollectionsApiCollectionApimDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response); + break; + } + case global::System.Net.HttpStatusCode.NoContent: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onNoContent(_response); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponseAutoGenerated.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but + /// you will get validation events back. + /// + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// API revision identifier. Must be unique in the API Management service instance. Non-current revision + /// has ;rev=n as a suffix where n is the revision number. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ApiCollectionsApiCollectionApimDelete_Validate(string subscriptionId, string resourceGroupName, string serviceName, string apiId, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertRegEx(nameof(subscriptionId), subscriptionId, @"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(serviceName),serviceName); + await eventListener.AssertMinimumLength(nameof(serviceName),serviceName,1); + await eventListener.AssertMaximumLength(nameof(serviceName),serviceName,50); + await eventListener.AssertRegEx(nameof(serviceName), serviceName, @"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); + await eventListener.AssertNotNull(nameof(apiId),apiId); + await eventListener.AssertMinimumLength(nameof(apiId),apiId,1); + await eventListener.AssertMaximumLength(nameof(apiId),apiId,256); + await eventListener.AssertRegEx(nameof(apiId), apiId, @"^[^*#&+:<>?]+$"); + } + } + + /// + /// Gets an Azure API Management API if it has been onboarded to Microsoft Defender for APIs. If an Azure API Management API + /// is onboarded to Microsoft Defender for APIs, the system will monitor the operations within the Azure API Management API + /// for intrusive behaviors and provide alerts for attacks that have been detected. + /// + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// API revision identifier. Must be unique in the API Management service instance. Non-current revision + /// has ;rev=n as a suffix where n is the revision number. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ApiCollectionsGetByAzureApiManagementService(string subscriptionId, string resourceGroupName, string serviceName, string apiId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-11-15"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.ApiManagement/service/" + + global::System.Uri.EscapeDataString(serviceName) + + "/providers/Microsoft.Security/apiCollections/" + + global::System.Uri.EscapeDataString(apiId) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ApiCollectionsGetByAzureApiManagementService_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// Gets an Azure API Management API if it has been onboarded to Microsoft Defender for APIs. If an Azure API Management API + /// is onboarded to Microsoft Defender for APIs, the system will monitor the operations within the Azure API Management API + /// for intrusive behaviors and provide alerts for attacks that have been detected. + /// + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ApiCollectionsGetByAzureApiManagementServiceViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-11-15"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.ApiManagement/service/(?[^/]+)/providers/Microsoft.Security/apiCollections/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/providers/Microsoft.Security/apiCollections/{apiId}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var serviceName = _match.Groups["serviceName"].Value; + var apiId = _match.Groups["apiId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.ApiManagement/service/" + + serviceName + + "/providers/Microsoft.Security/apiCollections/" + + apiId + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ApiCollectionsGetByAzureApiManagementService_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// Gets an Azure API Management API if it has been onboarded to Microsoft Defender for APIs. If an Azure API Management API + /// is onboarded to Microsoft Defender for APIs, the system will monitor the operations within the Azure API Management API + /// for intrusive behaviors and provide alerts for attacks that have been detected. + /// + /// + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A + /// that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ApiCollectionsGetByAzureApiManagementServiceViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-11-15"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.ApiManagement/service/(?[^/]+)/providers/Microsoft.Security/apiCollections/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/providers/Microsoft.Security/apiCollections/{apiId}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var serviceName = _match.Groups["serviceName"].Value; + var apiId = _match.Groups["apiId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.ApiManagement/service/" + + serviceName + + "/providers/Microsoft.Security/apiCollections/" + + apiId + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.ApiCollectionsGetByAzureApiManagementServiceWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Gets an Azure API Management API if it has been onboarded to Microsoft Defender for APIs. If an Azure API Management API + /// is onboarded to Microsoft Defender for APIs, the system will monitor the operations within the Azure API Management API + /// for intrusive behaviors and provide alerts for attacks that have been detected. + /// + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// API revision identifier. Must be unique in the API Management service instance. Non-current revision + /// has ;rev=n as a suffix where n is the revision number. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A + /// that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ApiCollectionsGetByAzureApiManagementServiceWithResult(string subscriptionId, string resourceGroupName, string serviceName, string apiId, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-11-15"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.ApiManagement/service/" + + global::System.Uri.EscapeDataString(serviceName) + + "/providers/Microsoft.Security/apiCollections/" + + global::System.Uri.EscapeDataString(apiId) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.ApiCollectionsGetByAzureApiManagementServiceWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A + /// that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ApiCollectionsGetByAzureApiManagementServiceWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ApiCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponseAutoGenerated.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ApiCollectionsGetByAzureApiManagementService_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ApiCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponseAutoGenerated.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, + /// but you will get validation events back. + /// + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// API revision identifier. Must be unique in the API Management service instance. Non-current revision + /// has ;rev=n as a suffix where n is the revision number. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ApiCollectionsGetByAzureApiManagementService_Validate(string subscriptionId, string resourceGroupName, string serviceName, string apiId, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertRegEx(nameof(subscriptionId), subscriptionId, @"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(serviceName),serviceName); + await eventListener.AssertMinimumLength(nameof(serviceName),serviceName,1); + await eventListener.AssertMaximumLength(nameof(serviceName),serviceName,50); + await eventListener.AssertRegEx(nameof(serviceName), serviceName, @"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); + await eventListener.AssertNotNull(nameof(apiId),apiId); + await eventListener.AssertMinimumLength(nameof(apiId),apiId,1); + await eventListener.AssertMaximumLength(nameof(apiId),apiId,256); + await eventListener.AssertRegEx(nameof(apiId), apiId, @"^[^*#&+:<>?]+$"); + } + } + + /// + /// Gets a list of Azure API Management APIs that have been onboarded to Microsoft Defender for APIs. If an Azure API Management + /// API is onboarded to Microsoft Defender for APIs, the system will monitor the operations within the Azure API Management + /// API for intrusive behaviors and provide alerts for attacks that have been detected. + /// + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ApiCollectionsListByAzureApiManagementService(string subscriptionId, string resourceGroupName, string serviceName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-11-15"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.ApiManagement/service/" + + global::System.Uri.EscapeDataString(serviceName) + + "/providers/Microsoft.Security/apiCollections" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ApiCollectionsListByAzureApiManagementService_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// Gets a list of Azure API Management APIs that have been onboarded to Microsoft Defender for APIs. If an Azure API Management + /// API is onboarded to Microsoft Defender for APIs, the system will monitor the operations within the Azure API Management + /// API for intrusive behaviors and provide alerts for attacks that have been detected. + /// + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ApiCollectionsListByAzureApiManagementServiceViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-11-15"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.ApiManagement/service/(?[^/]+)/providers/Microsoft.Security/apiCollections$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/providers/Microsoft.Security/apiCollections'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var serviceName = _match.Groups["serviceName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.ApiManagement/service/" + + serviceName + + "/providers/Microsoft.Security/apiCollections" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ApiCollectionsListByAzureApiManagementService_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// Gets a list of Azure API Management APIs that have been onboarded to Microsoft Defender for APIs. If an Azure API Management + /// API is onboarded to Microsoft Defender for APIs, the system will monitor the operations within the Azure API Management + /// API for intrusive behaviors and provide alerts for attacks that have been detected. + /// + /// + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ApiCollectionsListByAzureApiManagementServiceViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-11-15"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.ApiManagement/service/(?[^/]+)/providers/Microsoft.Security/apiCollections$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/providers/Microsoft.Security/apiCollections'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var serviceName = _match.Groups["serviceName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.ApiManagement/service/" + + serviceName + + "/providers/Microsoft.Security/apiCollections" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.ApiCollectionsListByAzureApiManagementServiceWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Gets a list of Azure API Management APIs that have been onboarded to Microsoft Defender for APIs. If an Azure API Management + /// API is onboarded to Microsoft Defender for APIs, the system will monitor the operations within the Azure API Management + /// API for intrusive behaviors and provide alerts for attacks that have been detected. + /// + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ApiCollectionsListByAzureApiManagementServiceWithResult(string subscriptionId, string resourceGroupName, string serviceName, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-11-15"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.ApiManagement/service/" + + global::System.Uri.EscapeDataString(serviceName) + + "/providers/Microsoft.Security/apiCollections" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.ApiCollectionsListByAzureApiManagementServiceWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ApiCollectionsListByAzureApiManagementServiceWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ApiCollectionList.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponseAutoGenerated.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ApiCollectionsListByAzureApiManagementService_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ApiCollectionList.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponseAutoGenerated.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, + /// but you will get validation events back. + /// + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ApiCollectionsListByAzureApiManagementService_Validate(string subscriptionId, string resourceGroupName, string serviceName, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertRegEx(nameof(subscriptionId), subscriptionId, @"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(serviceName),serviceName); + await eventListener.AssertMinimumLength(nameof(serviceName),serviceName,1); + await eventListener.AssertMaximumLength(nameof(serviceName),serviceName,50); + await eventListener.AssertRegEx(nameof(serviceName), serviceName, @"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); + } + } + + /// + /// Gets a list of API collections within a resource group that have been onboarded to Microsoft Defender for APIs. + /// + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ApiCollectionsListByResourceGroup(string subscriptionId, string resourceGroupName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-11-15"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/apiCollections" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ApiCollectionsListByResourceGroup_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// Gets a list of API collections within a resource group that have been onboarded to Microsoft Defender for APIs. + /// + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ApiCollectionsListByResourceGroupViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-11-15"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/apiCollections$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/apiCollections'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/apiCollections" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ApiCollectionsListByResourceGroup_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// Gets a list of API collections within a resource group that have been onboarded to Microsoft Defender for APIs. + /// + /// + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ApiCollectionsListByResourceGroupViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-11-15"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/apiCollections$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/apiCollections'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/apiCollections" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.ApiCollectionsListByResourceGroupWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Gets a list of API collections within a resource group that have been onboarded to Microsoft Defender for APIs. + /// + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ApiCollectionsListByResourceGroupWithResult(string subscriptionId, string resourceGroupName, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-11-15"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/apiCollections" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.ApiCollectionsListByResourceGroupWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ApiCollectionsListByResourceGroupWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ApiCollectionList.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponseAutoGenerated.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ApiCollectionsListByResourceGroup_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ApiCollectionList.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponseAutoGenerated.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you + /// will get validation events back. + /// + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ApiCollectionsListByResourceGroup_Validate(string subscriptionId, string resourceGroupName, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertRegEx(nameof(subscriptionId), subscriptionId, @"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + } + } + + /// + /// Gets a list of API collections within a subscription that have been onboarded to Microsoft Defender for APIs. + /// + /// Azure subscription ID + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ApiCollectionsListBySubscription(string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-11-15"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.Security/apiCollections" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ApiCollectionsListBySubscription_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// Gets a list of API collections within a subscription that have been onboarded to Microsoft Defender for APIs. + /// + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ApiCollectionsListBySubscriptionViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-11-15"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/providers/Microsoft.Security/apiCollections$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.Security/apiCollections'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/providers/Microsoft.Security/apiCollections" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ApiCollectionsListBySubscription_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// Gets a list of API collections within a subscription that have been onboarded to Microsoft Defender for APIs. + /// + /// + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ApiCollectionsListBySubscriptionViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-11-15"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/providers/Microsoft.Security/apiCollections$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.Security/apiCollections'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/providers/Microsoft.Security/apiCollections" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.ApiCollectionsListBySubscriptionWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Gets a list of API collections within a subscription that have been onboarded to Microsoft Defender for APIs. + /// + /// Azure subscription ID + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ApiCollectionsListBySubscriptionWithResult(string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-11-15"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.Security/apiCollections" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.ApiCollectionsListBySubscriptionWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ApiCollectionsListBySubscriptionWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ApiCollectionList.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponseAutoGenerated.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ApiCollectionsListBySubscription_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ApiCollectionList.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponseAutoGenerated.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you + /// will get validation events back. + /// + /// Azure subscription ID + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ApiCollectionsListBySubscription_Validate(string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertRegEx(nameof(subscriptionId), subscriptionId, @"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + + /// + /// Onboard an Azure API Management API to Microsoft Defender for APIs. The system will start monitoring the operations within + /// the Azure Management API for intrusive behaviors and provide alerts for attacks that have been detected. + /// + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// API revision identifier. Must be unique in the API Management service instance. Non-current revision + /// has ;rev=n as a suffix where n is the revision number. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ApiCollectionsOnboardAzureApiManagementApi(string subscriptionId, string resourceGroupName, string serviceName, string apiId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-11-15"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.ApiManagement/service/" + + global::System.Uri.EscapeDataString(serviceName) + + "/providers/Microsoft.Security/apiCollections/" + + global::System.Uri.EscapeDataString(apiId) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ApiCollectionsOnboardAzureApiManagementApi_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// Onboard an Azure API Management API to Microsoft Defender for APIs. The system will start monitoring the operations within + /// the Azure Management API for intrusive behaviors and provide alerts for attacks that have been detected. + /// + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ApiCollectionsOnboardAzureApiManagementApiViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-11-15"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.ApiManagement/service/(?[^/]+)/providers/Microsoft.Security/apiCollections/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/providers/Microsoft.Security/apiCollections/{apiId}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var serviceName = _match.Groups["serviceName"].Value; + var apiId = _match.Groups["apiId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.ApiManagement/service/" + + serviceName + + "/providers/Microsoft.Security/apiCollections/" + + apiId + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ApiCollectionsOnboardAzureApiManagementApi_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// Onboard an Azure API Management API to Microsoft Defender for APIs. The system will start monitoring the operations within + /// the Azure Management API for intrusive behaviors and provide alerts for attacks that have been detected. + /// + /// + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A + /// that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ApiCollectionsOnboardAzureApiManagementApiViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-11-15"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.ApiManagement/service/(?[^/]+)/providers/Microsoft.Security/apiCollections/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/providers/Microsoft.Security/apiCollections/{apiId}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var serviceName = _match.Groups["serviceName"].Value; + var apiId = _match.Groups["apiId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.ApiManagement/service/" + + serviceName + + "/providers/Microsoft.Security/apiCollections/" + + apiId + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.ApiCollectionsOnboardAzureApiManagementApiWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Onboard an Azure API Management API to Microsoft Defender for APIs. The system will start monitoring the operations within + /// the Azure Management API for intrusive behaviors and provide alerts for attacks that have been detected. + /// + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// API revision identifier. Must be unique in the API Management service instance. Non-current revision + /// has ;rev=n as a suffix where n is the revision number. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A + /// that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ApiCollectionsOnboardAzureApiManagementApiWithResult(string subscriptionId, string resourceGroupName, string serviceName, string apiId, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-11-15"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.ApiManagement/service/" + + global::System.Uri.EscapeDataString(serviceName) + + "/providers/Microsoft.Security/apiCollections/" + + global::System.Uri.EscapeDataString(apiId) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.ApiCollectionsOnboardAzureApiManagementApiWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A + /// that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ApiCollectionsOnboardAzureApiManagementApiWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 0); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: location + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + // delay before making the next polling request + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.DelayBeforePolling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + break; + } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ApiCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponseAutoGenerated.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ApiCollectionsOnboardAzureApiManagementApi_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 0); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: location + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + // delay before making the next polling request + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.DelayBeforePolling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ApiCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponseAutoGenerated.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, + /// but you will get validation events back. + /// + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// API revision identifier. Must be unique in the API Management service instance. Non-current revision + /// has ;rev=n as a suffix where n is the revision number. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ApiCollectionsOnboardAzureApiManagementApi_Validate(string subscriptionId, string resourceGroupName, string serviceName, string apiId, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertRegEx(nameof(subscriptionId), subscriptionId, @"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(serviceName),serviceName); + await eventListener.AssertMinimumLength(nameof(serviceName),serviceName,1); + await eventListener.AssertMaximumLength(nameof(serviceName),serviceName,50); + await eventListener.AssertRegEx(nameof(serviceName), serviceName, @"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); + await eventListener.AssertNotNull(nameof(apiId),apiId); + await eventListener.AssertMinimumLength(nameof(apiId),apiId,1); + await eventListener.AssertMaximumLength(nameof(apiId),apiId,256); + await eventListener.AssertRegEx(nameof(apiId), apiId, @"^[^*#&+:<>?]+$"); + } + } + + /// Create monitored Azure DevOps organization details. + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The Azure DevOps organization name. + /// The Azure DevOps organization resource payload. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AzureDevOpsOrgsCreateOrUpdate(string subscriptionId, string resourceGroupName, string securityConnectorName, string orgName, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrg body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default/azureDevOpsOrgs/" + + global::System.Uri.EscapeDataString(orgName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.AzureDevOpsOrgsCreateOrUpdate_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Create monitored Azure DevOps organization details. + /// + /// The Azure DevOps organization resource payload. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AzureDevOpsOrgsCreateOrUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrg body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/securityConnectors/(?[^/]+)/devops/default/azureDevOpsOrgs/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var securityConnectorName = _match.Groups["securityConnectorName"].Value; + var orgName = _match.Groups["orgName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/securityConnectors/" + + securityConnectorName + + "/devops/default/azureDevOpsOrgs/" + + orgName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.AzureDevOpsOrgsCreateOrUpdate_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Create monitored Azure DevOps organization details. + /// + /// The Azure DevOps organization resource payload. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AzureDevOpsOrgsCreateOrUpdateViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrg body, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/securityConnectors/(?[^/]+)/devops/default/azureDevOpsOrgs/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var securityConnectorName = _match.Groups["securityConnectorName"].Value; + var orgName = _match.Groups["orgName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/securityConnectors/" + + securityConnectorName + + "/devops/default/azureDevOpsOrgs/" + + orgName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.AzureDevOpsOrgsCreateOrUpdateWithResult_Call (request, eventListener,sender); + } + } + + /// Create monitored Azure DevOps organization details. + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The Azure DevOps organization name. + /// Json string supplied to the AzureDevOpsOrgsCreateOrUpdate operation + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AzureDevOpsOrgsCreateOrUpdateViaJsonString(string subscriptionId, string resourceGroupName, string securityConnectorName, string orgName, global::System.String jsonString, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default/azureDevOpsOrgs/" + + global::System.Uri.EscapeDataString(orgName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.AzureDevOpsOrgsCreateOrUpdate_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Create monitored Azure DevOps organization details. + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The Azure DevOps organization name. + /// Json string supplied to the AzureDevOpsOrgsCreateOrUpdate operation + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AzureDevOpsOrgsCreateOrUpdateViaJsonStringWithResult(string subscriptionId, string resourceGroupName, string securityConnectorName, string orgName, global::System.String jsonString, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default/azureDevOpsOrgs/" + + global::System.Uri.EscapeDataString(orgName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.AzureDevOpsOrgsCreateOrUpdateWithResult_Call (request, eventListener,sender); + } + } + + /// Create monitored Azure DevOps organization details. + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The Azure DevOps organization name. + /// The Azure DevOps organization resource payload. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AzureDevOpsOrgsCreateOrUpdateWithResult(string subscriptionId, string resourceGroupName, string securityConnectorName, string orgName, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrg body, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default/azureDevOpsOrgs/" + + global::System.Uri.EscapeDataString(orgName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.AzureDevOpsOrgsCreateOrUpdateWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AzureDevOpsOrgsCreateOrUpdateWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 0); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: azure-async-operation + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + // delay before making the next polling request + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.DelayBeforePolling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + break; + } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsOrg.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AzureDevOpsOrgsCreateOrUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 0); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: azure-async-operation + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + // delay before making the next polling request + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.DelayBeforePolling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsOrg.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The Azure DevOps organization name. + /// The Azure DevOps organization resource payload. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AzureDevOpsOrgsCreateOrUpdate_Validate(string subscriptionId, string resourceGroupName, string securityConnectorName, string orgName, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrg body, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertRegEx(nameof(subscriptionId), subscriptionId, @"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(securityConnectorName),securityConnectorName); + await eventListener.AssertNotNull(nameof(orgName),orgName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// Returns a monitored Azure DevOps organization resource. + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The Azure DevOps organization name. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AzureDevOpsOrgsGet(string subscriptionId, string resourceGroupName, string securityConnectorName, string orgName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default/azureDevOpsOrgs/" + + global::System.Uri.EscapeDataString(orgName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.AzureDevOpsOrgsGet_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Returns a monitored Azure DevOps organization resource. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AzureDevOpsOrgsGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/securityConnectors/(?[^/]+)/devops/default/azureDevOpsOrgs/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var securityConnectorName = _match.Groups["securityConnectorName"].Value; + var orgName = _match.Groups["orgName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/securityConnectors/" + + securityConnectorName + + "/devops/default/azureDevOpsOrgs/" + + orgName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.AzureDevOpsOrgsGet_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Returns a monitored Azure DevOps organization resource. + /// + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AzureDevOpsOrgsGetViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/securityConnectors/(?[^/]+)/devops/default/azureDevOpsOrgs/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var securityConnectorName = _match.Groups["securityConnectorName"].Value; + var orgName = _match.Groups["orgName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/securityConnectors/" + + securityConnectorName + + "/devops/default/azureDevOpsOrgs/" + + orgName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.AzureDevOpsOrgsGetWithResult_Call (request, eventListener,sender); + } + } + + /// Returns a monitored Azure DevOps organization resource. + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The Azure DevOps organization name. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AzureDevOpsOrgsGetWithResult(string subscriptionId, string resourceGroupName, string securityConnectorName, string orgName, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default/azureDevOpsOrgs/" + + global::System.Uri.EscapeDataString(orgName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.AzureDevOpsOrgsGetWithResult_Call (request, eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AzureDevOpsOrgsGetWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsOrg.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AzureDevOpsOrgsGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsOrg.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The Azure DevOps organization name. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AzureDevOpsOrgsGet_Validate(string subscriptionId, string resourceGroupName, string securityConnectorName, string orgName, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertRegEx(nameof(subscriptionId), subscriptionId, @"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(securityConnectorName),securityConnectorName); + await eventListener.AssertNotNull(nameof(orgName),orgName); + } + } + + /// Returns a list of Azure DevOps organizations onboarded to the connector. + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AzureDevOpsOrgsList(string subscriptionId, string resourceGroupName, string securityConnectorName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default/azureDevOpsOrgs" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.AzureDevOpsOrgsList_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// Returns a list of all Azure DevOps organizations accessible by the user token consumed by the connector. + /// + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AzureDevOpsOrgsListAvailable(string subscriptionId, string resourceGroupName, string securityConnectorName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default/listAvailableAzureDevOpsOrgs" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.AzureDevOpsOrgsListAvailable_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// Returns a list of all Azure DevOps organizations accessible by the user token consumed by the connector. + /// + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AzureDevOpsOrgsListAvailableViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/securityConnectors/(?[^/]+)/devops/default$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var securityConnectorName = _match.Groups["securityConnectorName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/securityConnectors/" + + securityConnectorName + + "/devops/default/listAvailableAzureDevOpsOrgs" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.AzureDevOpsOrgsListAvailable_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// Returns a list of all Azure DevOps organizations accessible by the user token consumed by the connector. + /// + /// + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AzureDevOpsOrgsListAvailableViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/securityConnectors/(?[^/]+)/devops/default$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var securityConnectorName = _match.Groups["securityConnectorName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/securityConnectors/" + + securityConnectorName + + "/devops/default/listAvailableAzureDevOpsOrgs" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.AzureDevOpsOrgsListAvailableWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Returns a list of all Azure DevOps organizations accessible by the user token consumed by the connector. + /// + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AzureDevOpsOrgsListAvailableWithResult(string subscriptionId, string resourceGroupName, string securityConnectorName, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default/listAvailableAzureDevOpsOrgs" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.AzureDevOpsOrgsListAvailableWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AzureDevOpsOrgsListAvailableWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsOrgListResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AzureDevOpsOrgsListAvailable_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsOrgListResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AzureDevOpsOrgsListAvailable_Validate(string subscriptionId, string resourceGroupName, string securityConnectorName, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertRegEx(nameof(subscriptionId), subscriptionId, @"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(securityConnectorName),securityConnectorName); + } + } + + /// Returns a list of Azure DevOps organizations onboarded to the connector. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AzureDevOpsOrgsListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/securityConnectors/(?[^/]+)/devops/default/azureDevOpsOrgs$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var securityConnectorName = _match.Groups["securityConnectorName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/securityConnectors/" + + securityConnectorName + + "/devops/default/azureDevOpsOrgs" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.AzureDevOpsOrgsList_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Returns a list of Azure DevOps organizations onboarded to the connector. + /// + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AzureDevOpsOrgsListViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/securityConnectors/(?[^/]+)/devops/default/azureDevOpsOrgs$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var securityConnectorName = _match.Groups["securityConnectorName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/securityConnectors/" + + securityConnectorName + + "/devops/default/azureDevOpsOrgs" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.AzureDevOpsOrgsListWithResult_Call (request, eventListener,sender); + } + } + + /// Returns a list of Azure DevOps organizations onboarded to the connector. + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AzureDevOpsOrgsListWithResult(string subscriptionId, string resourceGroupName, string securityConnectorName, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default/azureDevOpsOrgs" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.AzureDevOpsOrgsListWithResult_Call (request, eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AzureDevOpsOrgsListWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsOrgListResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AzureDevOpsOrgsList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsOrgListResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AzureDevOpsOrgsList_Validate(string subscriptionId, string resourceGroupName, string securityConnectorName, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertRegEx(nameof(subscriptionId), subscriptionId, @"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(securityConnectorName),securityConnectorName); + } + } + + /// Updates monitored Azure DevOps organization details. + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The Azure DevOps organization name. + /// The Azure DevOps organization resource payload. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AzureDevOpsOrgsUpdate(string subscriptionId, string resourceGroupName, string securityConnectorName, string orgName, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrg body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default/azureDevOpsOrgs/" + + global::System.Uri.EscapeDataString(orgName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.AzureDevOpsOrgsUpdate_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Updates monitored Azure DevOps organization details. + /// + /// The Azure DevOps organization resource payload. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AzureDevOpsOrgsUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrg body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/securityConnectors/(?[^/]+)/devops/default/azureDevOpsOrgs/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var securityConnectorName = _match.Groups["securityConnectorName"].Value; + var orgName = _match.Groups["orgName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/securityConnectors/" + + securityConnectorName + + "/devops/default/azureDevOpsOrgs/" + + orgName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.AzureDevOpsOrgsUpdate_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Updates monitored Azure DevOps organization details. + /// + /// The Azure DevOps organization resource payload. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AzureDevOpsOrgsUpdateViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrg body, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/securityConnectors/(?[^/]+)/devops/default/azureDevOpsOrgs/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var securityConnectorName = _match.Groups["securityConnectorName"].Value; + var orgName = _match.Groups["orgName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/securityConnectors/" + + securityConnectorName + + "/devops/default/azureDevOpsOrgs/" + + orgName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.AzureDevOpsOrgsUpdateWithResult_Call (request, eventListener,sender); + } + } + + /// Updates monitored Azure DevOps organization details. + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The Azure DevOps organization name. + /// Json string supplied to the AzureDevOpsOrgsUpdate operation + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AzureDevOpsOrgsUpdateViaJsonString(string subscriptionId, string resourceGroupName, string securityConnectorName, string orgName, global::System.String jsonString, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default/azureDevOpsOrgs/" + + global::System.Uri.EscapeDataString(orgName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.AzureDevOpsOrgsUpdate_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Updates monitored Azure DevOps organization details. + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The Azure DevOps organization name. + /// Json string supplied to the AzureDevOpsOrgsUpdate operation + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AzureDevOpsOrgsUpdateViaJsonStringWithResult(string subscriptionId, string resourceGroupName, string securityConnectorName, string orgName, global::System.String jsonString, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default/azureDevOpsOrgs/" + + global::System.Uri.EscapeDataString(orgName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.AzureDevOpsOrgsUpdateWithResult_Call (request, eventListener,sender); + } + } + + /// Updates monitored Azure DevOps organization details. + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The Azure DevOps organization name. + /// The Azure DevOps organization resource payload. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AzureDevOpsOrgsUpdateWithResult(string subscriptionId, string resourceGroupName, string securityConnectorName, string orgName, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrg body, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default/azureDevOpsOrgs/" + + global::System.Uri.EscapeDataString(orgName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.AzureDevOpsOrgsUpdateWithResult_Call (request, eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AzureDevOpsOrgsUpdateWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 0); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: azure-async-operation + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + // delay before making the next polling request + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.DelayBeforePolling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + break; + } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsOrg.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AzureDevOpsOrgsUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 0); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: azure-async-operation + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + // delay before making the next polling request + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.DelayBeforePolling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsOrg.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The Azure DevOps organization name. + /// The Azure DevOps organization resource payload. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AzureDevOpsOrgsUpdate_Validate(string subscriptionId, string resourceGroupName, string securityConnectorName, string orgName, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrg body, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertRegEx(nameof(subscriptionId), subscriptionId, @"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(securityConnectorName),securityConnectorName); + await eventListener.AssertNotNull(nameof(orgName),orgName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// Create a monitored Azure DevOps project resource. + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The Azure DevOps organization name. + /// The project name. + /// The Azure DevOps project resource payload. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AzureDevOpsProjectsCreateOrUpdate(string subscriptionId, string resourceGroupName, string securityConnectorName, string orgName, string projectName, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProject body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default/azureDevOpsOrgs/" + + global::System.Uri.EscapeDataString(orgName) + + "/projects/" + + global::System.Uri.EscapeDataString(projectName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.AzureDevOpsProjectsCreateOrUpdate_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Create a monitored Azure DevOps project resource. + /// + /// The Azure DevOps project resource payload. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AzureDevOpsProjectsCreateOrUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProject body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/securityConnectors/(?[^/]+)/devops/default/azureDevOpsOrgs/(?[^/]+)/projects/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}/projects/{projectName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var securityConnectorName = _match.Groups["securityConnectorName"].Value; + var orgName = _match.Groups["orgName"].Value; + var projectName = _match.Groups["projectName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/securityConnectors/" + + securityConnectorName + + "/devops/default/azureDevOpsOrgs/" + + orgName + + "/projects/" + + projectName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.AzureDevOpsProjectsCreateOrUpdate_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Create a monitored Azure DevOps project resource. + /// + /// The Azure DevOps project resource payload. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AzureDevOpsProjectsCreateOrUpdateViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProject body, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/securityConnectors/(?[^/]+)/devops/default/azureDevOpsOrgs/(?[^/]+)/projects/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}/projects/{projectName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var securityConnectorName = _match.Groups["securityConnectorName"].Value; + var orgName = _match.Groups["orgName"].Value; + var projectName = _match.Groups["projectName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/securityConnectors/" + + securityConnectorName + + "/devops/default/azureDevOpsOrgs/" + + orgName + + "/projects/" + + projectName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.AzureDevOpsProjectsCreateOrUpdateWithResult_Call (request, eventListener,sender); + } + } + + /// Create a monitored Azure DevOps project resource. + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The Azure DevOps organization name. + /// The project name. + /// Json string supplied to the AzureDevOpsProjectsCreateOrUpdate operation + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AzureDevOpsProjectsCreateOrUpdateViaJsonString(string subscriptionId, string resourceGroupName, string securityConnectorName, string orgName, string projectName, global::System.String jsonString, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default/azureDevOpsOrgs/" + + global::System.Uri.EscapeDataString(orgName) + + "/projects/" + + global::System.Uri.EscapeDataString(projectName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.AzureDevOpsProjectsCreateOrUpdate_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Create a monitored Azure DevOps project resource. + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The Azure DevOps organization name. + /// The project name. + /// Json string supplied to the AzureDevOpsProjectsCreateOrUpdate operation + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AzureDevOpsProjectsCreateOrUpdateViaJsonStringWithResult(string subscriptionId, string resourceGroupName, string securityConnectorName, string orgName, string projectName, global::System.String jsonString, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default/azureDevOpsOrgs/" + + global::System.Uri.EscapeDataString(orgName) + + "/projects/" + + global::System.Uri.EscapeDataString(projectName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.AzureDevOpsProjectsCreateOrUpdateWithResult_Call (request, eventListener,sender); + } + } + + /// Create a monitored Azure DevOps project resource. + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The Azure DevOps organization name. + /// The project name. + /// The Azure DevOps project resource payload. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AzureDevOpsProjectsCreateOrUpdateWithResult(string subscriptionId, string resourceGroupName, string securityConnectorName, string orgName, string projectName, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProject body, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default/azureDevOpsOrgs/" + + global::System.Uri.EscapeDataString(orgName) + + "/projects/" + + global::System.Uri.EscapeDataString(projectName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.AzureDevOpsProjectsCreateOrUpdateWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AzureDevOpsProjectsCreateOrUpdateWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 0); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: azure-async-operation + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + // delay before making the next polling request + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.DelayBeforePolling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + break; + } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsProject.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AzureDevOpsProjectsCreateOrUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 0); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: azure-async-operation + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + // delay before making the next polling request + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.DelayBeforePolling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsProject.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you + /// will get validation events back. + /// + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The Azure DevOps organization name. + /// The project name. + /// The Azure DevOps project resource payload. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AzureDevOpsProjectsCreateOrUpdate_Validate(string subscriptionId, string resourceGroupName, string securityConnectorName, string orgName, string projectName, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProject body, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertRegEx(nameof(subscriptionId), subscriptionId, @"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(securityConnectorName),securityConnectorName); + await eventListener.AssertNotNull(nameof(orgName),orgName); + await eventListener.AssertNotNull(nameof(projectName),projectName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// Returns a monitored Azure DevOps project resource. + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The Azure DevOps organization name. + /// The project name. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AzureDevOpsProjectsGet(string subscriptionId, string resourceGroupName, string securityConnectorName, string orgName, string projectName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default/azureDevOpsOrgs/" + + global::System.Uri.EscapeDataString(orgName) + + "/projects/" + + global::System.Uri.EscapeDataString(projectName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.AzureDevOpsProjectsGet_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Returns a monitored Azure DevOps project resource. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AzureDevOpsProjectsGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/securityConnectors/(?[^/]+)/devops/default/azureDevOpsOrgs/(?[^/]+)/projects/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}/projects/{projectName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var securityConnectorName = _match.Groups["securityConnectorName"].Value; + var orgName = _match.Groups["orgName"].Value; + var projectName = _match.Groups["projectName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/securityConnectors/" + + securityConnectorName + + "/devops/default/azureDevOpsOrgs/" + + orgName + + "/projects/" + + projectName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.AzureDevOpsProjectsGet_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Returns a monitored Azure DevOps project resource. + /// + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AzureDevOpsProjectsGetViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/securityConnectors/(?[^/]+)/devops/default/azureDevOpsOrgs/(?[^/]+)/projects/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}/projects/{projectName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var securityConnectorName = _match.Groups["securityConnectorName"].Value; + var orgName = _match.Groups["orgName"].Value; + var projectName = _match.Groups["projectName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/securityConnectors/" + + securityConnectorName + + "/devops/default/azureDevOpsOrgs/" + + orgName + + "/projects/" + + projectName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.AzureDevOpsProjectsGetWithResult_Call (request, eventListener,sender); + } + } + + /// Returns a monitored Azure DevOps project resource. + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The Azure DevOps organization name. + /// The project name. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AzureDevOpsProjectsGetWithResult(string subscriptionId, string resourceGroupName, string securityConnectorName, string orgName, string projectName, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default/azureDevOpsOrgs/" + + global::System.Uri.EscapeDataString(orgName) + + "/projects/" + + global::System.Uri.EscapeDataString(projectName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.AzureDevOpsProjectsGetWithResult_Call (request, eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AzureDevOpsProjectsGetWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsProject.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AzureDevOpsProjectsGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsProject.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The Azure DevOps organization name. + /// The project name. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AzureDevOpsProjectsGet_Validate(string subscriptionId, string resourceGroupName, string securityConnectorName, string orgName, string projectName, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertRegEx(nameof(subscriptionId), subscriptionId, @"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(securityConnectorName),securityConnectorName); + await eventListener.AssertNotNull(nameof(orgName),orgName); + await eventListener.AssertNotNull(nameof(projectName),projectName); + } + } + + /// Returns a list of Azure DevOps projects onboarded to the connector. + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The Azure DevOps organization name. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AzureDevOpsProjectsList(string subscriptionId, string resourceGroupName, string securityConnectorName, string orgName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default/azureDevOpsOrgs/" + + global::System.Uri.EscapeDataString(orgName) + + "/projects" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.AzureDevOpsProjectsList_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Returns a list of Azure DevOps projects onboarded to the connector. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AzureDevOpsProjectsListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/securityConnectors/(?[^/]+)/devops/default/azureDevOpsOrgs/(?[^/]+)/projects$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}/projects'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var securityConnectorName = _match.Groups["securityConnectorName"].Value; + var orgName = _match.Groups["orgName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/securityConnectors/" + + securityConnectorName + + "/devops/default/azureDevOpsOrgs/" + + orgName + + "/projects" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.AzureDevOpsProjectsList_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Returns a list of Azure DevOps projects onboarded to the connector. + /// + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AzureDevOpsProjectsListViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/securityConnectors/(?[^/]+)/devops/default/azureDevOpsOrgs/(?[^/]+)/projects$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}/projects'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var securityConnectorName = _match.Groups["securityConnectorName"].Value; + var orgName = _match.Groups["orgName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/securityConnectors/" + + securityConnectorName + + "/devops/default/azureDevOpsOrgs/" + + orgName + + "/projects" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.AzureDevOpsProjectsListWithResult_Call (request, eventListener,sender); + } + } + + /// Returns a list of Azure DevOps projects onboarded to the connector. + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The Azure DevOps organization name. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AzureDevOpsProjectsListWithResult(string subscriptionId, string resourceGroupName, string securityConnectorName, string orgName, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default/azureDevOpsOrgs/" + + global::System.Uri.EscapeDataString(orgName) + + "/projects" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.AzureDevOpsProjectsListWithResult_Call (request, eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AzureDevOpsProjectsListWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsProjectListResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AzureDevOpsProjectsList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsProjectListResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. + /// + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The Azure DevOps organization name. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AzureDevOpsProjectsList_Validate(string subscriptionId, string resourceGroupName, string securityConnectorName, string orgName, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertRegEx(nameof(subscriptionId), subscriptionId, @"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(securityConnectorName),securityConnectorName); + await eventListener.AssertNotNull(nameof(orgName),orgName); + } + } + + /// Updates a monitored Azure DevOps project resource. + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The Azure DevOps organization name. + /// The project name. + /// The Azure DevOps project resource payload. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AzureDevOpsProjectsUpdate(string subscriptionId, string resourceGroupName, string securityConnectorName, string orgName, string projectName, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProject body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default/azureDevOpsOrgs/" + + global::System.Uri.EscapeDataString(orgName) + + "/projects/" + + global::System.Uri.EscapeDataString(projectName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.AzureDevOpsProjectsUpdate_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Updates a monitored Azure DevOps project resource. + /// + /// The Azure DevOps project resource payload. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AzureDevOpsProjectsUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProject body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/securityConnectors/(?[^/]+)/devops/default/azureDevOpsOrgs/(?[^/]+)/projects/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}/projects/{projectName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var securityConnectorName = _match.Groups["securityConnectorName"].Value; + var orgName = _match.Groups["orgName"].Value; + var projectName = _match.Groups["projectName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/securityConnectors/" + + securityConnectorName + + "/devops/default/azureDevOpsOrgs/" + + orgName + + "/projects/" + + projectName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.AzureDevOpsProjectsUpdate_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Updates a monitored Azure DevOps project resource. + /// + /// The Azure DevOps project resource payload. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AzureDevOpsProjectsUpdateViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProject body, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/securityConnectors/(?[^/]+)/devops/default/azureDevOpsOrgs/(?[^/]+)/projects/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}/projects/{projectName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var securityConnectorName = _match.Groups["securityConnectorName"].Value; + var orgName = _match.Groups["orgName"].Value; + var projectName = _match.Groups["projectName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/securityConnectors/" + + securityConnectorName + + "/devops/default/azureDevOpsOrgs/" + + orgName + + "/projects/" + + projectName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.AzureDevOpsProjectsUpdateWithResult_Call (request, eventListener,sender); + } + } + + /// Updates a monitored Azure DevOps project resource. + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The Azure DevOps organization name. + /// The project name. + /// Json string supplied to the AzureDevOpsProjectsUpdate operation + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AzureDevOpsProjectsUpdateViaJsonString(string subscriptionId, string resourceGroupName, string securityConnectorName, string orgName, string projectName, global::System.String jsonString, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default/azureDevOpsOrgs/" + + global::System.Uri.EscapeDataString(orgName) + + "/projects/" + + global::System.Uri.EscapeDataString(projectName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.AzureDevOpsProjectsUpdate_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Updates a monitored Azure DevOps project resource. + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The Azure DevOps organization name. + /// The project name. + /// Json string supplied to the AzureDevOpsProjectsUpdate operation + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AzureDevOpsProjectsUpdateViaJsonStringWithResult(string subscriptionId, string resourceGroupName, string securityConnectorName, string orgName, string projectName, global::System.String jsonString, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default/azureDevOpsOrgs/" + + global::System.Uri.EscapeDataString(orgName) + + "/projects/" + + global::System.Uri.EscapeDataString(projectName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.AzureDevOpsProjectsUpdateWithResult_Call (request, eventListener,sender); + } + } + + /// Updates a monitored Azure DevOps project resource. + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The Azure DevOps organization name. + /// The project name. + /// The Azure DevOps project resource payload. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AzureDevOpsProjectsUpdateWithResult(string subscriptionId, string resourceGroupName, string securityConnectorName, string orgName, string projectName, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProject body, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default/azureDevOpsOrgs/" + + global::System.Uri.EscapeDataString(orgName) + + "/projects/" + + global::System.Uri.EscapeDataString(projectName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.AzureDevOpsProjectsUpdateWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AzureDevOpsProjectsUpdateWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 0); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: azure-async-operation + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + // delay before making the next polling request + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.DelayBeforePolling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + break; + } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsProject.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AzureDevOpsProjectsUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 0); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: azure-async-operation + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + // delay before making the next polling request + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.DelayBeforePolling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsProject.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. + /// + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The Azure DevOps organization name. + /// The project name. + /// The Azure DevOps project resource payload. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AzureDevOpsProjectsUpdate_Validate(string subscriptionId, string resourceGroupName, string securityConnectorName, string orgName, string projectName, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProject body, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertRegEx(nameof(subscriptionId), subscriptionId, @"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(securityConnectorName),securityConnectorName); + await eventListener.AssertNotNull(nameof(orgName),orgName); + await eventListener.AssertNotNull(nameof(projectName),projectName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// Create a monitored Azure DevOps repository resource. + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The Azure DevOps organization name. + /// The project name. + /// The repository name. + /// The Azure DevOps repository resource payload. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AzureDevOpsReposCreateOrUpdate(string subscriptionId, string resourceGroupName, string securityConnectorName, string orgName, string projectName, string repoName, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepository body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default/azureDevOpsOrgs/" + + global::System.Uri.EscapeDataString(orgName) + + "/projects/" + + global::System.Uri.EscapeDataString(projectName) + + "/repos/" + + global::System.Uri.EscapeDataString(repoName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.AzureDevOpsReposCreateOrUpdate_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Create a monitored Azure DevOps repository resource. + /// + /// The Azure DevOps repository resource payload. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AzureDevOpsReposCreateOrUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepository body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/securityConnectors/(?[^/]+)/devops/default/azureDevOpsOrgs/(?[^/]+)/projects/(?[^/]+)/repos/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}/projects/{projectName}/repos/{repoName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var securityConnectorName = _match.Groups["securityConnectorName"].Value; + var orgName = _match.Groups["orgName"].Value; + var projectName = _match.Groups["projectName"].Value; + var repoName = _match.Groups["repoName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/securityConnectors/" + + securityConnectorName + + "/devops/default/azureDevOpsOrgs/" + + orgName + + "/projects/" + + projectName + + "/repos/" + + repoName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.AzureDevOpsReposCreateOrUpdate_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Create a monitored Azure DevOps repository resource. + /// + /// The Azure DevOps repository resource payload. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AzureDevOpsReposCreateOrUpdateViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepository body, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/securityConnectors/(?[^/]+)/devops/default/azureDevOpsOrgs/(?[^/]+)/projects/(?[^/]+)/repos/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}/projects/{projectName}/repos/{repoName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var securityConnectorName = _match.Groups["securityConnectorName"].Value; + var orgName = _match.Groups["orgName"].Value; + var projectName = _match.Groups["projectName"].Value; + var repoName = _match.Groups["repoName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/securityConnectors/" + + securityConnectorName + + "/devops/default/azureDevOpsOrgs/" + + orgName + + "/projects/" + + projectName + + "/repos/" + + repoName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.AzureDevOpsReposCreateOrUpdateWithResult_Call (request, eventListener,sender); + } + } + + /// Create a monitored Azure DevOps repository resource. + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The Azure DevOps organization name. + /// The project name. + /// The repository name. + /// Json string supplied to the AzureDevOpsReposCreateOrUpdate operation + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AzureDevOpsReposCreateOrUpdateViaJsonString(string subscriptionId, string resourceGroupName, string securityConnectorName, string orgName, string projectName, string repoName, global::System.String jsonString, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default/azureDevOpsOrgs/" + + global::System.Uri.EscapeDataString(orgName) + + "/projects/" + + global::System.Uri.EscapeDataString(projectName) + + "/repos/" + + global::System.Uri.EscapeDataString(repoName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.AzureDevOpsReposCreateOrUpdate_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Create a monitored Azure DevOps repository resource. + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The Azure DevOps organization name. + /// The project name. + /// The repository name. + /// Json string supplied to the AzureDevOpsReposCreateOrUpdate operation + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AzureDevOpsReposCreateOrUpdateViaJsonStringWithResult(string subscriptionId, string resourceGroupName, string securityConnectorName, string orgName, string projectName, string repoName, global::System.String jsonString, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default/azureDevOpsOrgs/" + + global::System.Uri.EscapeDataString(orgName) + + "/projects/" + + global::System.Uri.EscapeDataString(projectName) + + "/repos/" + + global::System.Uri.EscapeDataString(repoName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.AzureDevOpsReposCreateOrUpdateWithResult_Call (request, eventListener,sender); + } + } + + /// Create a monitored Azure DevOps repository resource. + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The Azure DevOps organization name. + /// The project name. + /// The repository name. + /// The Azure DevOps repository resource payload. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AzureDevOpsReposCreateOrUpdateWithResult(string subscriptionId, string resourceGroupName, string securityConnectorName, string orgName, string projectName, string repoName, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepository body, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default/azureDevOpsOrgs/" + + global::System.Uri.EscapeDataString(orgName) + + "/projects/" + + global::System.Uri.EscapeDataString(projectName) + + "/repos/" + + global::System.Uri.EscapeDataString(repoName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.AzureDevOpsReposCreateOrUpdateWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AzureDevOpsReposCreateOrUpdateWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 0); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: azure-async-operation + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + // delay before making the next polling request + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.DelayBeforePolling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + break; + } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsRepository.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AzureDevOpsReposCreateOrUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 0); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: azure-async-operation + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + // delay before making the next polling request + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.DelayBeforePolling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsRepository.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The Azure DevOps organization name. + /// The project name. + /// The repository name. + /// The Azure DevOps repository resource payload. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AzureDevOpsReposCreateOrUpdate_Validate(string subscriptionId, string resourceGroupName, string securityConnectorName, string orgName, string projectName, string repoName, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepository body, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertRegEx(nameof(subscriptionId), subscriptionId, @"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(securityConnectorName),securityConnectorName); + await eventListener.AssertNotNull(nameof(orgName),orgName); + await eventListener.AssertNotNull(nameof(projectName),projectName); + await eventListener.AssertNotNull(nameof(repoName),repoName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// Returns a monitored Azure DevOps repository resource. + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The Azure DevOps organization name. + /// The project name. + /// The repository name. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AzureDevOpsReposGet(string subscriptionId, string resourceGroupName, string securityConnectorName, string orgName, string projectName, string repoName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default/azureDevOpsOrgs/" + + global::System.Uri.EscapeDataString(orgName) + + "/projects/" + + global::System.Uri.EscapeDataString(projectName) + + "/repos/" + + global::System.Uri.EscapeDataString(repoName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.AzureDevOpsReposGet_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Returns a monitored Azure DevOps repository resource. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AzureDevOpsReposGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/securityConnectors/(?[^/]+)/devops/default/azureDevOpsOrgs/(?[^/]+)/projects/(?[^/]+)/repos/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}/projects/{projectName}/repos/{repoName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var securityConnectorName = _match.Groups["securityConnectorName"].Value; + var orgName = _match.Groups["orgName"].Value; + var projectName = _match.Groups["projectName"].Value; + var repoName = _match.Groups["repoName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/securityConnectors/" + + securityConnectorName + + "/devops/default/azureDevOpsOrgs/" + + orgName + + "/projects/" + + projectName + + "/repos/" + + repoName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.AzureDevOpsReposGet_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Returns a monitored Azure DevOps repository resource. + /// + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AzureDevOpsReposGetViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/securityConnectors/(?[^/]+)/devops/default/azureDevOpsOrgs/(?[^/]+)/projects/(?[^/]+)/repos/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}/projects/{projectName}/repos/{repoName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var securityConnectorName = _match.Groups["securityConnectorName"].Value; + var orgName = _match.Groups["orgName"].Value; + var projectName = _match.Groups["projectName"].Value; + var repoName = _match.Groups["repoName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/securityConnectors/" + + securityConnectorName + + "/devops/default/azureDevOpsOrgs/" + + orgName + + "/projects/" + + projectName + + "/repos/" + + repoName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.AzureDevOpsReposGetWithResult_Call (request, eventListener,sender); + } + } + + /// Returns a monitored Azure DevOps repository resource. + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The Azure DevOps organization name. + /// The project name. + /// The repository name. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AzureDevOpsReposGetWithResult(string subscriptionId, string resourceGroupName, string securityConnectorName, string orgName, string projectName, string repoName, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default/azureDevOpsOrgs/" + + global::System.Uri.EscapeDataString(orgName) + + "/projects/" + + global::System.Uri.EscapeDataString(projectName) + + "/repos/" + + global::System.Uri.EscapeDataString(repoName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.AzureDevOpsReposGetWithResult_Call (request, eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AzureDevOpsReposGetWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsRepository.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AzureDevOpsReposGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsRepository.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The Azure DevOps organization name. + /// The project name. + /// The repository name. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AzureDevOpsReposGet_Validate(string subscriptionId, string resourceGroupName, string securityConnectorName, string orgName, string projectName, string repoName, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertRegEx(nameof(subscriptionId), subscriptionId, @"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(securityConnectorName),securityConnectorName); + await eventListener.AssertNotNull(nameof(orgName),orgName); + await eventListener.AssertNotNull(nameof(projectName),projectName); + await eventListener.AssertNotNull(nameof(repoName),repoName); + } + } + + /// Returns a list of Azure DevOps repositories onboarded to the connector. + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The Azure DevOps organization name. + /// The project name. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AzureDevOpsReposList(string subscriptionId, string resourceGroupName, string securityConnectorName, string orgName, string projectName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default/azureDevOpsOrgs/" + + global::System.Uri.EscapeDataString(orgName) + + "/projects/" + + global::System.Uri.EscapeDataString(projectName) + + "/repos" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.AzureDevOpsReposList_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Returns a list of Azure DevOps repositories onboarded to the connector. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AzureDevOpsReposListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/securityConnectors/(?[^/]+)/devops/default/azureDevOpsOrgs/(?[^/]+)/projects/(?[^/]+)/repos$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}/projects/{projectName}/repos'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var securityConnectorName = _match.Groups["securityConnectorName"].Value; + var orgName = _match.Groups["orgName"].Value; + var projectName = _match.Groups["projectName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/securityConnectors/" + + securityConnectorName + + "/devops/default/azureDevOpsOrgs/" + + orgName + + "/projects/" + + projectName + + "/repos" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.AzureDevOpsReposList_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Returns a list of Azure DevOps repositories onboarded to the connector. + /// + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AzureDevOpsReposListViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/securityConnectors/(?[^/]+)/devops/default/azureDevOpsOrgs/(?[^/]+)/projects/(?[^/]+)/repos$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}/projects/{projectName}/repos'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var securityConnectorName = _match.Groups["securityConnectorName"].Value; + var orgName = _match.Groups["orgName"].Value; + var projectName = _match.Groups["projectName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/securityConnectors/" + + securityConnectorName + + "/devops/default/azureDevOpsOrgs/" + + orgName + + "/projects/" + + projectName + + "/repos" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.AzureDevOpsReposListWithResult_Call (request, eventListener,sender); + } + } + + /// Returns a list of Azure DevOps repositories onboarded to the connector. + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The Azure DevOps organization name. + /// The project name. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AzureDevOpsReposListWithResult(string subscriptionId, string resourceGroupName, string securityConnectorName, string orgName, string projectName, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default/azureDevOpsOrgs/" + + global::System.Uri.EscapeDataString(orgName) + + "/projects/" + + global::System.Uri.EscapeDataString(projectName) + + "/repos" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.AzureDevOpsReposListWithResult_Call (request, eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AzureDevOpsReposListWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsRepositoryListResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AzureDevOpsReposList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsRepositoryListResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The Azure DevOps organization name. + /// The project name. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AzureDevOpsReposList_Validate(string subscriptionId, string resourceGroupName, string securityConnectorName, string orgName, string projectName, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertRegEx(nameof(subscriptionId), subscriptionId, @"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(securityConnectorName),securityConnectorName); + await eventListener.AssertNotNull(nameof(orgName),orgName); + await eventListener.AssertNotNull(nameof(projectName),projectName); + } + } + + /// Updates a monitored Azure DevOps repository resource. + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The Azure DevOps organization name. + /// The project name. + /// The repository name. + /// The Azure DevOps repository resource payload. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AzureDevOpsReposUpdate(string subscriptionId, string resourceGroupName, string securityConnectorName, string orgName, string projectName, string repoName, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepository body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default/azureDevOpsOrgs/" + + global::System.Uri.EscapeDataString(orgName) + + "/projects/" + + global::System.Uri.EscapeDataString(projectName) + + "/repos/" + + global::System.Uri.EscapeDataString(repoName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.AzureDevOpsReposUpdate_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Updates a monitored Azure DevOps repository resource. + /// + /// The Azure DevOps repository resource payload. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AzureDevOpsReposUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepository body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/securityConnectors/(?[^/]+)/devops/default/azureDevOpsOrgs/(?[^/]+)/projects/(?[^/]+)/repos/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}/projects/{projectName}/repos/{repoName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var securityConnectorName = _match.Groups["securityConnectorName"].Value; + var orgName = _match.Groups["orgName"].Value; + var projectName = _match.Groups["projectName"].Value; + var repoName = _match.Groups["repoName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/securityConnectors/" + + securityConnectorName + + "/devops/default/azureDevOpsOrgs/" + + orgName + + "/projects/" + + projectName + + "/repos/" + + repoName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.AzureDevOpsReposUpdate_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Updates a monitored Azure DevOps repository resource. + /// + /// The Azure DevOps repository resource payload. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AzureDevOpsReposUpdateViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepository body, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/securityConnectors/(?[^/]+)/devops/default/azureDevOpsOrgs/(?[^/]+)/projects/(?[^/]+)/repos/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}/projects/{projectName}/repos/{repoName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var securityConnectorName = _match.Groups["securityConnectorName"].Value; + var orgName = _match.Groups["orgName"].Value; + var projectName = _match.Groups["projectName"].Value; + var repoName = _match.Groups["repoName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/securityConnectors/" + + securityConnectorName + + "/devops/default/azureDevOpsOrgs/" + + orgName + + "/projects/" + + projectName + + "/repos/" + + repoName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.AzureDevOpsReposUpdateWithResult_Call (request, eventListener,sender); + } + } + + /// Updates a monitored Azure DevOps repository resource. + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The Azure DevOps organization name. + /// The project name. + /// The repository name. + /// Json string supplied to the AzureDevOpsReposUpdate operation + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AzureDevOpsReposUpdateViaJsonString(string subscriptionId, string resourceGroupName, string securityConnectorName, string orgName, string projectName, string repoName, global::System.String jsonString, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default/azureDevOpsOrgs/" + + global::System.Uri.EscapeDataString(orgName) + + "/projects/" + + global::System.Uri.EscapeDataString(projectName) + + "/repos/" + + global::System.Uri.EscapeDataString(repoName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.AzureDevOpsReposUpdate_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Updates a monitored Azure DevOps repository resource. + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The Azure DevOps organization name. + /// The project name. + /// The repository name. + /// Json string supplied to the AzureDevOpsReposUpdate operation + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AzureDevOpsReposUpdateViaJsonStringWithResult(string subscriptionId, string resourceGroupName, string securityConnectorName, string orgName, string projectName, string repoName, global::System.String jsonString, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default/azureDevOpsOrgs/" + + global::System.Uri.EscapeDataString(orgName) + + "/projects/" + + global::System.Uri.EscapeDataString(projectName) + + "/repos/" + + global::System.Uri.EscapeDataString(repoName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.AzureDevOpsReposUpdateWithResult_Call (request, eventListener,sender); + } + } + + /// Updates a monitored Azure DevOps repository resource. + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The Azure DevOps organization name. + /// The project name. + /// The repository name. + /// The Azure DevOps repository resource payload. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AzureDevOpsReposUpdateWithResult(string subscriptionId, string resourceGroupName, string securityConnectorName, string orgName, string projectName, string repoName, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepository body, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default/azureDevOpsOrgs/" + + global::System.Uri.EscapeDataString(orgName) + + "/projects/" + + global::System.Uri.EscapeDataString(projectName) + + "/repos/" + + global::System.Uri.EscapeDataString(repoName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.AzureDevOpsReposUpdateWithResult_Call (request, eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AzureDevOpsReposUpdateWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 0); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: azure-async-operation + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + // delay before making the next polling request + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.DelayBeforePolling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + break; + } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsRepository.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AzureDevOpsReposUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 0); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: azure-async-operation + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + // delay before making the next polling request + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.DelayBeforePolling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsRepository.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The Azure DevOps organization name. + /// The project name. + /// The repository name. + /// The Azure DevOps repository resource payload. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AzureDevOpsReposUpdate_Validate(string subscriptionId, string resourceGroupName, string securityConnectorName, string orgName, string projectName, string repoName, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepository body, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertRegEx(nameof(subscriptionId), subscriptionId, @"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(securityConnectorName),securityConnectorName); + await eventListener.AssertNotNull(nameof(orgName),orgName); + await eventListener.AssertNotNull(nameof(projectName),projectName); + await eventListener.AssertNotNull(nameof(repoName),repoName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// Create a DevOps Configuration. + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The DevOps configuration resource payload. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task DevOpsConfigurationsCreateOrUpdate(string subscriptionId, string resourceGroupName, string securityConnectorName, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfiguration body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.DevOpsConfigurationsCreateOrUpdate_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Create a DevOps Configuration. + /// + /// The DevOps configuration resource payload. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task DevOpsConfigurationsCreateOrUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfiguration body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/securityConnectors/(?[^/]+)/devops/default$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var securityConnectorName = _match.Groups["securityConnectorName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/securityConnectors/" + + securityConnectorName + + "/devops/default" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.DevOpsConfigurationsCreateOrUpdate_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Create a DevOps Configuration. + /// + /// The DevOps configuration resource payload. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task DevOpsConfigurationsCreateOrUpdateViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfiguration body, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/securityConnectors/(?[^/]+)/devops/default$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var securityConnectorName = _match.Groups["securityConnectorName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/securityConnectors/" + + securityConnectorName + + "/devops/default" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.DevOpsConfigurationsCreateOrUpdateWithResult_Call (request, eventListener,sender); + } + } + + /// Create a DevOps Configuration. + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// Json string supplied to the DevOpsConfigurationsCreateOrUpdate operation + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task DevOpsConfigurationsCreateOrUpdateViaJsonString(string subscriptionId, string resourceGroupName, string securityConnectorName, global::System.String jsonString, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.DevOpsConfigurationsCreateOrUpdate_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Create a DevOps Configuration. + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// Json string supplied to the DevOpsConfigurationsCreateOrUpdate operation + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task DevOpsConfigurationsCreateOrUpdateViaJsonStringWithResult(string subscriptionId, string resourceGroupName, string securityConnectorName, global::System.String jsonString, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.DevOpsConfigurationsCreateOrUpdateWithResult_Call (request, eventListener,sender); + } + } + + /// Create a DevOps Configuration. + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The DevOps configuration resource payload. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task DevOpsConfigurationsCreateOrUpdateWithResult(string subscriptionId, string resourceGroupName, string securityConnectorName, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfiguration body, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.DevOpsConfigurationsCreateOrUpdateWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task DevOpsConfigurationsCreateOrUpdateWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 0); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: azure-async-operation + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + // delay before making the next polling request + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.DelayBeforePolling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + break; + } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DevOpsConfiguration.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task DevOpsConfigurationsCreateOrUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 0); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: azure-async-operation + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + // delay before making the next polling request + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.DelayBeforePolling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DevOpsConfiguration.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you + /// will get validation events back. + /// + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The DevOps configuration resource payload. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task DevOpsConfigurationsCreateOrUpdate_Validate(string subscriptionId, string resourceGroupName, string securityConnectorName, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfiguration body, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertRegEx(nameof(subscriptionId), subscriptionId, @"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(securityConnectorName),securityConnectorName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// Deletes a DevOps Connector. + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task DevOpsConfigurationsDelete(string subscriptionId, string resourceGroupName, string securityConnectorName, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.DevOpsConfigurationsDelete_Call (request, onOk,onNoContent,onDefault,eventListener,sender); + } + } + + /// Deletes a DevOps Connector. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task DevOpsConfigurationsDeleteViaIdentity(global::System.String viaIdentity, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/securityConnectors/(?[^/]+)/devops/default$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var securityConnectorName = _match.Groups["securityConnectorName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/securityConnectors/" + + securityConnectorName + + "/devops/default" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.DevOpsConfigurationsDelete_Call (request, onOk,onNoContent,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task DevOpsConfigurationsDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 0); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + // delay before making the next polling request + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.DelayBeforePolling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_finalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response); + break; + } + case global::System.Net.HttpStatusCode.NoContent: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onNoContent(_response); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. + /// + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task DevOpsConfigurationsDelete_Validate(string subscriptionId, string resourceGroupName, string securityConnectorName, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertRegEx(nameof(subscriptionId), subscriptionId, @"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(securityConnectorName),securityConnectorName); + } + } + + /// Gets a DevOps Configuration. + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task DevOpsConfigurationsGet(string subscriptionId, string resourceGroupName, string securityConnectorName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.DevOpsConfigurationsGet_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Gets a DevOps Configuration. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task DevOpsConfigurationsGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/securityConnectors/(?[^/]+)/devops/default$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var securityConnectorName = _match.Groups["securityConnectorName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/securityConnectors/" + + securityConnectorName + + "/devops/default" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.DevOpsConfigurationsGet_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Gets a DevOps Configuration. + /// + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task DevOpsConfigurationsGetViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/securityConnectors/(?[^/]+)/devops/default$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var securityConnectorName = _match.Groups["securityConnectorName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/securityConnectors/" + + securityConnectorName + + "/devops/default" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.DevOpsConfigurationsGetWithResult_Call (request, eventListener,sender); + } + } + + /// Gets a DevOps Configuration. + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task DevOpsConfigurationsGetWithResult(string subscriptionId, string resourceGroupName, string securityConnectorName, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.DevOpsConfigurationsGetWithResult_Call (request, eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task DevOpsConfigurationsGetWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DevOpsConfiguration.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task DevOpsConfigurationsGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DevOpsConfiguration.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. + /// + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task DevOpsConfigurationsGet_Validate(string subscriptionId, string resourceGroupName, string securityConnectorName, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertRegEx(nameof(subscriptionId), subscriptionId, @"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(securityConnectorName),securityConnectorName); + } + } + + /// List DevOps Configurations. + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task DevOpsConfigurationsList(string subscriptionId, string resourceGroupName, string securityConnectorName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.DevOpsConfigurationsList_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// List DevOps Configurations. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task DevOpsConfigurationsListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/securityConnectors/(?[^/]+)/devops$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var securityConnectorName = _match.Groups["securityConnectorName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/securityConnectors/" + + securityConnectorName + + "/devops" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.DevOpsConfigurationsList_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// List DevOps Configurations. + /// + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task DevOpsConfigurationsListViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/securityConnectors/(?[^/]+)/devops$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var securityConnectorName = _match.Groups["securityConnectorName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/securityConnectors/" + + securityConnectorName + + "/devops" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.DevOpsConfigurationsListWithResult_Call (request, eventListener,sender); + } + } + + /// List DevOps Configurations. + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task DevOpsConfigurationsListWithResult(string subscriptionId, string resourceGroupName, string securityConnectorName, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.DevOpsConfigurationsListWithResult_Call (request, eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task DevOpsConfigurationsListWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DevOpsConfigurationListResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task DevOpsConfigurationsList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DevOpsConfigurationListResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. + /// + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task DevOpsConfigurationsList_Validate(string subscriptionId, string resourceGroupName, string securityConnectorName, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertRegEx(nameof(subscriptionId), subscriptionId, @"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(securityConnectorName),securityConnectorName); + } + } + + /// Updates a DevOps Configuration. + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The DevOps configuration resource payload. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task DevOpsConfigurationsUpdate(string subscriptionId, string resourceGroupName, string securityConnectorName, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfiguration body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.DevOpsConfigurationsUpdate_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Updates a DevOps Configuration. + /// + /// The DevOps configuration resource payload. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task DevOpsConfigurationsUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfiguration body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/securityConnectors/(?[^/]+)/devops/default$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var securityConnectorName = _match.Groups["securityConnectorName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/securityConnectors/" + + securityConnectorName + + "/devops/default" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.DevOpsConfigurationsUpdate_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Updates a DevOps Configuration. + /// + /// The DevOps configuration resource payload. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task DevOpsConfigurationsUpdateViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfiguration body, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/securityConnectors/(?[^/]+)/devops/default$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var securityConnectorName = _match.Groups["securityConnectorName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/securityConnectors/" + + securityConnectorName + + "/devops/default" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.DevOpsConfigurationsUpdateWithResult_Call (request, eventListener,sender); + } + } + + /// Updates a DevOps Configuration. + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// Json string supplied to the DevOpsConfigurationsUpdate operation + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task DevOpsConfigurationsUpdateViaJsonString(string subscriptionId, string resourceGroupName, string securityConnectorName, global::System.String jsonString, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.DevOpsConfigurationsUpdate_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Updates a DevOps Configuration. + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// Json string supplied to the DevOpsConfigurationsUpdate operation + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task DevOpsConfigurationsUpdateViaJsonStringWithResult(string subscriptionId, string resourceGroupName, string securityConnectorName, global::System.String jsonString, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.DevOpsConfigurationsUpdateWithResult_Call (request, eventListener,sender); + } + } + + /// Updates a DevOps Configuration. + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The DevOps configuration resource payload. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task DevOpsConfigurationsUpdateWithResult(string subscriptionId, string resourceGroupName, string securityConnectorName, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfiguration body, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.DevOpsConfigurationsUpdateWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task DevOpsConfigurationsUpdateWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 0); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: azure-async-operation + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + // delay before making the next polling request + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.DelayBeforePolling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + break; + } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DevOpsConfiguration.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task DevOpsConfigurationsUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 0); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: azure-async-operation + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + // delay before making the next polling request + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.DelayBeforePolling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DevOpsConfiguration.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. + /// + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The DevOps configuration resource payload. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task DevOpsConfigurationsUpdate_Validate(string subscriptionId, string resourceGroupName, string securityConnectorName, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfiguration body, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertRegEx(nameof(subscriptionId), subscriptionId, @"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(securityConnectorName),securityConnectorName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// Get devops long running operation result. + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The operation result Id. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task DevOpsOperationResultsGet(string subscriptionId, string resourceGroupName, string securityConnectorName, string operationResultId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default/operationResults/" + + global::System.Uri.EscapeDataString(operationResultId) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.DevOpsOperationResultsGet_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Get devops long running operation result. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task DevOpsOperationResultsGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/securityConnectors/(?[^/]+)/devops/default/operationResults/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/operationResults/{operationResultId}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var securityConnectorName = _match.Groups["securityConnectorName"].Value; + var operationResultId = _match.Groups["operationResultId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/securityConnectors/" + + securityConnectorName + + "/devops/default/operationResults/" + + operationResultId + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.DevOpsOperationResultsGet_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Get devops long running operation result. + /// + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task DevOpsOperationResultsGetViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/securityConnectors/(?[^/]+)/devops/default/operationResults/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/operationResults/{operationResultId}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var securityConnectorName = _match.Groups["securityConnectorName"].Value; + var operationResultId = _match.Groups["operationResultId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/securityConnectors/" + + securityConnectorName + + "/devops/default/operationResults/" + + operationResultId + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.DevOpsOperationResultsGetWithResult_Call (request, eventListener,sender); + } + } + + /// Get devops long running operation result. + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The operation result Id. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task DevOpsOperationResultsGetWithResult(string subscriptionId, string resourceGroupName, string securityConnectorName, string operationResultId, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default/operationResults/" + + global::System.Uri.EscapeDataString(operationResultId) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.DevOpsOperationResultsGetWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task DevOpsOperationResultsGetWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.OperationStatusResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task DevOpsOperationResultsGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.OperationStatusResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. + /// + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The operation result Id. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task DevOpsOperationResultsGet_Validate(string subscriptionId, string resourceGroupName, string securityConnectorName, string operationResultId, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertRegEx(nameof(subscriptionId), subscriptionId, @"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(securityConnectorName),securityConnectorName); + await eventListener.AssertNotNull(nameof(operationResultId),operationResultId); + } + } + + /// Returns a monitored GitHub owner. + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The GitHub owner name. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GitHubOwnersGet(string subscriptionId, string resourceGroupName, string securityConnectorName, string ownerName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default/gitHubOwners/" + + global::System.Uri.EscapeDataString(ownerName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.GitHubOwnersGet_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Returns a monitored GitHub owner. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GitHubOwnersGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/securityConnectors/(?[^/]+)/devops/default/gitHubOwners/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitHubOwners/{ownerName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var securityConnectorName = _match.Groups["securityConnectorName"].Value; + var ownerName = _match.Groups["ownerName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/securityConnectors/" + + securityConnectorName + + "/devops/default/gitHubOwners/" + + ownerName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.GitHubOwnersGet_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Returns a monitored GitHub owner. + /// + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A + /// that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GitHubOwnersGetViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/securityConnectors/(?[^/]+)/devops/default/gitHubOwners/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitHubOwners/{ownerName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var securityConnectorName = _match.Groups["securityConnectorName"].Value; + var ownerName = _match.Groups["ownerName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/securityConnectors/" + + securityConnectorName + + "/devops/default/gitHubOwners/" + + ownerName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.GitHubOwnersGetWithResult_Call (request, eventListener,sender); + } + } + + /// Returns a monitored GitHub owner. + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The GitHub owner name. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A + /// that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GitHubOwnersGetWithResult(string subscriptionId, string resourceGroupName, string securityConnectorName, string ownerName, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default/gitHubOwners/" + + global::System.Uri.EscapeDataString(ownerName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.GitHubOwnersGetWithResult_Call (request, eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A + /// that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task GitHubOwnersGetWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitHubOwner.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task GitHubOwnersGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitHubOwner.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The GitHub owner name. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task GitHubOwnersGet_Validate(string subscriptionId, string resourceGroupName, string securityConnectorName, string ownerName, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertRegEx(nameof(subscriptionId), subscriptionId, @"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(securityConnectorName),securityConnectorName); + await eventListener.AssertNotNull(nameof(ownerName),ownerName); + } + } + + /// Returns a list of GitHub owners onboarded to the connector. + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GitHubOwnersList(string subscriptionId, string resourceGroupName, string securityConnectorName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default/gitHubOwners" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.GitHubOwnersList_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// Returns a list of all GitHub owners accessible by the user token consumed by the connector. + /// + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GitHubOwnersListAvailable(string subscriptionId, string resourceGroupName, string securityConnectorName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default/listAvailableGitHubOwners" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.GitHubOwnersListAvailable_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// Returns a list of all GitHub owners accessible by the user token consumed by the connector. + /// + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GitHubOwnersListAvailableViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/securityConnectors/(?[^/]+)/devops/default$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var securityConnectorName = _match.Groups["securityConnectorName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/securityConnectors/" + + securityConnectorName + + "/devops/default/listAvailableGitHubOwners" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.GitHubOwnersListAvailable_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// Returns a list of all GitHub owners accessible by the user token consumed by the connector. + /// + /// + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GitHubOwnersListAvailableViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/securityConnectors/(?[^/]+)/devops/default$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var securityConnectorName = _match.Groups["securityConnectorName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/securityConnectors/" + + securityConnectorName + + "/devops/default/listAvailableGitHubOwners" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.GitHubOwnersListAvailableWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Returns a list of all GitHub owners accessible by the user token consumed by the connector. + /// + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GitHubOwnersListAvailableWithResult(string subscriptionId, string resourceGroupName, string securityConnectorName, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default/listAvailableGitHubOwners" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.GitHubOwnersListAvailableWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task GitHubOwnersListAvailableWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitHubOwnerListResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task GitHubOwnersListAvailable_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitHubOwnerListResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. + /// + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task GitHubOwnersListAvailable_Validate(string subscriptionId, string resourceGroupName, string securityConnectorName, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertRegEx(nameof(subscriptionId), subscriptionId, @"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(securityConnectorName),securityConnectorName); + } + } + + /// Returns a list of GitHub owners onboarded to the connector. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GitHubOwnersListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/securityConnectors/(?[^/]+)/devops/default/gitHubOwners$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitHubOwners'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var securityConnectorName = _match.Groups["securityConnectorName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/securityConnectors/" + + securityConnectorName + + "/devops/default/gitHubOwners" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.GitHubOwnersList_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Returns a list of GitHub owners onboarded to the connector. + /// + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GitHubOwnersListViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/securityConnectors/(?[^/]+)/devops/default/gitHubOwners$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitHubOwners'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var securityConnectorName = _match.Groups["securityConnectorName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/securityConnectors/" + + securityConnectorName + + "/devops/default/gitHubOwners" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.GitHubOwnersListWithResult_Call (request, eventListener,sender); + } + } + + /// Returns a list of GitHub owners onboarded to the connector. + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GitHubOwnersListWithResult(string subscriptionId, string resourceGroupName, string securityConnectorName, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default/gitHubOwners" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.GitHubOwnersListWithResult_Call (request, eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task GitHubOwnersListWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitHubOwnerListResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task GitHubOwnersList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitHubOwnerListResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task GitHubOwnersList_Validate(string subscriptionId, string resourceGroupName, string securityConnectorName, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertRegEx(nameof(subscriptionId), subscriptionId, @"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(securityConnectorName),securityConnectorName); + } + } + + /// Returns a monitored GitHub repository. + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The GitHub owner name. + /// The repository name. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GitHubReposGet(string subscriptionId, string resourceGroupName, string securityConnectorName, string ownerName, string repoName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default/gitHubOwners/" + + global::System.Uri.EscapeDataString(ownerName) + + "/repos/" + + global::System.Uri.EscapeDataString(repoName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.GitHubReposGet_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Returns a monitored GitHub repository. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GitHubReposGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/securityConnectors/(?[^/]+)/devops/default/gitHubOwners/(?[^/]+)/repos/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitHubOwners/{ownerName}/repos/{repoName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var securityConnectorName = _match.Groups["securityConnectorName"].Value; + var ownerName = _match.Groups["ownerName"].Value; + var repoName = _match.Groups["repoName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/securityConnectors/" + + securityConnectorName + + "/devops/default/gitHubOwners/" + + ownerName + + "/repos/" + + repoName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.GitHubReposGet_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Returns a monitored GitHub repository. + /// + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GitHubReposGetViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/securityConnectors/(?[^/]+)/devops/default/gitHubOwners/(?[^/]+)/repos/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitHubOwners/{ownerName}/repos/{repoName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var securityConnectorName = _match.Groups["securityConnectorName"].Value; + var ownerName = _match.Groups["ownerName"].Value; + var repoName = _match.Groups["repoName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/securityConnectors/" + + securityConnectorName + + "/devops/default/gitHubOwners/" + + ownerName + + "/repos/" + + repoName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.GitHubReposGetWithResult_Call (request, eventListener,sender); + } + } + + /// Returns a monitored GitHub repository. + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The GitHub owner name. + /// The repository name. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GitHubReposGetWithResult(string subscriptionId, string resourceGroupName, string securityConnectorName, string ownerName, string repoName, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default/gitHubOwners/" + + global::System.Uri.EscapeDataString(ownerName) + + "/repos/" + + global::System.Uri.EscapeDataString(repoName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.GitHubReposGetWithResult_Call (request, eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task GitHubReposGetWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitHubRepository.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task GitHubReposGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitHubRepository.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The GitHub owner name. + /// The repository name. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task GitHubReposGet_Validate(string subscriptionId, string resourceGroupName, string securityConnectorName, string ownerName, string repoName, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertRegEx(nameof(subscriptionId), subscriptionId, @"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(securityConnectorName),securityConnectorName); + await eventListener.AssertNotNull(nameof(ownerName),ownerName); + await eventListener.AssertNotNull(nameof(repoName),repoName); + } + } + + /// Returns a list of GitHub repositories onboarded to the connector. + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The GitHub owner name. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GitHubReposList(string subscriptionId, string resourceGroupName, string securityConnectorName, string ownerName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default/gitHubOwners/" + + global::System.Uri.EscapeDataString(ownerName) + + "/repos" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.GitHubReposList_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Returns a list of GitHub repositories onboarded to the connector. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GitHubReposListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/securityConnectors/(?[^/]+)/devops/default/gitHubOwners/(?[^/]+)/repos$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitHubOwners/{ownerName}/repos'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var securityConnectorName = _match.Groups["securityConnectorName"].Value; + var ownerName = _match.Groups["ownerName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/securityConnectors/" + + securityConnectorName + + "/devops/default/gitHubOwners/" + + ownerName + + "/repos" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.GitHubReposList_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Returns a list of GitHub repositories onboarded to the connector. + /// + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GitHubReposListViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/securityConnectors/(?[^/]+)/devops/default/gitHubOwners/(?[^/]+)/repos$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitHubOwners/{ownerName}/repos'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var securityConnectorName = _match.Groups["securityConnectorName"].Value; + var ownerName = _match.Groups["ownerName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/securityConnectors/" + + securityConnectorName + + "/devops/default/gitHubOwners/" + + ownerName + + "/repos" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.GitHubReposListWithResult_Call (request, eventListener,sender); + } + } + + /// Returns a list of GitHub repositories onboarded to the connector. + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The GitHub owner name. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GitHubReposListWithResult(string subscriptionId, string resourceGroupName, string securityConnectorName, string ownerName, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default/gitHubOwners/" + + global::System.Uri.EscapeDataString(ownerName) + + "/repos" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.GitHubReposListWithResult_Call (request, eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task GitHubReposListWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitHubRepositoryListResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task GitHubReposList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitHubRepositoryListResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The GitHub owner name. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task GitHubReposList_Validate(string subscriptionId, string resourceGroupName, string securityConnectorName, string ownerName, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertRegEx(nameof(subscriptionId), subscriptionId, @"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(securityConnectorName),securityConnectorName); + await eventListener.AssertNotNull(nameof(ownerName),ownerName); + } + } + + /// Returns a monitored GitLab Group resource for a given fully-qualified name. + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The GitLab group fully-qualified name. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GitLabGroupsGet(string subscriptionId, string resourceGroupName, string securityConnectorName, string groupFqName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default/gitLabGroups/" + + global::System.Uri.EscapeDataString(groupFqName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.GitLabGroupsGet_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Returns a monitored GitLab Group resource for a given fully-qualified name. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GitLabGroupsGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/securityConnectors/(?[^/]+)/devops/default/gitLabGroups/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitLabGroups/{groupFQName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var securityConnectorName = _match.Groups["securityConnectorName"].Value; + var groupFqName = _match.Groups["groupFQName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/securityConnectors/" + + securityConnectorName + + "/devops/default/gitLabGroups/" + + groupFqName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.GitLabGroupsGet_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Returns a monitored GitLab Group resource for a given fully-qualified name. + /// + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A + /// that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GitLabGroupsGetViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/securityConnectors/(?[^/]+)/devops/default/gitLabGroups/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitLabGroups/{groupFQName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var securityConnectorName = _match.Groups["securityConnectorName"].Value; + var groupFqName = _match.Groups["groupFQName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/securityConnectors/" + + securityConnectorName + + "/devops/default/gitLabGroups/" + + groupFqName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.GitLabGroupsGetWithResult_Call (request, eventListener,sender); + } + } + + /// Returns a monitored GitLab Group resource for a given fully-qualified name. + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The GitLab group fully-qualified name. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A + /// that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GitLabGroupsGetWithResult(string subscriptionId, string resourceGroupName, string securityConnectorName, string groupFqName, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default/gitLabGroups/" + + global::System.Uri.EscapeDataString(groupFqName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.GitLabGroupsGetWithResult_Call (request, eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A + /// that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task GitLabGroupsGetWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitLabGroup.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task GitLabGroupsGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitLabGroup.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The GitLab group fully-qualified name. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task GitLabGroupsGet_Validate(string subscriptionId, string resourceGroupName, string securityConnectorName, string groupFqName, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertRegEx(nameof(subscriptionId), subscriptionId, @"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(securityConnectorName),securityConnectorName); + await eventListener.AssertNotNull(nameof(groupFqName),groupFqName); + } + } + + /// Returns a list of GitLab groups onboarded to the connector. + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GitLabGroupsList(string subscriptionId, string resourceGroupName, string securityConnectorName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default/gitLabGroups" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.GitLabGroupsList_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// Returns a list of all GitLab groups accessible by the user token consumed by the connector. + /// + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GitLabGroupsListAvailable(string subscriptionId, string resourceGroupName, string securityConnectorName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default/listAvailableGitLabGroups" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.GitLabGroupsListAvailable_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// Returns a list of all GitLab groups accessible by the user token consumed by the connector. + /// + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GitLabGroupsListAvailableViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/securityConnectors/(?[^/]+)/devops/default$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var securityConnectorName = _match.Groups["securityConnectorName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/securityConnectors/" + + securityConnectorName + + "/devops/default/listAvailableGitLabGroups" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.GitLabGroupsListAvailable_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// Returns a list of all GitLab groups accessible by the user token consumed by the connector. + /// + /// + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GitLabGroupsListAvailableViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/securityConnectors/(?[^/]+)/devops/default$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var securityConnectorName = _match.Groups["securityConnectorName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/securityConnectors/" + + securityConnectorName + + "/devops/default/listAvailableGitLabGroups" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.GitLabGroupsListAvailableWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Returns a list of all GitLab groups accessible by the user token consumed by the connector. + /// + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GitLabGroupsListAvailableWithResult(string subscriptionId, string resourceGroupName, string securityConnectorName, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default/listAvailableGitLabGroups" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.GitLabGroupsListAvailableWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task GitLabGroupsListAvailableWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitLabGroupListResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task GitLabGroupsListAvailable_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitLabGroupListResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. + /// + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task GitLabGroupsListAvailable_Validate(string subscriptionId, string resourceGroupName, string securityConnectorName, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertRegEx(nameof(subscriptionId), subscriptionId, @"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(securityConnectorName),securityConnectorName); + } + } + + /// Returns a list of GitLab groups onboarded to the connector. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GitLabGroupsListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/securityConnectors/(?[^/]+)/devops/default/gitLabGroups$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitLabGroups'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var securityConnectorName = _match.Groups["securityConnectorName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/securityConnectors/" + + securityConnectorName + + "/devops/default/gitLabGroups" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.GitLabGroupsList_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Returns a list of GitLab groups onboarded to the connector. + /// + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GitLabGroupsListViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/securityConnectors/(?[^/]+)/devops/default/gitLabGroups$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitLabGroups'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var securityConnectorName = _match.Groups["securityConnectorName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/securityConnectors/" + + securityConnectorName + + "/devops/default/gitLabGroups" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.GitLabGroupsListWithResult_Call (request, eventListener,sender); + } + } + + /// Returns a list of GitLab groups onboarded to the connector. + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GitLabGroupsListWithResult(string subscriptionId, string resourceGroupName, string securityConnectorName, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default/gitLabGroups" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.GitLabGroupsListWithResult_Call (request, eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task GitLabGroupsListWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitLabGroupListResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task GitLabGroupsList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitLabGroupListResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task GitLabGroupsList_Validate(string subscriptionId, string resourceGroupName, string securityConnectorName, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertRegEx(nameof(subscriptionId), subscriptionId, @"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(securityConnectorName),securityConnectorName); + } + } + + /// + /// Returns a monitored GitLab Project resource for a given fully-qualified group name and project name. + /// + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The GitLab group fully-qualified name. + /// The project name. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GitLabProjectsGet(string subscriptionId, string resourceGroupName, string securityConnectorName, string groupFqName, string projectName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default/gitLabGroups/" + + global::System.Uri.EscapeDataString(groupFqName) + + "/projects/" + + global::System.Uri.EscapeDataString(projectName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.GitLabProjectsGet_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// Returns a monitored GitLab Project resource for a given fully-qualified group name and project name. + /// + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GitLabProjectsGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/securityConnectors/(?[^/]+)/devops/default/gitLabGroups/(?[^/]+)/projects/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitLabGroups/{groupFQName}/projects/{projectName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var securityConnectorName = _match.Groups["securityConnectorName"].Value; + var groupFqName = _match.Groups["groupFQName"].Value; + var projectName = _match.Groups["projectName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/securityConnectors/" + + securityConnectorName + + "/devops/default/gitLabGroups/" + + groupFqName + + "/projects/" + + projectName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.GitLabProjectsGet_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// Returns a monitored GitLab Project resource for a given fully-qualified group name and project name. + /// + /// + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A + /// that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GitLabProjectsGetViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/securityConnectors/(?[^/]+)/devops/default/gitLabGroups/(?[^/]+)/projects/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitLabGroups/{groupFQName}/projects/{projectName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var securityConnectorName = _match.Groups["securityConnectorName"].Value; + var groupFqName = _match.Groups["groupFQName"].Value; + var projectName = _match.Groups["projectName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/securityConnectors/" + + securityConnectorName + + "/devops/default/gitLabGroups/" + + groupFqName + + "/projects/" + + projectName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.GitLabProjectsGetWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Returns a monitored GitLab Project resource for a given fully-qualified group name and project name. + /// + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The GitLab group fully-qualified name. + /// The project name. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A + /// that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GitLabProjectsGetWithResult(string subscriptionId, string resourceGroupName, string securityConnectorName, string groupFqName, string projectName, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default/gitLabGroups/" + + global::System.Uri.EscapeDataString(groupFqName) + + "/projects/" + + global::System.Uri.EscapeDataString(projectName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.GitLabProjectsGetWithResult_Call (request, eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A + /// that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task GitLabProjectsGetWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitLabProject.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task GitLabProjectsGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitLabProject.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The GitLab group fully-qualified name. + /// The project name. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task GitLabProjectsGet_Validate(string subscriptionId, string resourceGroupName, string securityConnectorName, string groupFqName, string projectName, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertRegEx(nameof(subscriptionId), subscriptionId, @"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(securityConnectorName),securityConnectorName); + await eventListener.AssertNotNull(nameof(groupFqName),groupFqName); + await eventListener.AssertNotNull(nameof(projectName),projectName); + } + } + + /// + /// Gets a list of GitLab projects that are directly owned by given group and onboarded to the connector. + /// + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The GitLab group fully-qualified name. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GitLabProjectsList(string subscriptionId, string resourceGroupName, string securityConnectorName, string groupFqName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default/gitLabGroups/" + + global::System.Uri.EscapeDataString(groupFqName) + + "/projects" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.GitLabProjectsList_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// Gets a list of GitLab projects that are directly owned by given group and onboarded to the connector. + /// + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GitLabProjectsListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/securityConnectors/(?[^/]+)/devops/default/gitLabGroups/(?[^/]+)/projects$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitLabGroups/{groupFQName}/projects'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var securityConnectorName = _match.Groups["securityConnectorName"].Value; + var groupFqName = _match.Groups["groupFQName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/securityConnectors/" + + securityConnectorName + + "/devops/default/gitLabGroups/" + + groupFqName + + "/projects" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.GitLabProjectsList_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// Gets a list of GitLab projects that are directly owned by given group and onboarded to the connector. + /// + /// + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GitLabProjectsListViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/securityConnectors/(?[^/]+)/devops/default/gitLabGroups/(?[^/]+)/projects$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitLabGroups/{groupFQName}/projects'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var securityConnectorName = _match.Groups["securityConnectorName"].Value; + var groupFqName = _match.Groups["groupFQName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/securityConnectors/" + + securityConnectorName + + "/devops/default/gitLabGroups/" + + groupFqName + + "/projects" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.GitLabProjectsListWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Gets a list of GitLab projects that are directly owned by given group and onboarded to the connector. + /// + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The GitLab group fully-qualified name. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GitLabProjectsListWithResult(string subscriptionId, string resourceGroupName, string securityConnectorName, string groupFqName, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default/gitLabGroups/" + + global::System.Uri.EscapeDataString(groupFqName) + + "/projects" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.GitLabProjectsListWithResult_Call (request, eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task GitLabProjectsListWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitLabProjectListResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task GitLabProjectsList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitLabProjectListResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The GitLab group fully-qualified name. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task GitLabProjectsList_Validate(string subscriptionId, string resourceGroupName, string securityConnectorName, string groupFqName, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertRegEx(nameof(subscriptionId), subscriptionId, @"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(securityConnectorName),securityConnectorName); + await eventListener.AssertNotNull(nameof(groupFqName),groupFqName); + } + } + + /// + /// Gets nested subgroups of given GitLab Group which are onboarded to the connector. + /// + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The GitLab group fully-qualified name. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GitLabSubgroupsList(string subscriptionId, string resourceGroupName, string securityConnectorName, string groupFqName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default/gitLabGroups/" + + global::System.Uri.EscapeDataString(groupFqName) + + "/listSubgroups" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.GitLabSubgroupsList_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// Gets nested subgroups of given GitLab Group which are onboarded to the connector. + /// + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GitLabSubgroupsListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/securityConnectors/(?[^/]+)/devops/default/gitLabGroups/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitLabGroups/{groupFQName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var securityConnectorName = _match.Groups["securityConnectorName"].Value; + var groupFqName = _match.Groups["groupFQName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/securityConnectors/" + + securityConnectorName + + "/devops/default/gitLabGroups/" + + groupFqName + + "/listSubgroups" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.GitLabSubgroupsList_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// Gets nested subgroups of given GitLab Group which are onboarded to the connector. + /// + /// + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GitLabSubgroupsListViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/securityConnectors/(?[^/]+)/devops/default/gitLabGroups/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitLabGroups/{groupFQName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var securityConnectorName = _match.Groups["securityConnectorName"].Value; + var groupFqName = _match.Groups["groupFQName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/securityConnectors/" + + securityConnectorName + + "/devops/default/gitLabGroups/" + + groupFqName + + "/listSubgroups" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.GitLabSubgroupsListWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Gets nested subgroups of given GitLab Group which are onboarded to the connector. + /// + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The GitLab group fully-qualified name. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GitLabSubgroupsListWithResult(string subscriptionId, string resourceGroupName, string securityConnectorName, string groupFqName, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "/devops/default/gitLabGroups/" + + global::System.Uri.EscapeDataString(groupFqName) + + "/listSubgroups" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.GitLabSubgroupsListWithResult_Call (request, eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task GitLabSubgroupsListWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitLabGroupListResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task GitLabSubgroupsList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitLabGroupListResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// Azure subscription ID + /// The name of the resource group. The name is case insensitive. + /// The security connector name. + /// The GitLab group fully-qualified name. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task GitLabSubgroupsList_Validate(string subscriptionId, string resourceGroupName, string securityConnectorName, string groupFqName, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertRegEx(nameof(subscriptionId), subscriptionId, @"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(securityConnectorName),securityConnectorName); + await eventListener.AssertNotNull(nameof(groupFqName),groupFqName); + } + } + + /// + /// Create a security connector. If a security connector is already created and a subsequent request is issued for the same + /// security connector id, then it will be updated. + /// + /// Azure subscription ID + /// The name of the resource group within the user's subscription. The name is case insensitive. + /// The security connector name. + /// The security connector resource + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 201 (Created). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task SecurityConnectorsCreateOrUpdate(string subscriptionId, string resourceGroupName, string securityConnectorName, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnector body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-10-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.SecurityConnectorsCreateOrUpdate_Call (request, onOk,onCreated,onDefault,eventListener,sender); + } + } + + /// + /// Create a security connector. If a security connector is already created and a subsequent request is issued for the same + /// security connector id, then it will be updated. + /// + /// + /// The security connector resource + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 201 (Created). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task SecurityConnectorsCreateOrUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnector body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-10-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/securityConnectors/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var securityConnectorName = _match.Groups["securityConnectorName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/securityConnectors/" + + securityConnectorName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.SecurityConnectorsCreateOrUpdate_Call (request, onOk,onCreated,onDefault,eventListener,sender); + } + } + + /// + /// Create a security connector. If a security connector is already created and a subsequent request is issued for the same + /// security connector id, then it will be updated. + /// + /// + /// The security connector resource + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task SecurityConnectorsCreateOrUpdateViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnector body, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-10-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/securityConnectors/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var securityConnectorName = _match.Groups["securityConnectorName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/securityConnectors/" + + securityConnectorName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.SecurityConnectorsCreateOrUpdateWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Create a security connector. If a security connector is already created and a subsequent request is issued for the same + /// security connector id, then it will be updated. + /// + /// Azure subscription ID + /// The name of the resource group within the user's subscription. The name is case insensitive. + /// The security connector name. + /// Json string supplied to the SecurityConnectorsCreateOrUpdate operation + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 201 (Created). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task SecurityConnectorsCreateOrUpdateViaJsonString(string subscriptionId, string resourceGroupName, string securityConnectorName, global::System.String jsonString, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-10-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.SecurityConnectorsCreateOrUpdate_Call (request, onOk,onCreated,onDefault,eventListener,sender); + } + } + + /// + /// Create a security connector. If a security connector is already created and a subsequent request is issued for the same + /// security connector id, then it will be updated. + /// + /// Azure subscription ID + /// The name of the resource group within the user's subscription. The name is case insensitive. + /// The security connector name. + /// Json string supplied to the SecurityConnectorsCreateOrUpdate operation + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task SecurityConnectorsCreateOrUpdateViaJsonStringWithResult(string subscriptionId, string resourceGroupName, string securityConnectorName, global::System.String jsonString, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-10-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.SecurityConnectorsCreateOrUpdateWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Create a security connector. If a security connector is already created and a subsequent request is issued for the same + /// security connector id, then it will be updated. + /// + /// Azure subscription ID + /// The name of the resource group within the user's subscription. The name is case insensitive. + /// The security connector name. + /// The security connector resource + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task SecurityConnectorsCreateOrUpdateWithResult(string subscriptionId, string resourceGroupName, string securityConnectorName, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnector body, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-10-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.SecurityConnectorsCreateOrUpdateWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task SecurityConnectorsCreateOrUpdateWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SecurityConnector.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + case global::System.Net.HttpStatusCode.Created: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SecurityConnector.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CloudError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 201 (Created). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task SecurityConnectorsCreateOrUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SecurityConnector.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + case global::System.Net.HttpStatusCode.Created: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onCreated(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SecurityConnector.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CloudError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you + /// will get validation events back. + /// + /// Azure subscription ID + /// The name of the resource group within the user's subscription. The name is case insensitive. + /// The security connector name. + /// The security connector resource + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task SecurityConnectorsCreateOrUpdate_Validate(string subscriptionId, string resourceGroupName, string securityConnectorName, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnector body, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertRegEx(nameof(subscriptionId), subscriptionId, @"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertRegEx(nameof(resourceGroupName), resourceGroupName, @"^[-\w\._\(\)]+$"); + await eventListener.AssertNotNull(nameof(securityConnectorName),securityConnectorName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// Deletes a security connector. + /// Azure subscription ID + /// The name of the resource group within the user's subscription. The name is case insensitive. + /// The security connector name. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task SecurityConnectorsDelete(string subscriptionId, string resourceGroupName, string securityConnectorName, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-10-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.SecurityConnectorsDelete_Call (request, onOk,onNoContent,onDefault,eventListener,sender); + } + } + + /// Deletes a security connector. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task SecurityConnectorsDeleteViaIdentity(global::System.String viaIdentity, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-10-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/securityConnectors/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var securityConnectorName = _match.Groups["securityConnectorName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/securityConnectors/" + + securityConnectorName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.SecurityConnectorsDelete_Call (request, onOk,onNoContent,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task SecurityConnectorsDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response); + break; + } + case global::System.Net.HttpStatusCode.NoContent: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onNoContent(_response); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CloudError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. + /// + /// Azure subscription ID + /// The name of the resource group within the user's subscription. The name is case insensitive. + /// The security connector name. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task SecurityConnectorsDelete_Validate(string subscriptionId, string resourceGroupName, string securityConnectorName, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertRegEx(nameof(subscriptionId), subscriptionId, @"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertRegEx(nameof(resourceGroupName), resourceGroupName, @"^[-\w\._\(\)]+$"); + await eventListener.AssertNotNull(nameof(securityConnectorName),securityConnectorName); + } + } + + /// Retrieves details of a specific security connector + /// Azure subscription ID + /// The name of the resource group within the user's subscription. The name is case insensitive. + /// The security connector name. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task SecurityConnectorsGet(string subscriptionId, string resourceGroupName, string securityConnectorName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-10-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.SecurityConnectorsGet_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Retrieves details of a specific security connector + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task SecurityConnectorsGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-10-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/securityConnectors/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var securityConnectorName = _match.Groups["securityConnectorName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/securityConnectors/" + + securityConnectorName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.SecurityConnectorsGet_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Retrieves details of a specific security connector + /// + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task SecurityConnectorsGetViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-10-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/securityConnectors/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var securityConnectorName = _match.Groups["securityConnectorName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/securityConnectors/" + + securityConnectorName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.SecurityConnectorsGetWithResult_Call (request, eventListener,sender); + } + } + + /// Retrieves details of a specific security connector + /// Azure subscription ID + /// The name of the resource group within the user's subscription. The name is case insensitive. + /// The security connector name. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task SecurityConnectorsGetWithResult(string subscriptionId, string resourceGroupName, string securityConnectorName, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-10-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.SecurityConnectorsGetWithResult_Call (request, eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task SecurityConnectorsGetWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SecurityConnector.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CloudError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task SecurityConnectorsGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SecurityConnector.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CloudError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// Azure subscription ID + /// The name of the resource group within the user's subscription. The name is case insensitive. + /// The security connector name. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task SecurityConnectorsGet_Validate(string subscriptionId, string resourceGroupName, string securityConnectorName, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertRegEx(nameof(subscriptionId), subscriptionId, @"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertRegEx(nameof(resourceGroupName), resourceGroupName, @"^[-\w\._\(\)]+$"); + await eventListener.AssertNotNull(nameof(securityConnectorName),securityConnectorName); + } + } + + /// + /// Lists all the security connectors in the specified subscription. Use the 'nextLink' property in the response to get the + /// next page of security connectors for the specified subscription. + /// + /// Azure subscription ID + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task SecurityConnectorsList(string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-10-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.Security/securityConnectors" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.SecurityConnectorsList_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// Lists all the security connectors in the specified resource group. Use the 'nextLink' property in the response to get + /// the next page of security connectors for the specified resource group. + /// + /// Azure subscription ID + /// The name of the resource group within the user's subscription. The name is case insensitive. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task SecurityConnectorsListByResourceGroup(string subscriptionId, string resourceGroupName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-10-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.SecurityConnectorsListByResourceGroup_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// Lists all the security connectors in the specified resource group. Use the 'nextLink' property in the response to get + /// the next page of security connectors for the specified resource group. + /// + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task SecurityConnectorsListByResourceGroupViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-10-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/securityConnectors$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/securityConnectors" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.SecurityConnectorsListByResourceGroup_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// Lists all the security connectors in the specified resource group. Use the 'nextLink' property in the response to get + /// the next page of security connectors for the specified resource group. + /// + /// + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task SecurityConnectorsListByResourceGroupViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-10-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/securityConnectors$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/securityConnectors" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.SecurityConnectorsListByResourceGroupWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Lists all the security connectors in the specified resource group. Use the 'nextLink' property in the response to get + /// the next page of security connectors for the specified resource group. + /// + /// Azure subscription ID + /// The name of the resource group within the user's subscription. The name is case insensitive. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task SecurityConnectorsListByResourceGroupWithResult(string subscriptionId, string resourceGroupName, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-10-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.SecurityConnectorsListByResourceGroupWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task SecurityConnectorsListByResourceGroupWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SecurityConnectorsList.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CloudError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task SecurityConnectorsListByResourceGroup_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SecurityConnectorsList.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CloudError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but + /// you will get validation events back. + /// + /// Azure subscription ID + /// The name of the resource group within the user's subscription. The name is case insensitive. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task SecurityConnectorsListByResourceGroup_Validate(string subscriptionId, string resourceGroupName, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertRegEx(nameof(subscriptionId), subscriptionId, @"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertRegEx(nameof(resourceGroupName), resourceGroupName, @"^[-\w\._\(\)]+$"); + } + } + + /// + /// Lists all the security connectors in the specified subscription. Use the 'nextLink' property in the response to get the + /// next page of security connectors for the specified subscription. + /// + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task SecurityConnectorsListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-10-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/providers/Microsoft.Security/securityConnectors$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityConnectors'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/providers/Microsoft.Security/securityConnectors" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.SecurityConnectorsList_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// Lists all the security connectors in the specified subscription. Use the 'nextLink' property in the response to get the + /// next page of security connectors for the specified subscription. + /// + /// + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task SecurityConnectorsListViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-10-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/providers/Microsoft.Security/securityConnectors$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityConnectors'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/providers/Microsoft.Security/securityConnectors" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.SecurityConnectorsListWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Lists all the security connectors in the specified subscription. Use the 'nextLink' property in the response to get the + /// next page of security connectors for the specified subscription. + /// + /// Azure subscription ID + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task SecurityConnectorsListWithResult(string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-10-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.Security/securityConnectors" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.SecurityConnectorsListWithResult_Call (request, eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task SecurityConnectorsListWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SecurityConnectorsList.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CloudError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task SecurityConnectorsList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SecurityConnectorsList.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CloudError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// Azure subscription ID + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task SecurityConnectorsList_Validate(string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertRegEx(nameof(subscriptionId), subscriptionId, @"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + + /// Updates a security connector + /// Azure subscription ID + /// The name of the resource group within the user's subscription. The name is case insensitive. + /// The security connector name. + /// The security connector resource + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task SecurityConnectorsUpdate(string subscriptionId, string resourceGroupName, string securityConnectorName, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnector body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-10-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.SecurityConnectorsUpdate_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Updates a security connector + /// + /// The security connector resource + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task SecurityConnectorsUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnector body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-10-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/securityConnectors/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var securityConnectorName = _match.Groups["securityConnectorName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/securityConnectors/" + + securityConnectorName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.SecurityConnectorsUpdate_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Updates a security connector + /// + /// The security connector resource + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task SecurityConnectorsUpdateViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnector body, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-10-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Security/securityConnectors/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var securityConnectorName = _match.Groups["securityConnectorName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Security/securityConnectors/" + + securityConnectorName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.SecurityConnectorsUpdateWithResult_Call (request, eventListener,sender); + } + } + + /// Updates a security connector + /// Azure subscription ID + /// The name of the resource group within the user's subscription. The name is case insensitive. + /// The security connector name. + /// Json string supplied to the SecurityConnectorsUpdate operation + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task SecurityConnectorsUpdateViaJsonString(string subscriptionId, string resourceGroupName, string securityConnectorName, global::System.String jsonString, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-10-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.SecurityConnectorsUpdate_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Updates a security connector + /// Azure subscription ID + /// The name of the resource group within the user's subscription. The name is case insensitive. + /// The security connector name. + /// Json string supplied to the SecurityConnectorsUpdate operation + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task SecurityConnectorsUpdateViaJsonStringWithResult(string subscriptionId, string resourceGroupName, string securityConnectorName, global::System.String jsonString, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-10-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.SecurityConnectorsUpdateWithResult_Call (request, eventListener,sender); + } + } + + /// Updates a security connector + /// Azure subscription ID + /// The name of the resource group within the user's subscription. The name is case insensitive. + /// The security connector name. + /// The security connector resource + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task SecurityConnectorsUpdateWithResult(string subscriptionId, string resourceGroupName, string securityConnectorName, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnector body, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-10-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Security/securityConnectors/" + + global::System.Uri.EscapeDataString(securityConnectorName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.SecurityConnectorsUpdateWithResult_Call (request, eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task SecurityConnectorsUpdateWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SecurityConnector.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CloudError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task SecurityConnectorsUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SecurityConnector.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CloudError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. + /// + /// Azure subscription ID + /// The name of the resource group within the user's subscription. The name is case insensitive. + /// The security connector name. + /// The security connector resource + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task SecurityConnectorsUpdate_Validate(string subscriptionId, string resourceGroupName, string securityConnectorName, Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnector body, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertRegEx(nameof(subscriptionId), subscriptionId, @"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertRegEx(nameof(resourceGroupName), resourceGroupName, @"^[-\w\._\(\)]+$"); + await eventListener.AssertNotNull(nameof(securityConnectorName),securityConnectorName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityApiCollection_Get.cs b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityApiCollection_Get.cs new file mode 100644 index 000000000000..fbc4418cd867 --- /dev/null +++ b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityApiCollection_Get.cs @@ -0,0 +1,495 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Cmdlets; + using System; + + /// + /// Gets an Azure API Management API if it has been onboarded to Microsoft Defender for APIs. If an Azure API Management API + /// is onboarded to Microsoft Defender for APIs, the system will monitor the operations within the Azure API Management API + /// for intrusive behaviors and provide alerts for attacks that have been detected. + /// + /// + /// [OpenAPI] GetByAzureApiManagementService=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/providers/Microsoft.Security/apiCollections/{apiId}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSecurityApiCollection_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollection))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Description(@"Gets an Azure API Management API if it has been onboarded to Microsoft Defender for APIs. If an Azure API Management API is onboarded to Microsoft Defender for APIs, the system will monitor the operations within the Azure API Management API for intrusive behaviors and provide alerts for attacks that have been detected.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/providers/Microsoft.Security/apiCollections/{apiId}", ApiVersion = "2023-11-15")] + public partial class GetAzSecurityApiCollection_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Backing field for property. + private string _apiId; + + /// + /// API revision identifier. Must be unique in the API Management service instance. Non-current revision has ;rev=n as a suffix + /// where n is the revision number. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "API revision identifier. Must be unique in the API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"API revision identifier. Must be unique in the API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number.", + SerializedName = @"apiId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string ApiId { get => this._apiId; set => this._apiId = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Security.Security Client => Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _serviceName; + + /// The name of the API Management service. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the API Management service.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the API Management service.", + SerializedName = @"serviceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string ServiceName { get => this._serviceName; set => this._serviceName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// Azure subscription ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure subscription ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure subscription ID", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseAutoGenerated + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollection + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzSecurityApiCollection_Get() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ApiCollectionsGetByAzureApiManagementService(SubscriptionId, ResourceGroupName, ServiceName, ApiId, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,ServiceName=ServiceName,ApiId=ApiId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseAutoGenerated + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollection + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollection + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityApiCollection_GetViaIdentity.cs b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityApiCollection_GetViaIdentity.cs new file mode 100644 index 000000000000..8c5b090716d7 --- /dev/null +++ b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityApiCollection_GetViaIdentity.cs @@ -0,0 +1,460 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Cmdlets; + using System; + + /// + /// Gets an Azure API Management API if it has been onboarded to Microsoft Defender for APIs. If an Azure API Management API + /// is onboarded to Microsoft Defender for APIs, the system will monitor the operations within the Azure API Management API + /// for intrusive behaviors and provide alerts for attacks that have been detected. + /// + /// + /// [OpenAPI] GetByAzureApiManagementService=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/providers/Microsoft.Security/apiCollections/{apiId}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSecurityApiCollection_GetViaIdentity")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollection))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Description(@"Gets an Azure API Management API if it has been onboarded to Microsoft Defender for APIs. If an Azure API Management API is onboarded to Microsoft Defender for APIs, the system will monitor the operations within the Azure API Management API for intrusive behaviors and provide alerts for attacks that have been detected.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/providers/Microsoft.Security/apiCollections/{apiId}", ApiVersion = "2023-11-15")] + public partial class GetAzSecurityApiCollection_GetViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Security.Security Client => Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseAutoGenerated + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollection + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzSecurityApiCollection_GetViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ApiCollectionsGetByAzureApiManagementServiceViaIdentity(InputObject.Id, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ServiceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ServiceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ApiId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ApiId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ApiCollectionsGetByAzureApiManagementService(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.ServiceName ?? null, InputObject.ApiId ?? null, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseAutoGenerated + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollection + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollection + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityApiCollection_List.cs b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityApiCollection_List.cs new file mode 100644 index 000000000000..fb51615011d8 --- /dev/null +++ b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityApiCollection_List.cs @@ -0,0 +1,475 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Cmdlets; + using System; + + /// + /// Gets a list of API collections within a subscription that have been onboarded to Microsoft Defender for APIs. + /// + /// + /// [OpenAPI] ListBySubscription=>GET:"/subscriptions/{subscriptionId}/providers/Microsoft.Security/apiCollections" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSecurityApiCollection_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollection))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Description(@"Gets a list of API collections within a subscription that have been onboarded to Microsoft Defender for APIs.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.HttpPath(Path = "/subscriptions/{subscriptionId}/providers/Microsoft.Security/apiCollections", ApiVersion = "2023-11-15")] + public partial class GetAzSecurityApiCollection_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Security.Security Client => Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// Azure subscription ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure subscription ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure subscription ID", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseAutoGenerated + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionList + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzSecurityApiCollection_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ApiCollectionsListBySubscription(SubscriptionId, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseAutoGenerated + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionList + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionList + var result = (await response); + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + if (null != result.Value) + { + if (0 == _responseSize && 1 == result.Value.Count) + { + _firstResponse = result.Value[0]; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + var values = new System.Collections.Generic.List(); + foreach( var value in result.Value ) + { + values.Add(value.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(values, true); + _responseSize = 2; + } + } + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (!String.IsNullOrEmpty(_nextLink)) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ApiCollectionsListBySubscription_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityApiCollection_List1.cs b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityApiCollection_List1.cs new file mode 100644 index 000000000000..80f2a1db7aa7 --- /dev/null +++ b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityApiCollection_List1.cs @@ -0,0 +1,489 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Cmdlets; + using System; + + /// + /// Gets a list of API collections within a resource group that have been onboarded to Microsoft Defender for APIs. + /// + /// + /// [OpenAPI] ListByResourceGroup=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/apiCollections" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSecurityApiCollection_List1")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollection))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Description(@"Gets a list of API collections within a resource group that have been onboarded to Microsoft Defender for APIs.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/apiCollections", ApiVersion = "2023-11-15")] + public partial class GetAzSecurityApiCollection_List1 : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Security.Security Client => Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// Azure subscription ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure subscription ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure subscription ID", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseAutoGenerated + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionList + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzSecurityApiCollection_List1() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ApiCollectionsListByResourceGroup(SubscriptionId, ResourceGroupName, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseAutoGenerated + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionList + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionList + var result = (await response); + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + if (null != result.Value) + { + if (0 == _responseSize && 1 == result.Value.Count) + { + _firstResponse = result.Value[0]; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + var values = new System.Collections.Generic.List(); + foreach( var value in result.Value ) + { + values.Add(value.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(values, true); + _responseSize = 2; + } + } + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (!String.IsNullOrEmpty(_nextLink)) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ApiCollectionsListByResourceGroup_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityApiCollection_List2.cs b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityApiCollection_List2.cs new file mode 100644 index 000000000000..53f2cefb120b --- /dev/null +++ b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityApiCollection_List2.cs @@ -0,0 +1,505 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Cmdlets; + using System; + + /// + /// Gets a list of Azure API Management APIs that have been onboarded to Microsoft Defender for APIs. If an Azure API Management + /// API is onboarded to Microsoft Defender for APIs, the system will monitor the operations within the Azure API Management + /// API for intrusive behaviors and provide alerts for attacks that have been detected. + /// + /// + /// [OpenAPI] ListByAzureApiManagementService=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/providers/Microsoft.Security/apiCollections" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSecurityApiCollection_List2")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollection))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Description(@"Gets a list of Azure API Management APIs that have been onboarded to Microsoft Defender for APIs. If an Azure API Management API is onboarded to Microsoft Defender for APIs, the system will monitor the operations within the Azure API Management API for intrusive behaviors and provide alerts for attacks that have been detected.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/providers/Microsoft.Security/apiCollections", ApiVersion = "2023-11-15")] + public partial class GetAzSecurityApiCollection_List2 : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Security.Security Client => Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _serviceName; + + /// The name of the API Management service. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the API Management service.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the API Management service.", + SerializedName = @"serviceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string ServiceName { get => this._serviceName; set => this._serviceName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// Azure subscription ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure subscription ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure subscription ID", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseAutoGenerated + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionList + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzSecurityApiCollection_List2() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ApiCollectionsListByAzureApiManagementService(SubscriptionId, ResourceGroupName, ServiceName, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,ServiceName=ServiceName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseAutoGenerated + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionList + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollectionList + var result = (await response); + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + if (null != result.Value) + { + if (0 == _responseSize && 1 == result.Value.Count) + { + _firstResponse = result.Value[0]; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + var values = new System.Collections.Generic.List(); + foreach( var value in result.Value ) + { + values.Add(value.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(values, true); + _responseSize = 2; + } + } + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (!String.IsNullOrEmpty(_nextLink)) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ApiCollectionsListByAzureApiManagementService_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorAzureDevOpsOrgAvailable_List.cs b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorAzureDevOpsOrgAvailable_List.cs new file mode 100644 index 000000000000..0385be4eb57c --- /dev/null +++ b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorAzureDevOpsOrgAvailable_List.cs @@ -0,0 +1,506 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Cmdlets; + using System; + + /// + /// Returns a list of all Azure DevOps organizations accessible by the user token consumed by the connector. + /// + /// + /// [OpenAPI] ListAvailable=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/listAvailableAzureDevOpsOrgs" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSecurityConnectorAzureDevOpsOrgAvailable_List", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgListResponse))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Description(@"Returns a list of all Azure DevOps organizations accessible by the user token consumed by the connector.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/listAvailableAzureDevOpsOrgs", ApiVersion = "2023-09-01-preview")] + public partial class GetAzSecurityConnectorAzureDevOpsOrgAvailable_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Security.Security Client => Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _securityConnectorName; + + /// The security connector name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The security connector name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The security connector name.", + SerializedName = @"securityConnectorName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string SecurityConnectorName { get => this._securityConnectorName; set => this._securityConnectorName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// Azure subscription ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure subscription ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure subscription ID", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgListResponse + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzSecurityConnectorAzureDevOpsOrgAvailable_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'AzureDevOpsOrgsListAvailable' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.AzureDevOpsOrgsListAvailable(SubscriptionId, ResourceGroupName, SecurityConnectorName, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,SecurityConnectorName=SecurityConnectorName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgListResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgListResponse + var result = (await response); + // response should be returning an array of some kind. +Pageable + // nested-array / value / nextLink + if (null != result.Value) + { + if (0 == _responseSize && 1 == result.Value.Count) + { + _firstResponse = result.Value[0]; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + var values = new System.Collections.Generic.List(); + foreach( var value in result.Value ) + { + values.Add(value.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(values, true); + _responseSize = 2; + } + } + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (!String.IsNullOrEmpty(_nextLink)) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.AzureDevOpsOrgsListAvailable_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorAzureDevOpsOrg_Get.cs b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorAzureDevOpsOrg_Get.cs new file mode 100644 index 000000000000..8223bd08d442 --- /dev/null +++ b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorAzureDevOpsOrg_Get.cs @@ -0,0 +1,488 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Cmdlets; + using System; + + /// Returns a monitored Azure DevOps organization resource. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSecurityConnectorAzureDevOpsOrg_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrg))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Description(@"Returns a monitored Azure DevOps organization resource.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}", ApiVersion = "2023-09-01-preview")] + public partial class GetAzSecurityConnectorAzureDevOpsOrg_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Security.Security Client => Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _orgName; + + /// The Azure DevOps organization name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The Azure DevOps organization name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The Azure DevOps organization name.", + SerializedName = @"orgName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string OrgName { get => this._orgName; set => this._orgName = value; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _securityConnectorName; + + /// The security connector name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The security connector name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The security connector name.", + SerializedName = @"securityConnectorName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string SecurityConnectorName { get => this._securityConnectorName; set => this._securityConnectorName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// Azure subscription ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure subscription ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure subscription ID", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrg + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzSecurityConnectorAzureDevOpsOrg_Get() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.AzureDevOpsOrgsGet(SubscriptionId, ResourceGroupName, SecurityConnectorName, OrgName, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,SecurityConnectorName=SecurityConnectorName,OrgName=OrgName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrg + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrg + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorAzureDevOpsOrg_GetViaIdentity.cs b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorAzureDevOpsOrg_GetViaIdentity.cs new file mode 100644 index 000000000000..286451404462 --- /dev/null +++ b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorAzureDevOpsOrg_GetViaIdentity.cs @@ -0,0 +1,456 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Cmdlets; + using System; + + /// Returns a monitored Azure DevOps organization resource. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSecurityConnectorAzureDevOpsOrg_GetViaIdentity")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrg))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Description(@"Returns a monitored Azure DevOps organization resource.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}", ApiVersion = "2023-09-01-preview")] + public partial class GetAzSecurityConnectorAzureDevOpsOrg_GetViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Security.Security Client => Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrg + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzSecurityConnectorAzureDevOpsOrg_GetViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.AzureDevOpsOrgsGetViaIdentity(InputObject.Id, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SecurityConnectorName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SecurityConnectorName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.OrgName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.OrgName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.AzureDevOpsOrgsGet(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.SecurityConnectorName ?? null, InputObject.OrgName ?? null, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrg + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrg + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorAzureDevOpsOrg_List.cs b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorAzureDevOpsOrg_List.cs new file mode 100644 index 000000000000..fba6d78f8e0d --- /dev/null +++ b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorAzureDevOpsOrg_List.cs @@ -0,0 +1,501 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Cmdlets; + using System; + + /// Returns a list of Azure DevOps organizations onboarded to the connector. + /// + /// [OpenAPI] List=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSecurityConnectorAzureDevOpsOrg_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrg))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Description(@"Returns a list of Azure DevOps organizations onboarded to the connector.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs", ApiVersion = "2023-09-01-preview")] + public partial class GetAzSecurityConnectorAzureDevOpsOrg_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Security.Security Client => Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _securityConnectorName; + + /// The security connector name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The security connector name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The security connector name.", + SerializedName = @"securityConnectorName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string SecurityConnectorName { get => this._securityConnectorName; set => this._securityConnectorName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// Azure subscription ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure subscription ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure subscription ID", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgListResponse + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzSecurityConnectorAzureDevOpsOrg_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.AzureDevOpsOrgsList(SubscriptionId, ResourceGroupName, SecurityConnectorName, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,SecurityConnectorName=SecurityConnectorName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgListResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgListResponse + var result = (await response); + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + if (null != result.Value) + { + if (0 == _responseSize && 1 == result.Value.Count) + { + _firstResponse = result.Value[0]; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + var values = new System.Collections.Generic.List(); + foreach( var value in result.Value ) + { + values.Add(value.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(values, true); + _responseSize = 2; + } + } + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (!String.IsNullOrEmpty(_nextLink)) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.AzureDevOpsOrgsList_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorAzureDevOpsProject_Get.cs b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorAzureDevOpsProject_Get.cs new file mode 100644 index 000000000000..fab3bc134a1c --- /dev/null +++ b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorAzureDevOpsProject_Get.cs @@ -0,0 +1,502 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Cmdlets; + using System; + + /// Returns a monitored Azure DevOps project resource. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}/projects/{projectName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSecurityConnectorAzureDevOpsProject_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProject))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Description(@"Returns a monitored Azure DevOps project resource.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}/projects/{projectName}", ApiVersion = "2023-09-01-preview")] + public partial class GetAzSecurityConnectorAzureDevOpsProject_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Security.Security Client => Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _orgName; + + /// The Azure DevOps organization name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The Azure DevOps organization name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The Azure DevOps organization name.", + SerializedName = @"orgName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string OrgName { get => this._orgName; set => this._orgName = value; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _projectName; + + /// The project name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The project name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The project name.", + SerializedName = @"projectName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string ProjectName { get => this._projectName; set => this._projectName = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _securityConnectorName; + + /// The security connector name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The security connector name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The security connector name.", + SerializedName = @"securityConnectorName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string SecurityConnectorName { get => this._securityConnectorName; set => this._securityConnectorName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// Azure subscription ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure subscription ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure subscription ID", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProject + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzSecurityConnectorAzureDevOpsProject_Get() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.AzureDevOpsProjectsGet(SubscriptionId, ResourceGroupName, SecurityConnectorName, OrgName, ProjectName, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,SecurityConnectorName=SecurityConnectorName,OrgName=OrgName,ProjectName=ProjectName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProject + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProject + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorAzureDevOpsProject_GetViaIdentity.cs b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorAzureDevOpsProject_GetViaIdentity.cs new file mode 100644 index 000000000000..b1c9fe4d62e3 --- /dev/null +++ b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorAzureDevOpsProject_GetViaIdentity.cs @@ -0,0 +1,460 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Cmdlets; + using System; + + /// Returns a monitored Azure DevOps project resource. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}/projects/{projectName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSecurityConnectorAzureDevOpsProject_GetViaIdentity")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProject))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Description(@"Returns a monitored Azure DevOps project resource.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}/projects/{projectName}", ApiVersion = "2023-09-01-preview")] + public partial class GetAzSecurityConnectorAzureDevOpsProject_GetViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Security.Security Client => Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProject + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzSecurityConnectorAzureDevOpsProject_GetViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.AzureDevOpsProjectsGetViaIdentity(InputObject.Id, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SecurityConnectorName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SecurityConnectorName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.OrgName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.OrgName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProjectName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProjectName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.AzureDevOpsProjectsGet(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.SecurityConnectorName ?? null, InputObject.OrgName ?? null, InputObject.ProjectName ?? null, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProject + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProject + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorAzureDevOpsProject_List.cs b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorAzureDevOpsProject_List.cs new file mode 100644 index 000000000000..2905cfe06cff --- /dev/null +++ b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorAzureDevOpsProject_List.cs @@ -0,0 +1,515 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Cmdlets; + using System; + + /// Returns a list of Azure DevOps projects onboarded to the connector. + /// + /// [OpenAPI] List=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}/projects" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSecurityConnectorAzureDevOpsProject_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProject))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Description(@"Returns a list of Azure DevOps projects onboarded to the connector.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}/projects", ApiVersion = "2023-09-01-preview")] + public partial class GetAzSecurityConnectorAzureDevOpsProject_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Security.Security Client => Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _orgName; + + /// The Azure DevOps organization name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The Azure DevOps organization name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The Azure DevOps organization name.", + SerializedName = @"orgName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string OrgName { get => this._orgName; set => this._orgName = value; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _securityConnectorName; + + /// The security connector name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The security connector name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The security connector name.", + SerializedName = @"securityConnectorName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string SecurityConnectorName { get => this._securityConnectorName; set => this._securityConnectorName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// Azure subscription ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure subscription ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure subscription ID", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectListResponse + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzSecurityConnectorAzureDevOpsProject_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.AzureDevOpsProjectsList(SubscriptionId, ResourceGroupName, SecurityConnectorName, OrgName, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,SecurityConnectorName=SecurityConnectorName,OrgName=OrgName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectListResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProjectListResponse + var result = (await response); + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + if (null != result.Value) + { + if (0 == _responseSize && 1 == result.Value.Count) + { + _firstResponse = result.Value[0]; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + var values = new System.Collections.Generic.List(); + foreach( var value in result.Value ) + { + values.Add(value.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(values, true); + _responseSize = 2; + } + } + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (!String.IsNullOrEmpty(_nextLink)) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.AzureDevOpsProjectsList_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorAzureDevOpsRepo_Get.cs b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorAzureDevOpsRepo_Get.cs new file mode 100644 index 000000000000..a098bcfbe431 --- /dev/null +++ b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorAzureDevOpsRepo_Get.cs @@ -0,0 +1,516 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Cmdlets; + using System; + + /// Returns a monitored Azure DevOps repository resource. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}/projects/{projectName}/repos/{repoName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSecurityConnectorAzureDevOpsRepo_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepository))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Description(@"Returns a monitored Azure DevOps repository resource.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}/projects/{projectName}/repos/{repoName}", ApiVersion = "2023-09-01-preview")] + public partial class GetAzSecurityConnectorAzureDevOpsRepo_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Security.Security Client => Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _orgName; + + /// The Azure DevOps organization name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The Azure DevOps organization name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The Azure DevOps organization name.", + SerializedName = @"orgName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string OrgName { get => this._orgName; set => this._orgName = value; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _projectName; + + /// The project name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The project name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The project name.", + SerializedName = @"projectName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string ProjectName { get => this._projectName; set => this._projectName = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _repoName; + + /// The repository name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The repository name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The repository name.", + SerializedName = @"repoName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string RepoName { get => this._repoName; set => this._repoName = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _securityConnectorName; + + /// The security connector name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The security connector name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The security connector name.", + SerializedName = @"securityConnectorName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string SecurityConnectorName { get => this._securityConnectorName; set => this._securityConnectorName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// Azure subscription ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure subscription ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure subscription ID", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepository + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzSecurityConnectorAzureDevOpsRepo_Get() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.AzureDevOpsReposGet(SubscriptionId, ResourceGroupName, SecurityConnectorName, OrgName, ProjectName, RepoName, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,SecurityConnectorName=SecurityConnectorName,OrgName=OrgName,ProjectName=ProjectName,RepoName=RepoName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepository + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepository + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorAzureDevOpsRepo_GetViaIdentity.cs b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorAzureDevOpsRepo_GetViaIdentity.cs new file mode 100644 index 000000000000..fe348b51fb45 --- /dev/null +++ b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorAzureDevOpsRepo_GetViaIdentity.cs @@ -0,0 +1,464 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Cmdlets; + using System; + + /// Returns a monitored Azure DevOps repository resource. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}/projects/{projectName}/repos/{repoName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSecurityConnectorAzureDevOpsRepo_GetViaIdentity")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepository))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Description(@"Returns a monitored Azure DevOps repository resource.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}/projects/{projectName}/repos/{repoName}", ApiVersion = "2023-09-01-preview")] + public partial class GetAzSecurityConnectorAzureDevOpsRepo_GetViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Security.Security Client => Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepository + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzSecurityConnectorAzureDevOpsRepo_GetViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.AzureDevOpsReposGetViaIdentity(InputObject.Id, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SecurityConnectorName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SecurityConnectorName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.OrgName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.OrgName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProjectName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProjectName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.RepoName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.RepoName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.AzureDevOpsReposGet(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.SecurityConnectorName ?? null, InputObject.OrgName ?? null, InputObject.ProjectName ?? null, InputObject.RepoName ?? null, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepository + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepository + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorAzureDevOpsRepo_List.cs b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorAzureDevOpsRepo_List.cs new file mode 100644 index 000000000000..2cfc2742ede7 --- /dev/null +++ b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorAzureDevOpsRepo_List.cs @@ -0,0 +1,529 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Cmdlets; + using System; + + /// Returns a list of Azure DevOps repositories onboarded to the connector. + /// + /// [OpenAPI] List=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}/projects/{projectName}/repos" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSecurityConnectorAzureDevOpsRepo_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepository))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Description(@"Returns a list of Azure DevOps repositories onboarded to the connector.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}/projects/{projectName}/repos", ApiVersion = "2023-09-01-preview")] + public partial class GetAzSecurityConnectorAzureDevOpsRepo_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Security.Security Client => Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _orgName; + + /// The Azure DevOps organization name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The Azure DevOps organization name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The Azure DevOps organization name.", + SerializedName = @"orgName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string OrgName { get => this._orgName; set => this._orgName = value; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _projectName; + + /// The project name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The project name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The project name.", + SerializedName = @"projectName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string ProjectName { get => this._projectName; set => this._projectName = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _securityConnectorName; + + /// The security connector name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The security connector name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The security connector name.", + SerializedName = @"securityConnectorName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string SecurityConnectorName { get => this._securityConnectorName; set => this._securityConnectorName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// Azure subscription ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure subscription ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure subscription ID", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryListResponse + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzSecurityConnectorAzureDevOpsRepo_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.AzureDevOpsReposList(SubscriptionId, ResourceGroupName, SecurityConnectorName, OrgName, ProjectName, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,SecurityConnectorName=SecurityConnectorName,OrgName=OrgName,ProjectName=ProjectName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryListResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepositoryListResponse + var result = (await response); + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + if (null != result.Value) + { + if (0 == _responseSize && 1 == result.Value.Count) + { + _firstResponse = result.Value[0]; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + var values = new System.Collections.Generic.List(); + foreach( var value in result.Value ) + { + values.Add(value.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(values, true); + _responseSize = 2; + } + } + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (!String.IsNullOrEmpty(_nextLink)) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.AzureDevOpsReposList_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorDevOpsConfiguration_Get.cs b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorDevOpsConfiguration_Get.cs new file mode 100644 index 000000000000..4c421d91038a --- /dev/null +++ b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorDevOpsConfiguration_Get.cs @@ -0,0 +1,474 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Cmdlets; + using System; + + /// Gets a DevOps Configuration. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSecurityConnectorDevOpsConfiguration_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfiguration))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Description(@"Gets a DevOps Configuration.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default", ApiVersion = "2023-09-01-preview")] + public partial class GetAzSecurityConnectorDevOpsConfiguration_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Security.Security Client => Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _securityConnectorName; + + /// The security connector name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The security connector name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The security connector name.", + SerializedName = @"securityConnectorName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string SecurityConnectorName { get => this._securityConnectorName; set => this._securityConnectorName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// Azure subscription ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure subscription ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure subscription ID", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfiguration + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzSecurityConnectorDevOpsConfiguration_Get() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.DevOpsConfigurationsGet(SubscriptionId, ResourceGroupName, SecurityConnectorName, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,SecurityConnectorName=SecurityConnectorName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfiguration + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfiguration + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorDevOpsConfiguration_GetViaIdentity.cs b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorDevOpsConfiguration_GetViaIdentity.cs new file mode 100644 index 000000000000..d7de889c4049 --- /dev/null +++ b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorDevOpsConfiguration_GetViaIdentity.cs @@ -0,0 +1,452 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Cmdlets; + using System; + + /// Gets a DevOps Configuration. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSecurityConnectorDevOpsConfiguration_GetViaIdentity")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfiguration))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Description(@"Gets a DevOps Configuration.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default", ApiVersion = "2023-09-01-preview")] + public partial class GetAzSecurityConnectorDevOpsConfiguration_GetViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Security.Security Client => Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfiguration + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzSecurityConnectorDevOpsConfiguration_GetViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.DevOpsConfigurationsGetViaIdentity(InputObject.Id, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SecurityConnectorName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SecurityConnectorName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.DevOpsConfigurationsGet(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.SecurityConnectorName ?? null, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfiguration + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfiguration + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorDevOpsConfiguration_List.cs b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorDevOpsConfiguration_List.cs new file mode 100644 index 000000000000..149212f081da --- /dev/null +++ b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorDevOpsConfiguration_List.cs @@ -0,0 +1,501 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Cmdlets; + using System; + + /// List DevOps Configurations. + /// + /// [OpenAPI] List=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSecurityConnectorDevOpsConfiguration_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfiguration))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Description(@"List DevOps Configurations.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops", ApiVersion = "2023-09-01-preview")] + public partial class GetAzSecurityConnectorDevOpsConfiguration_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Security.Security Client => Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _securityConnectorName; + + /// The security connector name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The security connector name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The security connector name.", + SerializedName = @"securityConnectorName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string SecurityConnectorName { get => this._securityConnectorName; set => this._securityConnectorName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// Azure subscription ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure subscription ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure subscription ID", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationListResponse + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzSecurityConnectorDevOpsConfiguration_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.DevOpsConfigurationsList(SubscriptionId, ResourceGroupName, SecurityConnectorName, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,SecurityConnectorName=SecurityConnectorName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationListResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfigurationListResponse + var result = (await response); + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + if (null != result.Value) + { + if (0 == _responseSize && 1 == result.Value.Count) + { + _firstResponse = result.Value[0]; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + var values = new System.Collections.Generic.List(); + foreach( var value in result.Value ) + { + values.Add(value.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(values, true); + _responseSize = 2; + } + } + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (!String.IsNullOrEmpty(_nextLink)) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.DevOpsConfigurationsList_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorGitHubOwnerAvailable_List.cs b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorGitHubOwnerAvailable_List.cs new file mode 100644 index 000000000000..6e91e41f5a7a --- /dev/null +++ b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorGitHubOwnerAvailable_List.cs @@ -0,0 +1,506 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Cmdlets; + using System; + + /// + /// Returns a list of all GitHub owners accessible by the user token consumed by the connector. + /// + /// + /// [OpenAPI] ListAvailable=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/listAvailableGitHubOwners" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSecurityConnectorGitHubOwnerAvailable_List", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerListResponse))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Description(@"Returns a list of all GitHub owners accessible by the user token consumed by the connector.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/listAvailableGitHubOwners", ApiVersion = "2023-09-01-preview")] + public partial class GetAzSecurityConnectorGitHubOwnerAvailable_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Security.Security Client => Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _securityConnectorName; + + /// The security connector name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The security connector name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The security connector name.", + SerializedName = @"securityConnectorName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string SecurityConnectorName { get => this._securityConnectorName; set => this._securityConnectorName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// Azure subscription ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure subscription ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure subscription ID", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerListResponse + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzSecurityConnectorGitHubOwnerAvailable_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'GitHubOwnersListAvailable' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.GitHubOwnersListAvailable(SubscriptionId, ResourceGroupName, SecurityConnectorName, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,SecurityConnectorName=SecurityConnectorName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerListResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerListResponse + var result = (await response); + // response should be returning an array of some kind. +Pageable + // nested-array / value / nextLink + if (null != result.Value) + { + if (0 == _responseSize && 1 == result.Value.Count) + { + _firstResponse = result.Value[0]; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + var values = new System.Collections.Generic.List(); + foreach( var value in result.Value ) + { + values.Add(value.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(values, true); + _responseSize = 2; + } + } + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (!String.IsNullOrEmpty(_nextLink)) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.GitHubOwnersListAvailable_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorGitHubOwner_Get.cs b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorGitHubOwner_Get.cs new file mode 100644 index 000000000000..96e68b8a84e1 --- /dev/null +++ b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorGitHubOwner_Get.cs @@ -0,0 +1,488 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Cmdlets; + using System; + + /// Returns a monitored GitHub owner. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitHubOwners/{ownerName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSecurityConnectorGitHubOwner_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwner))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Description(@"Returns a monitored GitHub owner.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitHubOwners/{ownerName}", ApiVersion = "2023-09-01-preview")] + public partial class GetAzSecurityConnectorGitHubOwner_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Security.Security Client => Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _ownerName; + + /// The GitHub owner name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The GitHub owner name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The GitHub owner name.", + SerializedName = @"ownerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string OwnerName { get => this._ownerName; set => this._ownerName = value; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _securityConnectorName; + + /// The security connector name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The security connector name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The security connector name.", + SerializedName = @"securityConnectorName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string SecurityConnectorName { get => this._securityConnectorName; set => this._securityConnectorName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// Azure subscription ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure subscription ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure subscription ID", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwner + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzSecurityConnectorGitHubOwner_Get() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.GitHubOwnersGet(SubscriptionId, ResourceGroupName, SecurityConnectorName, OwnerName, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,SecurityConnectorName=SecurityConnectorName,OwnerName=OwnerName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwner + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwner + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorGitHubOwner_GetViaIdentity.cs b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorGitHubOwner_GetViaIdentity.cs new file mode 100644 index 000000000000..0afa9ad3b1cc --- /dev/null +++ b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorGitHubOwner_GetViaIdentity.cs @@ -0,0 +1,456 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Cmdlets; + using System; + + /// Returns a monitored GitHub owner. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitHubOwners/{ownerName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSecurityConnectorGitHubOwner_GetViaIdentity")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwner))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Description(@"Returns a monitored GitHub owner.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitHubOwners/{ownerName}", ApiVersion = "2023-09-01-preview")] + public partial class GetAzSecurityConnectorGitHubOwner_GetViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Security.Security Client => Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwner + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzSecurityConnectorGitHubOwner_GetViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.GitHubOwnersGetViaIdentity(InputObject.Id, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SecurityConnectorName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SecurityConnectorName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.OwnerName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.OwnerName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.GitHubOwnersGet(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.SecurityConnectorName ?? null, InputObject.OwnerName ?? null, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwner + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwner + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorGitHubOwner_List.cs b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorGitHubOwner_List.cs new file mode 100644 index 000000000000..212f4566d4a4 --- /dev/null +++ b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorGitHubOwner_List.cs @@ -0,0 +1,501 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Cmdlets; + using System; + + /// Returns a list of GitHub owners onboarded to the connector. + /// + /// [OpenAPI] List=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitHubOwners" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSecurityConnectorGitHubOwner_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwner))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Description(@"Returns a list of GitHub owners onboarded to the connector.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitHubOwners", ApiVersion = "2023-09-01-preview")] + public partial class GetAzSecurityConnectorGitHubOwner_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Security.Security Client => Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _securityConnectorName; + + /// The security connector name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The security connector name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The security connector name.", + SerializedName = @"securityConnectorName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string SecurityConnectorName { get => this._securityConnectorName; set => this._securityConnectorName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// Azure subscription ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure subscription ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure subscription ID", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerListResponse + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzSecurityConnectorGitHubOwner_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.GitHubOwnersList(SubscriptionId, ResourceGroupName, SecurityConnectorName, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,SecurityConnectorName=SecurityConnectorName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerListResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerListResponse + var result = (await response); + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + if (null != result.Value) + { + if (0 == _responseSize && 1 == result.Value.Count) + { + _firstResponse = result.Value[0]; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + var values = new System.Collections.Generic.List(); + foreach( var value in result.Value ) + { + values.Add(value.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(values, true); + _responseSize = 2; + } + } + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (!String.IsNullOrEmpty(_nextLink)) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.GitHubOwnersList_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorGitHubRepo_Get.cs b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorGitHubRepo_Get.cs new file mode 100644 index 000000000000..5991564c6c9e --- /dev/null +++ b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorGitHubRepo_Get.cs @@ -0,0 +1,502 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Cmdlets; + using System; + + /// Returns a monitored GitHub repository. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitHubOwners/{ownerName}/repos/{repoName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSecurityConnectorGitHubRepo_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepository))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Description(@"Returns a monitored GitHub repository.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitHubOwners/{ownerName}/repos/{repoName}", ApiVersion = "2023-09-01-preview")] + public partial class GetAzSecurityConnectorGitHubRepo_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Security.Security Client => Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _ownerName; + + /// The GitHub owner name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The GitHub owner name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The GitHub owner name.", + SerializedName = @"ownerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string OwnerName { get => this._ownerName; set => this._ownerName = value; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _repoName; + + /// The repository name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The repository name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The repository name.", + SerializedName = @"repoName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string RepoName { get => this._repoName; set => this._repoName = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _securityConnectorName; + + /// The security connector name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The security connector name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The security connector name.", + SerializedName = @"securityConnectorName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string SecurityConnectorName { get => this._securityConnectorName; set => this._securityConnectorName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// Azure subscription ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure subscription ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure subscription ID", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepository + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzSecurityConnectorGitHubRepo_Get() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.GitHubReposGet(SubscriptionId, ResourceGroupName, SecurityConnectorName, OwnerName, RepoName, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,SecurityConnectorName=SecurityConnectorName,OwnerName=OwnerName,RepoName=RepoName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepository + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepository + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorGitHubRepo_GetViaIdentity.cs b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorGitHubRepo_GetViaIdentity.cs new file mode 100644 index 000000000000..8ac73cdad0d1 --- /dev/null +++ b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorGitHubRepo_GetViaIdentity.cs @@ -0,0 +1,460 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Cmdlets; + using System; + + /// Returns a monitored GitHub repository. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitHubOwners/{ownerName}/repos/{repoName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSecurityConnectorGitHubRepo_GetViaIdentity")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepository))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Description(@"Returns a monitored GitHub repository.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitHubOwners/{ownerName}/repos/{repoName}", ApiVersion = "2023-09-01-preview")] + public partial class GetAzSecurityConnectorGitHubRepo_GetViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Security.Security Client => Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepository + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzSecurityConnectorGitHubRepo_GetViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.GitHubReposGetViaIdentity(InputObject.Id, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SecurityConnectorName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SecurityConnectorName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.OwnerName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.OwnerName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.RepoName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.RepoName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.GitHubReposGet(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.SecurityConnectorName ?? null, InputObject.OwnerName ?? null, InputObject.RepoName ?? null, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepository + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepository + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorGitHubRepo_List.cs b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorGitHubRepo_List.cs new file mode 100644 index 000000000000..659a2e4d1e3b --- /dev/null +++ b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorGitHubRepo_List.cs @@ -0,0 +1,515 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Cmdlets; + using System; + + /// Returns a list of GitHub repositories onboarded to the connector. + /// + /// [OpenAPI] List=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitHubOwners/{ownerName}/repos" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSecurityConnectorGitHubRepo_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepository))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Description(@"Returns a list of GitHub repositories onboarded to the connector.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitHubOwners/{ownerName}/repos", ApiVersion = "2023-09-01-preview")] + public partial class GetAzSecurityConnectorGitHubRepo_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Security.Security Client => Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _ownerName; + + /// The GitHub owner name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The GitHub owner name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The GitHub owner name.", + SerializedName = @"ownerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string OwnerName { get => this._ownerName; set => this._ownerName = value; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _securityConnectorName; + + /// The security connector name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The security connector name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The security connector name.", + SerializedName = @"securityConnectorName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string SecurityConnectorName { get => this._securityConnectorName; set => this._securityConnectorName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// Azure subscription ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure subscription ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure subscription ID", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryListResponse + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzSecurityConnectorGitHubRepo_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.GitHubReposList(SubscriptionId, ResourceGroupName, SecurityConnectorName, OwnerName, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,SecurityConnectorName=SecurityConnectorName,OwnerName=OwnerName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryListResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepositoryListResponse + var result = (await response); + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + if (null != result.Value) + { + if (0 == _responseSize && 1 == result.Value.Count) + { + _firstResponse = result.Value[0]; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + var values = new System.Collections.Generic.List(); + foreach( var value in result.Value ) + { + values.Add(value.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(values, true); + _responseSize = 2; + } + } + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (!String.IsNullOrEmpty(_nextLink)) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.GitHubReposList_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorGitLabGroupAvailable_List.cs b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorGitLabGroupAvailable_List.cs new file mode 100644 index 000000000000..2c1f9ba07604 --- /dev/null +++ b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorGitLabGroupAvailable_List.cs @@ -0,0 +1,506 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Cmdlets; + using System; + + /// + /// Returns a list of all GitLab groups accessible by the user token consumed by the connector. + /// + /// + /// [OpenAPI] ListAvailable=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/listAvailableGitLabGroups" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSecurityConnectorGitLabGroupAvailable_List", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupListResponse))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Description(@"Returns a list of all GitLab groups accessible by the user token consumed by the connector.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/listAvailableGitLabGroups", ApiVersion = "2023-09-01-preview")] + public partial class GetAzSecurityConnectorGitLabGroupAvailable_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Security.Security Client => Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _securityConnectorName; + + /// The security connector name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The security connector name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The security connector name.", + SerializedName = @"securityConnectorName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string SecurityConnectorName { get => this._securityConnectorName; set => this._securityConnectorName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// Azure subscription ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure subscription ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure subscription ID", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupListResponse + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzSecurityConnectorGitLabGroupAvailable_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'GitLabGroupsListAvailable' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.GitLabGroupsListAvailable(SubscriptionId, ResourceGroupName, SecurityConnectorName, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,SecurityConnectorName=SecurityConnectorName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupListResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupListResponse + var result = (await response); + // response should be returning an array of some kind. +Pageable + // nested-array / value / nextLink + if (null != result.Value) + { + if (0 == _responseSize && 1 == result.Value.Count) + { + _firstResponse = result.Value[0]; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + var values = new System.Collections.Generic.List(); + foreach( var value in result.Value ) + { + values.Add(value.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(values, true); + _responseSize = 2; + } + } + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (!String.IsNullOrEmpty(_nextLink)) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.GitLabGroupsListAvailable_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorGitLabGroup_Get.cs b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorGitLabGroup_Get.cs new file mode 100644 index 000000000000..0e2e06b50873 --- /dev/null +++ b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorGitLabGroup_Get.cs @@ -0,0 +1,488 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Cmdlets; + using System; + + /// Returns a monitored GitLab Group resource for a given fully-qualified name. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitLabGroups/{groupFQName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSecurityConnectorGitLabGroup_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroup))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Description(@"Returns a monitored GitLab Group resource for a given fully-qualified name.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitLabGroups/{groupFQName}", ApiVersion = "2023-09-01-preview")] + public partial class GetAzSecurityConnectorGitLabGroup_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Security.Security Client => Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// Backing field for property. + private string _groupFqName; + + /// The GitLab group fully-qualified name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The GitLab group fully-qualified name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The GitLab group fully-qualified name.", + SerializedName = @"groupFQName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string GroupFqName { get => this._groupFqName; set => this._groupFqName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _securityConnectorName; + + /// The security connector name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The security connector name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The security connector name.", + SerializedName = @"securityConnectorName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string SecurityConnectorName { get => this._securityConnectorName; set => this._securityConnectorName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// Azure subscription ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure subscription ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure subscription ID", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroup + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzSecurityConnectorGitLabGroup_Get() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.GitLabGroupsGet(SubscriptionId, ResourceGroupName, SecurityConnectorName, GroupFqName, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,SecurityConnectorName=SecurityConnectorName,GroupFqName=GroupFqName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroup + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroup + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorGitLabGroup_GetViaIdentity.cs b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorGitLabGroup_GetViaIdentity.cs new file mode 100644 index 000000000000..3b99332b89e7 --- /dev/null +++ b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorGitLabGroup_GetViaIdentity.cs @@ -0,0 +1,456 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Cmdlets; + using System; + + /// Returns a monitored GitLab Group resource for a given fully-qualified name. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitLabGroups/{groupFQName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSecurityConnectorGitLabGroup_GetViaIdentity")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroup))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Description(@"Returns a monitored GitLab Group resource for a given fully-qualified name.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitLabGroups/{groupFQName}", ApiVersion = "2023-09-01-preview")] + public partial class GetAzSecurityConnectorGitLabGroup_GetViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Security.Security Client => Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroup + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzSecurityConnectorGitLabGroup_GetViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.GitLabGroupsGetViaIdentity(InputObject.Id, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SecurityConnectorName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SecurityConnectorName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.GroupFqName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.GroupFqName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.GitLabGroupsGet(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.SecurityConnectorName ?? null, InputObject.GroupFqName ?? null, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroup + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroup + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorGitLabGroup_List.cs b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorGitLabGroup_List.cs new file mode 100644 index 000000000000..df342b666045 --- /dev/null +++ b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorGitLabGroup_List.cs @@ -0,0 +1,501 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Cmdlets; + using System; + + /// Returns a list of GitLab groups onboarded to the connector. + /// + /// [OpenAPI] List=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitLabGroups" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSecurityConnectorGitLabGroup_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroup))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Description(@"Returns a list of GitLab groups onboarded to the connector.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitLabGroups", ApiVersion = "2023-09-01-preview")] + public partial class GetAzSecurityConnectorGitLabGroup_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Security.Security Client => Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _securityConnectorName; + + /// The security connector name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The security connector name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The security connector name.", + SerializedName = @"securityConnectorName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string SecurityConnectorName { get => this._securityConnectorName; set => this._securityConnectorName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// Azure subscription ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure subscription ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure subscription ID", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupListResponse + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzSecurityConnectorGitLabGroup_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.GitLabGroupsList(SubscriptionId, ResourceGroupName, SecurityConnectorName, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,SecurityConnectorName=SecurityConnectorName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupListResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupListResponse + var result = (await response); + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + if (null != result.Value) + { + if (0 == _responseSize && 1 == result.Value.Count) + { + _firstResponse = result.Value[0]; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + var values = new System.Collections.Generic.List(); + foreach( var value in result.Value ) + { + values.Add(value.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(values, true); + _responseSize = 2; + } + } + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (!String.IsNullOrEmpty(_nextLink)) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.GitLabGroupsList_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorGitLabProject_Get.cs b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorGitLabProject_Get.cs new file mode 100644 index 000000000000..280d25e0b06f --- /dev/null +++ b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorGitLabProject_Get.cs @@ -0,0 +1,504 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Cmdlets; + using System; + + /// + /// Returns a monitored GitLab Project resource for a given fully-qualified group name and project name. + /// + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitLabGroups/{groupFQName}/projects/{projectName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSecurityConnectorGitLabProject_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProject))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Description(@"Returns a monitored GitLab Project resource for a given fully-qualified group name and project name.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitLabGroups/{groupFQName}/projects/{projectName}", ApiVersion = "2023-09-01-preview")] + public partial class GetAzSecurityConnectorGitLabProject_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Security.Security Client => Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// Backing field for property. + private string _groupFqName; + + /// The GitLab group fully-qualified name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The GitLab group fully-qualified name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The GitLab group fully-qualified name.", + SerializedName = @"groupFQName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string GroupFqName { get => this._groupFqName; set => this._groupFqName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _projectName; + + /// The project name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The project name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The project name.", + SerializedName = @"projectName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string ProjectName { get => this._projectName; set => this._projectName = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _securityConnectorName; + + /// The security connector name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The security connector name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The security connector name.", + SerializedName = @"securityConnectorName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string SecurityConnectorName { get => this._securityConnectorName; set => this._securityConnectorName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// Azure subscription ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure subscription ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure subscription ID", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProject + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzSecurityConnectorGitLabProject_Get() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.GitLabProjectsGet(SubscriptionId, ResourceGroupName, SecurityConnectorName, GroupFqName, ProjectName, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,SecurityConnectorName=SecurityConnectorName,GroupFqName=GroupFqName,ProjectName=ProjectName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProject + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProject + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorGitLabProject_GetViaIdentity.cs b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorGitLabProject_GetViaIdentity.cs new file mode 100644 index 000000000000..2c49790e3a1e --- /dev/null +++ b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorGitLabProject_GetViaIdentity.cs @@ -0,0 +1,462 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Cmdlets; + using System; + + /// + /// Returns a monitored GitLab Project resource for a given fully-qualified group name and project name. + /// + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitLabGroups/{groupFQName}/projects/{projectName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSecurityConnectorGitLabProject_GetViaIdentity")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProject))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Description(@"Returns a monitored GitLab Project resource for a given fully-qualified group name and project name.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitLabGroups/{groupFQName}/projects/{projectName}", ApiVersion = "2023-09-01-preview")] + public partial class GetAzSecurityConnectorGitLabProject_GetViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Security.Security Client => Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProject + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzSecurityConnectorGitLabProject_GetViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.GitLabProjectsGetViaIdentity(InputObject.Id, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SecurityConnectorName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SecurityConnectorName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.GroupFqName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.GroupFqName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProjectName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProjectName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.GitLabProjectsGet(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.SecurityConnectorName ?? null, InputObject.GroupFqName ?? null, InputObject.ProjectName ?? null, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProject + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProject + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorGitLabProject_List.cs b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorGitLabProject_List.cs new file mode 100644 index 000000000000..0554f87f9e35 --- /dev/null +++ b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorGitLabProject_List.cs @@ -0,0 +1,517 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Cmdlets; + using System; + + /// + /// Gets a list of GitLab projects that are directly owned by given group and onboarded to the connector. + /// + /// + /// [OpenAPI] List=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitLabGroups/{groupFQName}/projects" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSecurityConnectorGitLabProject_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProject))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Description(@"Gets a list of GitLab projects that are directly owned by given group and onboarded to the connector.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitLabGroups/{groupFQName}/projects", ApiVersion = "2023-09-01-preview")] + public partial class GetAzSecurityConnectorGitLabProject_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Security.Security Client => Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// Backing field for property. + private string _groupFqName; + + /// The GitLab group fully-qualified name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The GitLab group fully-qualified name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The GitLab group fully-qualified name.", + SerializedName = @"groupFQName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string GroupFqName { get => this._groupFqName; set => this._groupFqName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _securityConnectorName; + + /// The security connector name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The security connector name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The security connector name.", + SerializedName = @"securityConnectorName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string SecurityConnectorName { get => this._securityConnectorName; set => this._securityConnectorName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// Azure subscription ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure subscription ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure subscription ID", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectListResponse + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzSecurityConnectorGitLabProject_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.GitLabProjectsList(SubscriptionId, ResourceGroupName, SecurityConnectorName, GroupFqName, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,SecurityConnectorName=SecurityConnectorName,GroupFqName=GroupFqName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectListResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProjectListResponse + var result = (await response); + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + if (null != result.Value) + { + if (0 == _responseSize && 1 == result.Value.Count) + { + _firstResponse = result.Value[0]; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + var values = new System.Collections.Generic.List(); + foreach( var value in result.Value ) + { + values.Add(value.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(values, true); + _responseSize = 2; + } + } + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (!String.IsNullOrEmpty(_nextLink)) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.GitLabProjectsList_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorGitLabSubgroup_List.cs b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorGitLabSubgroup_List.cs new file mode 100644 index 000000000000..0c374c95eca7 --- /dev/null +++ b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnectorGitLabSubgroup_List.cs @@ -0,0 +1,520 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Cmdlets; + using System; + + /// + /// Gets nested subgroups of given GitLab Group which are onboarded to the connector. + /// + /// + /// [OpenAPI] List=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitLabGroups/{groupFQName}/listSubgroups" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSecurityConnectorGitLabSubgroup_List", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupListResponse))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Description(@"Gets nested subgroups of given GitLab Group which are onboarded to the connector.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitLabGroups/{groupFQName}/listSubgroups", ApiVersion = "2023-09-01-preview")] + public partial class GetAzSecurityConnectorGitLabSubgroup_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Security.Security Client => Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// Backing field for property. + private string _groupFqName; + + /// The GitLab group fully-qualified name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The GitLab group fully-qualified name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The GitLab group fully-qualified name.", + SerializedName = @"groupFQName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string GroupFqName { get => this._groupFqName; set => this._groupFqName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _securityConnectorName; + + /// The security connector name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The security connector name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The security connector name.", + SerializedName = @"securityConnectorName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string SecurityConnectorName { get => this._securityConnectorName; set => this._securityConnectorName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// Azure subscription ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure subscription ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure subscription ID", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupListResponse + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzSecurityConnectorGitLabSubgroup_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'GitLabSubgroupsList' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.GitLabSubgroupsList(SubscriptionId, ResourceGroupName, SecurityConnectorName, GroupFqName, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,SecurityConnectorName=SecurityConnectorName,GroupFqName=GroupFqName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupListResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupListResponse + var result = (await response); + // response should be returning an array of some kind. +Pageable + // nested-array / value / nextLink + if (null != result.Value) + { + if (0 == _responseSize && 1 == result.Value.Count) + { + _firstResponse = result.Value[0]; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + var values = new System.Collections.Generic.List(); + foreach( var value in result.Value ) + { + values.Add(value.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(values, true); + _responseSize = 2; + } + } + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (!String.IsNullOrEmpty(_nextLink)) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.GitLabSubgroupsList_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnector_Get.cs b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnector_Get.cs new file mode 100644 index 000000000000..23e1ef30b792 --- /dev/null +++ b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnector_Get.cs @@ -0,0 +1,477 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Cmdlets; + using System; + + /// Retrieves details of a specific security connector + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSecurityConnector_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnector))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Description(@"Retrieves details of a specific security connector")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}", ApiVersion = "2023-10-01-preview")] + public partial class GetAzSecurityConnector_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Security.Security Client => Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// The security connector name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The security connector name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The security connector name.", + SerializedName = @"securityConnectorName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("SecurityConnectorName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// + /// The name of the resource group within the user's subscription. The name is case insensitive. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group within the user's subscription. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group within the user's subscription. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// Azure subscription ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure subscription ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure subscription ID", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudError + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnector + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzSecurityConnector_Get() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.SecurityConnectorsGet(SubscriptionId, ResourceGroupName, Name, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudError + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnector + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnector + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnector_GetViaIdentity.cs b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnector_GetViaIdentity.cs new file mode 100644 index 000000000000..72e31190d55c --- /dev/null +++ b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnector_GetViaIdentity.cs @@ -0,0 +1,452 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Cmdlets; + using System; + + /// Retrieves details of a specific security connector + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSecurityConnector_GetViaIdentity")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnector))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Description(@"Retrieves details of a specific security connector")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}", ApiVersion = "2023-10-01-preview")] + public partial class GetAzSecurityConnector_GetViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Security.Security Client => Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudError + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnector + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzSecurityConnector_GetViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.SecurityConnectorsGetViaIdentity(InputObject.Id, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SecurityConnectorName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SecurityConnectorName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.SecurityConnectorsGet(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.SecurityConnectorName ?? null, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudError + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnector + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnector + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnector_List.cs b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnector_List.cs new file mode 100644 index 000000000000..00e64de9e9b2 --- /dev/null +++ b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnector_List.cs @@ -0,0 +1,476 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Cmdlets; + using System; + + /// + /// Lists all the security connectors in the specified subscription. Use the 'nextLink' property in the response to get the + /// next page of security connectors for the specified subscription. + /// + /// + /// [OpenAPI] List=>GET:"/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityConnectors" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSecurityConnector_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnector))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Description(@"Lists all the security connectors in the specified subscription. Use the 'nextLink' property in the response to get the next page of security connectors for the specified subscription.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.HttpPath(Path = "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityConnectors", ApiVersion = "2023-10-01-preview")] + public partial class GetAzSecurityConnector_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Security.Security Client => Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// Azure subscription ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure subscription ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure subscription ID", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudError + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorsList + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzSecurityConnector_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.SecurityConnectorsList(SubscriptionId, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudError + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorsList + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorsList + var result = (await response); + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + if (null != result.Value) + { + if (0 == _responseSize && 1 == result.Value.Count) + { + _firstResponse = result.Value[0]; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + var values = new System.Collections.Generic.List(); + foreach( var value in result.Value ) + { + values.Add(value.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(values, true); + _responseSize = 2; + } + } + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (!String.IsNullOrEmpty(_nextLink)) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.SecurityConnectorsList_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnector_List1.cs b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnector_List1.cs new file mode 100644 index 000000000000..2cb7639650ab --- /dev/null +++ b/src/Security/Security.Autorest/generated/cmdlets/GetAzSecurityConnector_List1.cs @@ -0,0 +1,492 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Cmdlets; + using System; + + /// + /// Lists all the security connectors in the specified resource group. Use the 'nextLink' property in the response to get + /// the next page of security connectors for the specified resource group. + /// + /// + /// [OpenAPI] ListByResourceGroup=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSecurityConnector_List1")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnector))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Description(@"Lists all the security connectors in the specified resource group. Use the 'nextLink' property in the response to get the next page of security connectors for the specified resource group.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors", ApiVersion = "2023-10-01-preview")] + public partial class GetAzSecurityConnector_List1 : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Security.Security Client => Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// + /// The name of the resource group within the user's subscription. The name is case insensitive. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group within the user's subscription. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group within the user's subscription. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// Azure subscription ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure subscription ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure subscription ID", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudError + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorsList + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzSecurityConnector_List1() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.SecurityConnectorsListByResourceGroup(SubscriptionId, ResourceGroupName, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudError + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorsList + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorsList + var result = (await response); + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + if (null != result.Value) + { + if (0 == _responseSize && 1 == result.Value.Count) + { + _firstResponse = result.Value[0]; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + var values = new System.Collections.Generic.List(); + foreach( var value in result.Value ) + { + values.Add(value.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(values, true); + _responseSize = 2; + } + } + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (!String.IsNullOrEmpty(_nextLink)) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.SecurityConnectorsListByResourceGroup_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/cmdlets/InvokeAzSecurityApiCollectionApimOffboard_Delete.cs b/src/Security/Security.Autorest/generated/cmdlets/InvokeAzSecurityApiCollectionApimOffboard_Delete.cs new file mode 100644 index 000000000000..c4f013679a21 --- /dev/null +++ b/src/Security/Security.Autorest/generated/cmdlets/InvokeAzSecurityApiCollectionApimOffboard_Delete.cs @@ -0,0 +1,515 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Cmdlets; + using System; + + /// + /// Offboard an Azure API Management API from Microsoft Defender for APIs. The system will stop monitoring the operations + /// within the Azure API Management API for intrusive behaviors. + /// + /// + /// [OpenAPI] ApiCollectionApimDelete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/providers/Microsoft.Security/apiCollections/{apiId}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzSecurityApiCollectionApimOffboard_Delete", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Description(@"Offboard an Azure API Management API from Microsoft Defender for APIs. The system will stop monitoring the operations within the Azure API Management API for intrusive behaviors.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/providers/Microsoft.Security/apiCollections/{apiId}", ApiVersion = "2023-11-15")] + public partial class InvokeAzSecurityApiCollectionApimOffboard_Delete : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Backing field for property. + private string _apiId; + + /// + /// API revision identifier. Must be unique in the API Management service instance. Non-current revision has ;rev=n as a suffix + /// where n is the revision number. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "API revision identifier. Must be unique in the API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"API revision identifier. Must be unique in the API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number.", + SerializedName = @"apiId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string ApiId { get => this._apiId; set => this._apiId = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Security.Security Client => Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _serviceName; + + /// The name of the API Management service. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the API Management service.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the API Management service.", + SerializedName = @"serviceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string ServiceName { get => this._serviceName; set => this._serviceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// Azure subscription ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure subscription ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure subscription ID", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseAutoGenerated + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public InvokeAzSecurityApiCollectionApimOffboard_Delete() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ApiCollectionsApiCollectionApimDelete' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ApiCollectionsApiCollectionApimDelete(SubscriptionId, ResourceGroupName, ServiceName, ApiId, onOk, onNoContent, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,ServiceName=ServiceName,ApiId=ApiId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseAutoGenerated + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/cmdlets/InvokeAzSecurityApiCollectionApimOffboard_DeleteViaIdentity.cs b/src/Security/Security.Autorest/generated/cmdlets/InvokeAzSecurityApiCollectionApimOffboard_DeleteViaIdentity.cs new file mode 100644 index 000000000000..5db49ddf6019 --- /dev/null +++ b/src/Security/Security.Autorest/generated/cmdlets/InvokeAzSecurityApiCollectionApimOffboard_DeleteViaIdentity.cs @@ -0,0 +1,483 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Cmdlets; + using System; + + /// + /// Offboard an Azure API Management API from Microsoft Defender for APIs. The system will stop monitoring the operations + /// within the Azure API Management API for intrusive behaviors. + /// + /// + /// [OpenAPI] ApiCollectionApimDelete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/providers/Microsoft.Security/apiCollections/{apiId}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzSecurityApiCollectionApimOffboard_DeleteViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Description(@"Offboard an Azure API Management API from Microsoft Defender for APIs. The system will stop monitoring the operations within the Azure API Management API for intrusive behaviors.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/providers/Microsoft.Security/apiCollections/{apiId}", ApiVersion = "2023-11-15")] + public partial class InvokeAzSecurityApiCollectionApimOffboard_DeleteViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Security.Security Client => Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseAutoGenerated + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public InvokeAzSecurityApiCollectionApimOffboard_DeleteViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ApiCollectionsApiCollectionApimDelete' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ApiCollectionsApiCollectionApimDeleteViaIdentity(InputObject.Id, onOk, onNoContent, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ServiceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ServiceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ApiId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ApiId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ApiCollectionsApiCollectionApimDelete(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.ServiceName ?? null, InputObject.ApiId ?? null, onOk, onNoContent, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseAutoGenerated + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/cmdlets/InvokeAzSecurityApiCollectionApimOnboard_Azure.cs b/src/Security/Security.Autorest/generated/cmdlets/InvokeAzSecurityApiCollectionApimOnboard_Azure.cs new file mode 100644 index 000000000000..6405b3e2735b --- /dev/null +++ b/src/Security/Security.Autorest/generated/cmdlets/InvokeAzSecurityApiCollectionApimOnboard_Azure.cs @@ -0,0 +1,577 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Cmdlets; + using System; + + /// + /// Onboard an Azure API Management API to Microsoft Defender for APIs. The system will start monitoring the operations within + /// the Azure Management API for intrusive behaviors and provide alerts for attacks that have been detected. + /// + /// + /// [OpenAPI] OnboardAzureApiManagementApi=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/providers/Microsoft.Security/apiCollections/{apiId}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzSecurityApiCollectionApimOnboard_Azure", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollection))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Description(@"Onboard an Azure API Management API to Microsoft Defender for APIs. The system will start monitoring the operations within the Azure Management API for intrusive behaviors and provide alerts for attacks that have been detected.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/providers/Microsoft.Security/apiCollections/{apiId}", ApiVersion = "2023-11-15")] + public partial class InvokeAzSecurityApiCollectionApimOnboard_Azure : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Backing field for property. + private string _apiId; + + /// + /// API revision identifier. Must be unique in the API Management service instance. Non-current revision has ;rev=n as a suffix + /// where n is the revision number. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "API revision identifier. Must be unique in the API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"API revision identifier. Must be unique in the API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number.", + SerializedName = @"apiId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string ApiId { get => this._apiId; set => this._apiId = value; } + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Security.Security Client => Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _serviceName; + + /// The name of the API Management service. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the API Management service.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the API Management service.", + SerializedName = @"serviceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string ServiceName { get => this._serviceName; set => this._serviceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// Azure subscription ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure subscription ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure subscription ID", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseAutoGenerated + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollection + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of InvokeAzSecurityApiCollectionApimOnboard_Azure + public Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets.InvokeAzSecurityApiCollectionApimOnboard_Azure Clone() + { + var clone = new InvokeAzSecurityApiCollectionApimOnboard_Azure(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.ServiceName = this.ServiceName; + clone.ApiId = this.ApiId; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public InvokeAzSecurityApiCollectionApimOnboard_Azure() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.DelayBeforePolling: + { + var data = messageData(); + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ApiCollectionsOnboardAzureApiManagementApi' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ApiCollectionsOnboardAzureApiManagementApi(SubscriptionId, ResourceGroupName, ServiceName, ApiId, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,ServiceName=ServiceName,ApiId=ApiId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseAutoGenerated + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollection + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollection + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/cmdlets/InvokeAzSecurityApiCollectionApimOnboard_AzureViaIdentity.cs b/src/Security/Security.Autorest/generated/cmdlets/InvokeAzSecurityApiCollectionApimOnboard_AzureViaIdentity.cs new file mode 100644 index 000000000000..294a024324f2 --- /dev/null +++ b/src/Security/Security.Autorest/generated/cmdlets/InvokeAzSecurityApiCollectionApimOnboard_AzureViaIdentity.cs @@ -0,0 +1,543 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Cmdlets; + using System; + + /// + /// Onboard an Azure API Management API to Microsoft Defender for APIs. The system will start monitoring the operations within + /// the Azure Management API for intrusive behaviors and provide alerts for attacks that have been detected. + /// + /// + /// [OpenAPI] OnboardAzureApiManagementApi=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/providers/Microsoft.Security/apiCollections/{apiId}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzSecurityApiCollectionApimOnboard_AzureViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollection))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Description(@"Onboard an Azure API Management API to Microsoft Defender for APIs. The system will start monitoring the operations within the Azure Management API for intrusive behaviors and provide alerts for attacks that have been detected.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/providers/Microsoft.Security/apiCollections/{apiId}", ApiVersion = "2023-11-15")] + public partial class InvokeAzSecurityApiCollectionApimOnboard_AzureViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Security.Security Client => Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseAutoGenerated + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollection + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of InvokeAzSecurityApiCollectionApimOnboard_AzureViaIdentity + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets.InvokeAzSecurityApiCollectionApimOnboard_AzureViaIdentity Clone() + { + var clone = new InvokeAzSecurityApiCollectionApimOnboard_AzureViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public InvokeAzSecurityApiCollectionApimOnboard_AzureViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.DelayBeforePolling: + { + var data = messageData(); + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ApiCollectionsOnboardAzureApiManagementApi' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ApiCollectionsOnboardAzureApiManagementApiViaIdentity(InputObject.Id, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ServiceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ServiceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ApiId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ApiId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ApiCollectionsOnboardAzureApiManagementApi(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.ServiceName ?? null, InputObject.ApiId ?? null, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponseAutoGenerated + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollection + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollection + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/cmdlets/NewAzSecurityConnectorDevOpsConfiguration_CreateExpanded.cs b/src/Security/Security.Autorest/generated/cmdlets/NewAzSecurityConnectorDevOpsConfiguration_CreateExpanded.cs new file mode 100644 index 000000000000..5ea0215918b7 --- /dev/null +++ b/src/Security/Security.Autorest/generated/cmdlets/NewAzSecurityConnectorDevOpsConfiguration_CreateExpanded.cs @@ -0,0 +1,623 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Cmdlets; + using System; + + /// Create a DevOps Configuration. + /// + /// [OpenAPI] CreateOrUpdate=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzSecurityConnectorDevOpsConfiguration_CreateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfiguration))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Description(@"Create a DevOps Configuration.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default", ApiVersion = "2023-09-01-preview")] + public partial class NewAzSecurityConnectorDevOpsConfiguration_CreateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// DevOps Configuration resource. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfiguration _devOpsConfigurationBody = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DevOpsConfiguration(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// + /// Gets or sets one-time OAuth code to exchange for refresh and access tokens.Only used during PUT/PATCH operations. The + /// secret is cleared during GET. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets one-time OAuth code to exchange for refresh and access tokens.Only used during PUT/PATCH operations. The secret is cleared during GET.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets one-time OAuth code to exchange for refresh and access tokens.Only used during PUT/PATCH operations. The secret is cleared during GET.", + SerializedName = @"code", + PossibleTypes = new [] { typeof(string) })] + public string AuthorizationCode { get => _devOpsConfigurationBody.AuthorizationCode ?? null; set => _devOpsConfigurationBody.AuthorizationCode = value; } + + /// AutoDiscovery states. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "AutoDiscovery states.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"AutoDiscovery states.", + SerializedName = @"autoDiscovery", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Disabled", "Enabled", "NotApplicable")] + public string AutoDiscovery { get => _devOpsConfigurationBody.AutoDiscovery ?? null; set => _devOpsConfigurationBody.AutoDiscovery = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Security.Security Client => Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.HttpPipeline Pipeline { get; set; } + + /// + /// The provisioning state of the resource.Pending - Provisioning pending.Failed - Provisioning failed.Succeeded - Successful + /// provisioning.Canceled - Provisioning canceled.PendingDeletion - Deletion pending.DeletionSuccess - Deletion successful.DeletionFailure + /// - Deletion failure. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The provisioning state of the resource.Pending - Provisioning pending.Failed - Provisioning failed.Succeeded - Successful provisioning.Canceled - Provisioning canceled.PendingDeletion - Deletion pending.DeletionSuccess - Deletion successful.DeletionFailure - Deletion failure.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The provisioning state of the resource.Pending - Provisioning pending.Failed - Provisioning failed.Succeeded - Successful provisioning.Canceled - Provisioning canceled.PendingDeletion - Deletion pending.DeletionSuccess - Deletion successful.DeletionFailure - Deletion failure.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.DoNotExport] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Succeeded", "Failed", "Canceled", "Pending", "PendingDeletion", "DeletionSuccess", "DeletionFailure")] + public string ProvisioningState { get => _devOpsConfigurationBody.ProvisioningState ?? null; set => _devOpsConfigurationBody.ProvisioningState = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _securityConnectorName; + + /// The security connector name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The security connector name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The security connector name.", + SerializedName = @"securityConnectorName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string SecurityConnectorName { get => this._securityConnectorName; set => this._securityConnectorName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// Azure subscription ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure subscription ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure subscription ID", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// List of top-level inventory to select when AutoDiscovery is disabled.This field is ignored when AutoDiscovery is enabled. + /// + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "List of top-level inventory to select when AutoDiscovery is disabled.This field is ignored when AutoDiscovery is enabled.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"List of top-level inventory to select when AutoDiscovery is disabled.This field is ignored when AutoDiscovery is enabled.", + SerializedName = @"topLevelInventoryList", + PossibleTypes = new [] { typeof(string) })] + public string[] TopLevelInventoryList { get => _devOpsConfigurationBody.TopLevelInventoryList?.ToArray() ?? null /* fixedArrayOf */; set => _devOpsConfigurationBody.TopLevelInventoryList = (value != null ? new System.Collections.Generic.List(value) : null); } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfiguration + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of NewAzSecurityConnectorDevOpsConfiguration_CreateExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets.NewAzSecurityConnectorDevOpsConfiguration_CreateExpanded Clone() + { + var clone = new NewAzSecurityConnectorDevOpsConfiguration_CreateExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._devOpsConfigurationBody = this._devOpsConfigurationBody; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SecurityConnectorName = this.SecurityConnectorName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.DelayBeforePolling: + { + var data = messageData(); + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public NewAzSecurityConnectorDevOpsConfiguration_CreateExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'DevOpsConfigurationsCreateOrUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + if (true == this.MyInvocation?.BoundParameters?.ContainsKey("ProvisioningState")) + { + ProvisioningState = (string)this.MyInvocation.BoundParameters["ProvisioningState"]; + } + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.DevOpsConfigurationsCreateOrUpdate(SubscriptionId, ResourceGroupName, SecurityConnectorName, _devOpsConfigurationBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeCreate); + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,SecurityConnectorName=SecurityConnectorName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfiguration + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfiguration + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/cmdlets/NewAzSecurityConnector_CreateExpanded.cs b/src/Security/Security.Autorest/generated/cmdlets/NewAzSecurityConnector_CreateExpanded.cs new file mode 100644 index 000000000000..fd44b5115d9e --- /dev/null +++ b/src/Security/Security.Autorest/generated/cmdlets/NewAzSecurityConnector_CreateExpanded.cs @@ -0,0 +1,632 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Cmdlets; + using System; + + /// + /// Create a security connector. If a security connector is already created and a subsequent request is issued for the same + /// security connector id, then it will be updated. + /// + /// + /// [OpenAPI] CreateOrUpdate=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzSecurityConnector_CreateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnector))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Description(@"Create a security connector. If a security connector is already created and a subsequent request is issued for the same security connector id, then it will be updated.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}", ApiVersion = "2023-10-01-preview")] + public partial class NewAzSecurityConnector_CreateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// The security connector resource. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnector _securityConnectorBody = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SecurityConnector(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Security.Security Client => Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// The security connector environment data. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The security connector environment data.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The security connector environment data.", + SerializedName = @"environmentData", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironment) })] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironment EnvironmentData { get => _securityConnectorBody.EnvironmentData ?? null /* object */; set => _securityConnectorBody.EnvironmentData = value; } + + /// The multi cloud resource's cloud name. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The multi cloud resource's cloud name.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The multi cloud resource's cloud name.", + SerializedName = @"environmentName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Azure", "AWS", "GCP", "Github", "AzureDevOps", "GitLab")] + public string EnvironmentName { get => _securityConnectorBody.EnvironmentName ?? null; set => _securityConnectorBody.EnvironmentName = value; } + + /// + /// Entity tag is used for comparing two or more entities from the same requested resource. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Entity tag is used for comparing two or more entities from the same requested resource.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Entity tag is used for comparing two or more entities from the same requested resource.", + SerializedName = @"etag", + PossibleTypes = new [] { typeof(string) })] + public string Etag { get => _securityConnectorBody.Etag ?? null; set => _securityConnectorBody.Etag = value; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// + /// The multi cloud resource identifier (account id in case of AWS connector, project number in case of GCP connector). + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The multi cloud resource identifier (account id in case of AWS connector, project number in case of GCP connector).")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The multi cloud resource identifier (account id in case of AWS connector, project number in case of GCP connector).", + SerializedName = @"hierarchyIdentifier", + PossibleTypes = new [] { typeof(string) })] + public string HierarchyIdentifier { get => _securityConnectorBody.HierarchyIdentifier ?? null; set => _securityConnectorBody.HierarchyIdentifier = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Kind of the resource + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Kind of the resource")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Kind of the resource", + SerializedName = @"kind", + PossibleTypes = new [] { typeof(string) })] + public string Kind { get => _securityConnectorBody.Kind ?? null; set => _securityConnectorBody.Kind = value; } + + /// Location where the resource is stored + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Location where the resource is stored")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Location where the resource is stored", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + public string Location { get => _securityConnectorBody.Location ?? null; set => _securityConnectorBody.Location = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// The security connector name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The security connector name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The security connector name.", + SerializedName = @"securityConnectorName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("SecurityConnectorName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// A collection of offerings for the security connector. + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "A collection of offerings for the security connector.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A collection of offerings for the security connector.", + SerializedName = @"offerings", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOffering) })] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOffering[] Offering { get => _securityConnectorBody.Offering?.ToArray() ?? null /* fixedArrayOf */; set => _securityConnectorBody.Offering = (value != null ? new System.Collections.Generic.List(value) : null); } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// + /// The name of the resource group within the user's subscription. The name is case insensitive. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group within the user's subscription. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group within the user's subscription. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// Azure subscription ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure subscription ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure subscription ID", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// A list of key value pairs that describe the resource. + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "A list of key value pairs that describe the resource.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A list of key value pairs that describe the resource.", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITags) })] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITags Tag { get => _securityConnectorBody.Tag ?? null /* object */; set => _securityConnectorBody.Tag = value; } + + /// + /// overrideOnCreated will be called before the regular onCreated has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnector + /// from the remote call + /// /// Determines if the rest of the onCreated method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnCreated(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudError + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnector + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public NewAzSecurityConnector_CreateExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'SecurityConnectorsCreateOrUpdate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.SecurityConnectorsCreateOrUpdate(SubscriptionId, ResourceGroupName, Name, _securityConnectorBody, onOk, onCreated, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeCreate); + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 201 (Created). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnector + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onCreated(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnCreated(responseMessage, response, ref _returnNow); + // if overrideOnCreated has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onCreated - response for 201 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnector + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudError + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnector + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnector + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/cmdlets/RemoveAzSecurityConnectorDevOpsConfiguration_Delete.cs b/src/Security/Security.Autorest/generated/cmdlets/RemoveAzSecurityConnectorDevOpsConfiguration_Delete.cs new file mode 100644 index 000000000000..73775251f031 --- /dev/null +++ b/src/Security/Security.Autorest/generated/cmdlets/RemoveAzSecurityConnectorDevOpsConfiguration_Delete.cs @@ -0,0 +1,577 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Cmdlets; + using System; + + /// Deletes a DevOps Connector. + /// + /// [OpenAPI] Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzSecurityConnectorDevOpsConfiguration_Delete", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Description(@"Deletes a DevOps Connector.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default", ApiVersion = "2023-09-01-preview")] + public partial class RemoveAzSecurityConnectorDevOpsConfiguration_Delete : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Security.Security Client => Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _securityConnectorName; + + /// The security connector name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The security connector name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The security connector name.", + SerializedName = @"securityConnectorName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string SecurityConnectorName { get => this._securityConnectorName; set => this._securityConnectorName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// Azure subscription ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure subscription ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure subscription ID", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of RemoveAzSecurityConnectorDevOpsConfiguration_Delete + public Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets.RemoveAzSecurityConnectorDevOpsConfiguration_Delete Clone() + { + var clone = new RemoveAzSecurityConnectorDevOpsConfiguration_Delete(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SecurityConnectorName = this.SecurityConnectorName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.DelayBeforePolling: + { + var data = messageData(); + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'DevOpsConfigurationsDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.DevOpsConfigurationsDelete(SubscriptionId, ResourceGroupName, SecurityConnectorName, onOk, onNoContent, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,SecurityConnectorName=SecurityConnectorName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public RemoveAzSecurityConnectorDevOpsConfiguration_Delete() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/cmdlets/RemoveAzSecurityConnectorDevOpsConfiguration_DeleteViaIdentity.cs b/src/Security/Security.Autorest/generated/cmdlets/RemoveAzSecurityConnectorDevOpsConfiguration_DeleteViaIdentity.cs new file mode 100644 index 000000000000..0885fd685e53 --- /dev/null +++ b/src/Security/Security.Autorest/generated/cmdlets/RemoveAzSecurityConnectorDevOpsConfiguration_DeleteViaIdentity.cs @@ -0,0 +1,558 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Cmdlets; + using System; + + /// Deletes a DevOps Connector. + /// + /// [OpenAPI] Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzSecurityConnectorDevOpsConfiguration_DeleteViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Description(@"Deletes a DevOps Connector.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default", ApiVersion = "2023-09-01-preview")] + public partial class RemoveAzSecurityConnectorDevOpsConfiguration_DeleteViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Security.Security Client => Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of RemoveAzSecurityConnectorDevOpsConfiguration_DeleteViaIdentity + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets.RemoveAzSecurityConnectorDevOpsConfiguration_DeleteViaIdentity Clone() + { + var clone = new RemoveAzSecurityConnectorDevOpsConfiguration_DeleteViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.DelayBeforePolling: + { + var data = messageData(); + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'DevOpsConfigurationsDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.DevOpsConfigurationsDeleteViaIdentity(InputObject.Id, onOk, onNoContent, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SecurityConnectorName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SecurityConnectorName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.DevOpsConfigurationsDelete(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.SecurityConnectorName ?? null, onOk, onNoContent, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Initializes a new instance of the cmdlet + /// class. + /// + public RemoveAzSecurityConnectorDevOpsConfiguration_DeleteViaIdentity() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/cmdlets/RemoveAzSecurityConnector_Delete.cs b/src/Security/Security.Autorest/generated/cmdlets/RemoveAzSecurityConnector_Delete.cs new file mode 100644 index 000000000000..31ec5bb40c4b --- /dev/null +++ b/src/Security/Security.Autorest/generated/cmdlets/RemoveAzSecurityConnector_Delete.cs @@ -0,0 +1,498 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Cmdlets; + using System; + + /// Deletes a security connector. + /// + /// [OpenAPI] Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzSecurityConnector_Delete", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Description(@"Deletes a security connector.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}", ApiVersion = "2023-10-01-preview")] + public partial class RemoveAzSecurityConnector_Delete : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Security.Security Client => Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// The security connector name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The security connector name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The security connector name.", + SerializedName = @"securityConnectorName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("SecurityConnectorName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// + /// The name of the resource group within the user's subscription. The name is case insensitive. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group within the user's subscription. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group within the user's subscription. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// Azure subscription ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure subscription ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure subscription ID", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudError + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'SecurityConnectorsDelete' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.SecurityConnectorsDelete(SubscriptionId, ResourceGroupName, Name, onOk, onNoContent, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public RemoveAzSecurityConnector_Delete() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudError + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/cmdlets/RemoveAzSecurityConnector_DeleteViaIdentity.cs b/src/Security/Security.Autorest/generated/cmdlets/RemoveAzSecurityConnector_DeleteViaIdentity.cs new file mode 100644 index 000000000000..b0b8766a6677 --- /dev/null +++ b/src/Security/Security.Autorest/generated/cmdlets/RemoveAzSecurityConnector_DeleteViaIdentity.cs @@ -0,0 +1,476 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Cmdlets; + using System; + + /// Deletes a security connector. + /// + /// [OpenAPI] Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzSecurityConnector_DeleteViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Description(@"Deletes a security connector.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}", ApiVersion = "2023-10-01-preview")] + public partial class RemoveAzSecurityConnector_DeleteViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Security.Security Client => Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudError + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'SecurityConnectorsDelete' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.SecurityConnectorsDeleteViaIdentity(InputObject.Id, onOk, onNoContent, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SecurityConnectorName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SecurityConnectorName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.SecurityConnectorsDelete(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.SecurityConnectorName ?? null, onOk, onNoContent, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public RemoveAzSecurityConnector_DeleteViaIdentity() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudError + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/cmdlets/UpdateAzSecurityConnectorAzureDevOpsOrg_UpdateExpanded.cs b/src/Security/Security.Autorest/generated/cmdlets/UpdateAzSecurityConnectorAzureDevOpsOrg_UpdateExpanded.cs new file mode 100644 index 000000000000..6f28795cd70e --- /dev/null +++ b/src/Security/Security.Autorest/generated/cmdlets/UpdateAzSecurityConnectorAzureDevOpsOrg_UpdateExpanded.cs @@ -0,0 +1,629 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Cmdlets; + using System; + + /// Updates monitored Azure DevOps organization details. + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzSecurityConnectorAzureDevOpsOrg_UpdateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrg))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Description(@"Updates monitored Azure DevOps organization details.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}", ApiVersion = "2023-09-01-preview")] + public partial class UpdateAzSecurityConnectorAzureDevOpsOrg_UpdateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// Azure DevOps Organization resource. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrg _azureDevOpsOrgBody = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsOrg(); + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Configuration payload for PR Annotations. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Configuration payload for PR Annotations.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Configuration payload for PR Annotations.", + SerializedName = @"actionableRemediation", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediation) })] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediation ActionableRemediation { get => _azureDevOpsOrgBody.ActionableRemediation ?? null /* object */; set => _azureDevOpsOrgBody.ActionableRemediation = value; } + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Security.Security Client => Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// Details about resource onboarding status across all connectors.OnboardedByOtherConnector - this resource has already been + /// onboarded to another connector. This is only applicable to top-level resources.Onboarded - this resource has already been + /// onboarded by the specified connector.NotOnboarded - this resource has not been onboarded to any connector.NotApplicable + /// - the onboarding state is not applicable to the current endpoint. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Details about resource onboarding status across all connectors.OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to top-level resources.Onboarded - this resource has already been onboarded by the specified connector.NotOnboarded - this resource has not been onboarded to any connector.NotApplicable - the onboarding state is not applicable to the current endpoint.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Details about resource onboarding status across all connectors.OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to top-level resources.Onboarded - this resource has already been onboarded by the specified connector.NotOnboarded - this resource has not been onboarded to any connector.NotApplicable - the onboarding state is not applicable to the current endpoint.", + SerializedName = @"onboardingState", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.DoNotExport] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("NotApplicable", "OnboardedByOtherConnector", "Onboarded", "NotOnboarded")] + public string OnboardingState { get => _azureDevOpsOrgBody.OnboardingState ?? null; set => _azureDevOpsOrgBody.OnboardingState = value; } + + /// Backing field for property. + private string _orgName; + + /// The Azure DevOps organization name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The Azure DevOps organization name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The Azure DevOps organization name.", + SerializedName = @"orgName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string OrgName { get => this._orgName; set => this._orgName = value; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.HttpPipeline Pipeline { get; set; } + + /// + /// The provisioning state of the resource.Pending - Provisioning pending.Failed - Provisioning failed.Succeeded - Successful + /// provisioning.Canceled - Provisioning canceled.PendingDeletion - Deletion pending.DeletionSuccess - Deletion successful.DeletionFailure + /// - Deletion failure. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The provisioning state of the resource.Pending - Provisioning pending.Failed - Provisioning failed.Succeeded - Successful provisioning.Canceled - Provisioning canceled.PendingDeletion - Deletion pending.DeletionSuccess - Deletion successful.DeletionFailure - Deletion failure.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The provisioning state of the resource.Pending - Provisioning pending.Failed - Provisioning failed.Succeeded - Successful provisioning.Canceled - Provisioning canceled.PendingDeletion - Deletion pending.DeletionSuccess - Deletion successful.DeletionFailure - Deletion failure.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.DoNotExport] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Succeeded", "Failed", "Canceled", "Pending", "PendingDeletion", "DeletionSuccess", "DeletionFailure")] + public string ProvisioningState { get => _azureDevOpsOrgBody.ProvisioningState ?? null; set => _azureDevOpsOrgBody.ProvisioningState = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _securityConnectorName; + + /// The security connector name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The security connector name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The security connector name.", + SerializedName = @"securityConnectorName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string SecurityConnectorName { get => this._securityConnectorName; set => this._securityConnectorName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// Azure subscription ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure subscription ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure subscription ID", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrg + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of UpdateAzSecurityConnectorAzureDevOpsOrg_UpdateExpanded + public Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets.UpdateAzSecurityConnectorAzureDevOpsOrg_UpdateExpanded Clone() + { + var clone = new UpdateAzSecurityConnectorAzureDevOpsOrg_UpdateExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._azureDevOpsOrgBody = this._azureDevOpsOrgBody; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SecurityConnectorName = this.SecurityConnectorName; + clone.OrgName = this.OrgName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.DelayBeforePolling: + { + var data = messageData(); + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'AzureDevOpsOrgsUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + if (true == this.MyInvocation?.BoundParameters?.ContainsKey("OnboardingState")) + { + OnboardingState = (string)this.MyInvocation.BoundParameters["OnboardingState"]; + } + if (true == this.MyInvocation?.BoundParameters?.ContainsKey("ProvisioningState")) + { + ProvisioningState = (string)this.MyInvocation.BoundParameters["ProvisioningState"]; + } + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.AzureDevOpsOrgsUpdate(SubscriptionId, ResourceGroupName, SecurityConnectorName, OrgName, _azureDevOpsOrgBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeUpdate); + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,SecurityConnectorName=SecurityConnectorName,OrgName=OrgName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public UpdateAzSecurityConnectorAzureDevOpsOrg_UpdateExpanded() + { + + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrg + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrg + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/cmdlets/UpdateAzSecurityConnectorAzureDevOpsOrg_UpdateViaIdentityExpanded.cs b/src/Security/Security.Autorest/generated/cmdlets/UpdateAzSecurityConnectorAzureDevOpsOrg_UpdateViaIdentityExpanded.cs new file mode 100644 index 000000000000..cf5a6b0eab97 --- /dev/null +++ b/src/Security/Security.Autorest/generated/cmdlets/UpdateAzSecurityConnectorAzureDevOpsOrg_UpdateViaIdentityExpanded.cs @@ -0,0 +1,599 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Cmdlets; + using System; + + /// Updates monitored Azure DevOps organization details. + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzSecurityConnectorAzureDevOpsOrg_UpdateViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrg))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Description(@"Updates monitored Azure DevOps organization details.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}", ApiVersion = "2023-09-01-preview")] + public partial class UpdateAzSecurityConnectorAzureDevOpsOrg_UpdateViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// Azure DevOps Organization resource. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrg _azureDevOpsOrgBody = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsOrg(); + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Configuration payload for PR Annotations. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Configuration payload for PR Annotations.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Configuration payload for PR Annotations.", + SerializedName = @"actionableRemediation", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediation) })] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediation ActionableRemediation { get => _azureDevOpsOrgBody.ActionableRemediation ?? null /* object */; set => _azureDevOpsOrgBody.ActionableRemediation = value; } + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Security.Security Client => Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// Details about resource onboarding status across all connectors.OnboardedByOtherConnector - this resource has already been + /// onboarded to another connector. This is only applicable to top-level resources.Onboarded - this resource has already been + /// onboarded by the specified connector.NotOnboarded - this resource has not been onboarded to any connector.NotApplicable + /// - the onboarding state is not applicable to the current endpoint. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Details about resource onboarding status across all connectors.OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to top-level resources.Onboarded - this resource has already been onboarded by the specified connector.NotOnboarded - this resource has not been onboarded to any connector.NotApplicable - the onboarding state is not applicable to the current endpoint.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Details about resource onboarding status across all connectors.OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to top-level resources.Onboarded - this resource has already been onboarded by the specified connector.NotOnboarded - this resource has not been onboarded to any connector.NotApplicable - the onboarding state is not applicable to the current endpoint.", + SerializedName = @"onboardingState", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.DoNotExport] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("NotApplicable", "OnboardedByOtherConnector", "Onboarded", "NotOnboarded")] + public string OnboardingState { get => _azureDevOpsOrgBody.OnboardingState ?? null; set => _azureDevOpsOrgBody.OnboardingState = value; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.HttpPipeline Pipeline { get; set; } + + /// + /// The provisioning state of the resource.Pending - Provisioning pending.Failed - Provisioning failed.Succeeded - Successful + /// provisioning.Canceled - Provisioning canceled.PendingDeletion - Deletion pending.DeletionSuccess - Deletion successful.DeletionFailure + /// - Deletion failure. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The provisioning state of the resource.Pending - Provisioning pending.Failed - Provisioning failed.Succeeded - Successful provisioning.Canceled - Provisioning canceled.PendingDeletion - Deletion pending.DeletionSuccess - Deletion successful.DeletionFailure - Deletion failure.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The provisioning state of the resource.Pending - Provisioning pending.Failed - Provisioning failed.Succeeded - Successful provisioning.Canceled - Provisioning canceled.PendingDeletion - Deletion pending.DeletionSuccess - Deletion successful.DeletionFailure - Deletion failure.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.DoNotExport] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Succeeded", "Failed", "Canceled", "Pending", "PendingDeletion", "DeletionSuccess", "DeletionFailure")] + public string ProvisioningState { get => _azureDevOpsOrgBody.ProvisioningState ?? null; set => _azureDevOpsOrgBody.ProvisioningState = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrg + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of UpdateAzSecurityConnectorAzureDevOpsOrg_UpdateViaIdentityExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets.UpdateAzSecurityConnectorAzureDevOpsOrg_UpdateViaIdentityExpanded Clone() + { + var clone = new UpdateAzSecurityConnectorAzureDevOpsOrg_UpdateViaIdentityExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._azureDevOpsOrgBody = this._azureDevOpsOrgBody; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.DelayBeforePolling: + { + var data = messageData(); + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'AzureDevOpsOrgsUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + if (true == this.MyInvocation?.BoundParameters?.ContainsKey("OnboardingState")) + { + OnboardingState = (string)this.MyInvocation.BoundParameters["OnboardingState"]; + } + if (true == this.MyInvocation?.BoundParameters?.ContainsKey("ProvisioningState")) + { + ProvisioningState = (string)this.MyInvocation.BoundParameters["ProvisioningState"]; + } + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.AzureDevOpsOrgsUpdateViaIdentity(InputObject.Id, _azureDevOpsOrgBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeUpdate); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SecurityConnectorName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SecurityConnectorName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.OrgName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.OrgName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.AzureDevOpsOrgsUpdate(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.SecurityConnectorName ?? null, InputObject.OrgName ?? null, _azureDevOpsOrgBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeUpdate); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Initializes a new instance of the cmdlet + /// class. + /// + public UpdateAzSecurityConnectorAzureDevOpsOrg_UpdateViaIdentityExpanded() + { + + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrg + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrg + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/cmdlets/UpdateAzSecurityConnectorAzureDevOpsProject_UpdateExpanded.cs b/src/Security/Security.Autorest/generated/cmdlets/UpdateAzSecurityConnectorAzureDevOpsProject_UpdateExpanded.cs new file mode 100644 index 000000000000..4e65342f6778 --- /dev/null +++ b/src/Security/Security.Autorest/generated/cmdlets/UpdateAzSecurityConnectorAzureDevOpsProject_UpdateExpanded.cs @@ -0,0 +1,657 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Cmdlets; + using System; + + /// Updates a monitored Azure DevOps project resource. + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}/projects/{projectName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzSecurityConnectorAzureDevOpsProject_UpdateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProject))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Description(@"Updates a monitored Azure DevOps project resource.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}/projects/{projectName}", ApiVersion = "2023-09-01-preview")] + public partial class UpdateAzSecurityConnectorAzureDevOpsProject_UpdateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// Azure DevOps Project resource. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProject _azureDevOpsProjectBody = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsProject(); + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Configuration payload for PR Annotations. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Configuration payload for PR Annotations.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Configuration payload for PR Annotations.", + SerializedName = @"actionableRemediation", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediation) })] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediation ActionableRemediation { get => _azureDevOpsProjectBody.ActionableRemediation ?? null /* object */; set => _azureDevOpsProjectBody.ActionableRemediation = value; } + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Security.Security Client => Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// Details about resource onboarding status across all connectors.OnboardedByOtherConnector - this resource has already been + /// onboarded to another connector. This is only applicable to top-level resources.Onboarded - this resource has already been + /// onboarded by the specified connector.NotOnboarded - this resource has not been onboarded to any connector.NotApplicable + /// - the onboarding state is not applicable to the current endpoint. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Details about resource onboarding status across all connectors.OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to top-level resources.Onboarded - this resource has already been onboarded by the specified connector.NotOnboarded - this resource has not been onboarded to any connector.NotApplicable - the onboarding state is not applicable to the current endpoint.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Details about resource onboarding status across all connectors.OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to top-level resources.Onboarded - this resource has already been onboarded by the specified connector.NotOnboarded - this resource has not been onboarded to any connector.NotApplicable - the onboarding state is not applicable to the current endpoint.", + SerializedName = @"onboardingState", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.DoNotExport] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("NotApplicable", "OnboardedByOtherConnector", "Onboarded", "NotOnboarded")] + public string OnboardingState { get => _azureDevOpsProjectBody.OnboardingState ?? null; set => _azureDevOpsProjectBody.OnboardingState = value; } + + /// Backing field for property. + private string _orgName; + + /// The Azure DevOps organization name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The Azure DevOps organization name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The Azure DevOps organization name.", + SerializedName = @"orgName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string OrgName { get => this._orgName; set => this._orgName = value; } + + /// Gets or sets parent Azure DevOps Organization name. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets parent Azure DevOps Organization name.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets parent Azure DevOps Organization name.", + SerializedName = @"parentOrgName", + PossibleTypes = new [] { typeof(string) })] + public string ParentOrgName { get => _azureDevOpsProjectBody.ParentOrgName ?? null; set => _azureDevOpsProjectBody.ParentOrgName = value; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _projectName; + + /// The project name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The project name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The project name.", + SerializedName = @"projectName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string ProjectName { get => this._projectName; set => this._projectName = value; } + + /// + /// The provisioning state of the resource.Pending - Provisioning pending.Failed - Provisioning failed.Succeeded - Successful + /// provisioning.Canceled - Provisioning canceled.PendingDeletion - Deletion pending.DeletionSuccess - Deletion successful.DeletionFailure + /// - Deletion failure. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The provisioning state of the resource.Pending - Provisioning pending.Failed - Provisioning failed.Succeeded - Successful provisioning.Canceled - Provisioning canceled.PendingDeletion - Deletion pending.DeletionSuccess - Deletion successful.DeletionFailure - Deletion failure.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The provisioning state of the resource.Pending - Provisioning pending.Failed - Provisioning failed.Succeeded - Successful provisioning.Canceled - Provisioning canceled.PendingDeletion - Deletion pending.DeletionSuccess - Deletion successful.DeletionFailure - Deletion failure.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.DoNotExport] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Succeeded", "Failed", "Canceled", "Pending", "PendingDeletion", "DeletionSuccess", "DeletionFailure")] + public string ProvisioningState { get => _azureDevOpsProjectBody.ProvisioningState ?? null; set => _azureDevOpsProjectBody.ProvisioningState = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _securityConnectorName; + + /// The security connector name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The security connector name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The security connector name.", + SerializedName = @"securityConnectorName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string SecurityConnectorName { get => this._securityConnectorName; set => this._securityConnectorName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// Azure subscription ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure subscription ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure subscription ID", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProject + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of UpdateAzSecurityConnectorAzureDevOpsProject_UpdateExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets.UpdateAzSecurityConnectorAzureDevOpsProject_UpdateExpanded Clone() + { + var clone = new UpdateAzSecurityConnectorAzureDevOpsProject_UpdateExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._azureDevOpsProjectBody = this._azureDevOpsProjectBody; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SecurityConnectorName = this.SecurityConnectorName; + clone.OrgName = this.OrgName; + clone.ProjectName = this.ProjectName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.DelayBeforePolling: + { + var data = messageData(); + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'AzureDevOpsProjectsUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + if (true == this.MyInvocation?.BoundParameters?.ContainsKey("OnboardingState")) + { + OnboardingState = (string)this.MyInvocation.BoundParameters["OnboardingState"]; + } + if (true == this.MyInvocation?.BoundParameters?.ContainsKey("ProvisioningState")) + { + ProvisioningState = (string)this.MyInvocation.BoundParameters["ProvisioningState"]; + } + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.AzureDevOpsProjectsUpdate(SubscriptionId, ResourceGroupName, SecurityConnectorName, OrgName, ProjectName, _azureDevOpsProjectBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeUpdate); + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,SecurityConnectorName=SecurityConnectorName,OrgName=OrgName,ProjectName=ProjectName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public UpdateAzSecurityConnectorAzureDevOpsProject_UpdateExpanded() + { + + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProject + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProject + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/cmdlets/UpdateAzSecurityConnectorAzureDevOpsProject_UpdateViaIdentityExpanded.cs b/src/Security/Security.Autorest/generated/cmdlets/UpdateAzSecurityConnectorAzureDevOpsProject_UpdateViaIdentityExpanded.cs new file mode 100644 index 000000000000..793d39e25ce5 --- /dev/null +++ b/src/Security/Security.Autorest/generated/cmdlets/UpdateAzSecurityConnectorAzureDevOpsProject_UpdateViaIdentityExpanded.cs @@ -0,0 +1,614 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Cmdlets; + using System; + + /// Updates a monitored Azure DevOps project resource. + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}/projects/{projectName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzSecurityConnectorAzureDevOpsProject_UpdateViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProject))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Description(@"Updates a monitored Azure DevOps project resource.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}/projects/{projectName}", ApiVersion = "2023-09-01-preview")] + public partial class UpdateAzSecurityConnectorAzureDevOpsProject_UpdateViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// Azure DevOps Project resource. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProject _azureDevOpsProjectBody = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsProject(); + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Configuration payload for PR Annotations. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Configuration payload for PR Annotations.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Configuration payload for PR Annotations.", + SerializedName = @"actionableRemediation", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediation) })] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediation ActionableRemediation { get => _azureDevOpsProjectBody.ActionableRemediation ?? null /* object */; set => _azureDevOpsProjectBody.ActionableRemediation = value; } + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Security.Security Client => Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// Details about resource onboarding status across all connectors.OnboardedByOtherConnector - this resource has already been + /// onboarded to another connector. This is only applicable to top-level resources.Onboarded - this resource has already been + /// onboarded by the specified connector.NotOnboarded - this resource has not been onboarded to any connector.NotApplicable + /// - the onboarding state is not applicable to the current endpoint. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Details about resource onboarding status across all connectors.OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to top-level resources.Onboarded - this resource has already been onboarded by the specified connector.NotOnboarded - this resource has not been onboarded to any connector.NotApplicable - the onboarding state is not applicable to the current endpoint.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Details about resource onboarding status across all connectors.OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to top-level resources.Onboarded - this resource has already been onboarded by the specified connector.NotOnboarded - this resource has not been onboarded to any connector.NotApplicable - the onboarding state is not applicable to the current endpoint.", + SerializedName = @"onboardingState", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.DoNotExport] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("NotApplicable", "OnboardedByOtherConnector", "Onboarded", "NotOnboarded")] + public string OnboardingState { get => _azureDevOpsProjectBody.OnboardingState ?? null; set => _azureDevOpsProjectBody.OnboardingState = value; } + + /// Gets or sets parent Azure DevOps Organization name. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets parent Azure DevOps Organization name.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets parent Azure DevOps Organization name.", + SerializedName = @"parentOrgName", + PossibleTypes = new [] { typeof(string) })] + public string ParentOrgName { get => _azureDevOpsProjectBody.ParentOrgName ?? null; set => _azureDevOpsProjectBody.ParentOrgName = value; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.HttpPipeline Pipeline { get; set; } + + /// + /// The provisioning state of the resource.Pending - Provisioning pending.Failed - Provisioning failed.Succeeded - Successful + /// provisioning.Canceled - Provisioning canceled.PendingDeletion - Deletion pending.DeletionSuccess - Deletion successful.DeletionFailure + /// - Deletion failure. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The provisioning state of the resource.Pending - Provisioning pending.Failed - Provisioning failed.Succeeded - Successful provisioning.Canceled - Provisioning canceled.PendingDeletion - Deletion pending.DeletionSuccess - Deletion successful.DeletionFailure - Deletion failure.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The provisioning state of the resource.Pending - Provisioning pending.Failed - Provisioning failed.Succeeded - Successful provisioning.Canceled - Provisioning canceled.PendingDeletion - Deletion pending.DeletionSuccess - Deletion successful.DeletionFailure - Deletion failure.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.DoNotExport] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Succeeded", "Failed", "Canceled", "Pending", "PendingDeletion", "DeletionSuccess", "DeletionFailure")] + public string ProvisioningState { get => _azureDevOpsProjectBody.ProvisioningState ?? null; set => _azureDevOpsProjectBody.ProvisioningState = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProject + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of UpdateAzSecurityConnectorAzureDevOpsProject_UpdateViaIdentityExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets.UpdateAzSecurityConnectorAzureDevOpsProject_UpdateViaIdentityExpanded Clone() + { + var clone = new UpdateAzSecurityConnectorAzureDevOpsProject_UpdateViaIdentityExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._azureDevOpsProjectBody = this._azureDevOpsProjectBody; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.DelayBeforePolling: + { + var data = messageData(); + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'AzureDevOpsProjectsUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + if (true == this.MyInvocation?.BoundParameters?.ContainsKey("OnboardingState")) + { + OnboardingState = (string)this.MyInvocation.BoundParameters["OnboardingState"]; + } + if (true == this.MyInvocation?.BoundParameters?.ContainsKey("ProvisioningState")) + { + ProvisioningState = (string)this.MyInvocation.BoundParameters["ProvisioningState"]; + } + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.AzureDevOpsProjectsUpdateViaIdentity(InputObject.Id, _azureDevOpsProjectBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeUpdate); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SecurityConnectorName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SecurityConnectorName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.OrgName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.OrgName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProjectName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProjectName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.AzureDevOpsProjectsUpdate(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.SecurityConnectorName ?? null, InputObject.OrgName ?? null, InputObject.ProjectName ?? null, _azureDevOpsProjectBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeUpdate); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Initializes a new instance of the + /// cmdlet class. + /// + public UpdateAzSecurityConnectorAzureDevOpsProject_UpdateViaIdentityExpanded() + { + + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProject + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProject + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/cmdlets/UpdateAzSecurityConnectorAzureDevOpsRepo_UpdateExpanded.cs b/src/Security/Security.Autorest/generated/cmdlets/UpdateAzSecurityConnectorAzureDevOpsRepo_UpdateExpanded.cs new file mode 100644 index 000000000000..276e5d4dd9cb --- /dev/null +++ b/src/Security/Security.Autorest/generated/cmdlets/UpdateAzSecurityConnectorAzureDevOpsRepo_UpdateExpanded.cs @@ -0,0 +1,681 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Cmdlets; + using System; + + /// Updates a monitored Azure DevOps repository resource. + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}/projects/{projectName}/repos/{repoName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzSecurityConnectorAzureDevOpsRepo_UpdateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepository))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Description(@"Updates a monitored Azure DevOps repository resource.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}/projects/{projectName}/repos/{repoName}", ApiVersion = "2023-09-01-preview")] + public partial class UpdateAzSecurityConnectorAzureDevOpsRepo_UpdateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// Azure DevOps Repository resource. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepository _azureDevOpsRepositoryBody = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsRepository(); + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Configuration payload for PR Annotations. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Configuration payload for PR Annotations.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Configuration payload for PR Annotations.", + SerializedName = @"actionableRemediation", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediation) })] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediation ActionableRemediation { get => _azureDevOpsRepositoryBody.ActionableRemediation ?? null /* object */; set => _azureDevOpsRepositoryBody.ActionableRemediation = value; } + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Security.Security Client => Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// Details about resource onboarding status across all connectors.OnboardedByOtherConnector - this resource has already been + /// onboarded to another connector. This is only applicable to top-level resources.Onboarded - this resource has already been + /// onboarded by the specified connector.NotOnboarded - this resource has not been onboarded to any connector.NotApplicable + /// - the onboarding state is not applicable to the current endpoint. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Details about resource onboarding status across all connectors.OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to top-level resources.Onboarded - this resource has already been onboarded by the specified connector.NotOnboarded - this resource has not been onboarded to any connector.NotApplicable - the onboarding state is not applicable to the current endpoint.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Details about resource onboarding status across all connectors.OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to top-level resources.Onboarded - this resource has already been onboarded by the specified connector.NotOnboarded - this resource has not been onboarded to any connector.NotApplicable - the onboarding state is not applicable to the current endpoint.", + SerializedName = @"onboardingState", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.DoNotExport] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("NotApplicable", "OnboardedByOtherConnector", "Onboarded", "NotOnboarded")] + public string OnboardingState { get => _azureDevOpsRepositoryBody.OnboardingState ?? null; set => _azureDevOpsRepositoryBody.OnboardingState = value; } + + /// Backing field for property. + private string _orgName; + + /// The Azure DevOps organization name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The Azure DevOps organization name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The Azure DevOps organization name.", + SerializedName = @"orgName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string OrgName { get => this._orgName; set => this._orgName = value; } + + /// Gets or sets parent Azure DevOps Organization name. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets parent Azure DevOps Organization name.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets parent Azure DevOps Organization name.", + SerializedName = @"parentOrgName", + PossibleTypes = new [] { typeof(string) })] + public string ParentOrgName { get => _azureDevOpsRepositoryBody.ParentOrgName ?? null; set => _azureDevOpsRepositoryBody.ParentOrgName = value; } + + /// Gets or sets parent Azure DevOps Project name. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets parent Azure DevOps Project name.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets parent Azure DevOps Project name.", + SerializedName = @"parentProjectName", + PossibleTypes = new [] { typeof(string) })] + public string ParentProjectName { get => _azureDevOpsRepositoryBody.ParentProjectName ?? null; set => _azureDevOpsRepositoryBody.ParentProjectName = value; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _projectName; + + /// The project name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The project name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The project name.", + SerializedName = @"projectName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string ProjectName { get => this._projectName; set => this._projectName = value; } + + /// + /// The provisioning state of the resource.Pending - Provisioning pending.Failed - Provisioning failed.Succeeded - Successful + /// provisioning.Canceled - Provisioning canceled.PendingDeletion - Deletion pending.DeletionSuccess - Deletion successful.DeletionFailure + /// - Deletion failure. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The provisioning state of the resource.Pending - Provisioning pending.Failed - Provisioning failed.Succeeded - Successful provisioning.Canceled - Provisioning canceled.PendingDeletion - Deletion pending.DeletionSuccess - Deletion successful.DeletionFailure - Deletion failure.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The provisioning state of the resource.Pending - Provisioning pending.Failed - Provisioning failed.Succeeded - Successful provisioning.Canceled - Provisioning canceled.PendingDeletion - Deletion pending.DeletionSuccess - Deletion successful.DeletionFailure - Deletion failure.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.DoNotExport] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Succeeded", "Failed", "Canceled", "Pending", "PendingDeletion", "DeletionSuccess", "DeletionFailure")] + public string ProvisioningState { get => _azureDevOpsRepositoryBody.ProvisioningState ?? null; set => _azureDevOpsRepositoryBody.ProvisioningState = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _repoName; + + /// The repository name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The repository name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The repository name.", + SerializedName = @"repoName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string RepoName { get => this._repoName; set => this._repoName = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _securityConnectorName; + + /// The security connector name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The security connector name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The security connector name.", + SerializedName = @"securityConnectorName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string SecurityConnectorName { get => this._securityConnectorName; set => this._securityConnectorName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// Azure subscription ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure subscription ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure subscription ID", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepository + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of UpdateAzSecurityConnectorAzureDevOpsRepo_UpdateExpanded + public Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets.UpdateAzSecurityConnectorAzureDevOpsRepo_UpdateExpanded Clone() + { + var clone = new UpdateAzSecurityConnectorAzureDevOpsRepo_UpdateExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._azureDevOpsRepositoryBody = this._azureDevOpsRepositoryBody; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SecurityConnectorName = this.SecurityConnectorName; + clone.OrgName = this.OrgName; + clone.ProjectName = this.ProjectName; + clone.RepoName = this.RepoName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.DelayBeforePolling: + { + var data = messageData(); + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'AzureDevOpsReposUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + if (true == this.MyInvocation?.BoundParameters?.ContainsKey("OnboardingState")) + { + OnboardingState = (string)this.MyInvocation.BoundParameters["OnboardingState"]; + } + if (true == this.MyInvocation?.BoundParameters?.ContainsKey("ProvisioningState")) + { + ProvisioningState = (string)this.MyInvocation.BoundParameters["ProvisioningState"]; + } + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.AzureDevOpsReposUpdate(SubscriptionId, ResourceGroupName, SecurityConnectorName, OrgName, ProjectName, RepoName, _azureDevOpsRepositoryBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeUpdate); + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,SecurityConnectorName=SecurityConnectorName,OrgName=OrgName,ProjectName=ProjectName,RepoName=RepoName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public UpdateAzSecurityConnectorAzureDevOpsRepo_UpdateExpanded() + { + + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepository + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepository + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/cmdlets/UpdateAzSecurityConnectorAzureDevOpsRepo_UpdateViaIdentityExpanded.cs b/src/Security/Security.Autorest/generated/cmdlets/UpdateAzSecurityConnectorAzureDevOpsRepo_UpdateViaIdentityExpanded.cs new file mode 100644 index 000000000000..8a4be3342dd9 --- /dev/null +++ b/src/Security/Security.Autorest/generated/cmdlets/UpdateAzSecurityConnectorAzureDevOpsRepo_UpdateViaIdentityExpanded.cs @@ -0,0 +1,629 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Cmdlets; + using System; + + /// Updates a monitored Azure DevOps repository resource. + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}/projects/{projectName}/repos/{repoName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzSecurityConnectorAzureDevOpsRepo_UpdateViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepository))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Description(@"Updates a monitored Azure DevOps repository resource.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}/projects/{projectName}/repos/{repoName}", ApiVersion = "2023-09-01-preview")] + public partial class UpdateAzSecurityConnectorAzureDevOpsRepo_UpdateViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// Azure DevOps Repository resource. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepository _azureDevOpsRepositoryBody = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsRepository(); + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Configuration payload for PR Annotations. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Configuration payload for PR Annotations.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Configuration payload for PR Annotations.", + SerializedName = @"actionableRemediation", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediation) })] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediation ActionableRemediation { get => _azureDevOpsRepositoryBody.ActionableRemediation ?? null /* object */; set => _azureDevOpsRepositoryBody.ActionableRemediation = value; } + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Security.Security Client => Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// Details about resource onboarding status across all connectors.OnboardedByOtherConnector - this resource has already been + /// onboarded to another connector. This is only applicable to top-level resources.Onboarded - this resource has already been + /// onboarded by the specified connector.NotOnboarded - this resource has not been onboarded to any connector.NotApplicable + /// - the onboarding state is not applicable to the current endpoint. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Details about resource onboarding status across all connectors.OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to top-level resources.Onboarded - this resource has already been onboarded by the specified connector.NotOnboarded - this resource has not been onboarded to any connector.NotApplicable - the onboarding state is not applicable to the current endpoint.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Details about resource onboarding status across all connectors.OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to top-level resources.Onboarded - this resource has already been onboarded by the specified connector.NotOnboarded - this resource has not been onboarded to any connector.NotApplicable - the onboarding state is not applicable to the current endpoint.", + SerializedName = @"onboardingState", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.DoNotExport] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("NotApplicable", "OnboardedByOtherConnector", "Onboarded", "NotOnboarded")] + public string OnboardingState { get => _azureDevOpsRepositoryBody.OnboardingState ?? null; set => _azureDevOpsRepositoryBody.OnboardingState = value; } + + /// Gets or sets parent Azure DevOps Organization name. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets parent Azure DevOps Organization name.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets parent Azure DevOps Organization name.", + SerializedName = @"parentOrgName", + PossibleTypes = new [] { typeof(string) })] + public string ParentOrgName { get => _azureDevOpsRepositoryBody.ParentOrgName ?? null; set => _azureDevOpsRepositoryBody.ParentOrgName = value; } + + /// Gets or sets parent Azure DevOps Project name. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets parent Azure DevOps Project name.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets parent Azure DevOps Project name.", + SerializedName = @"parentProjectName", + PossibleTypes = new [] { typeof(string) })] + public string ParentProjectName { get => _azureDevOpsRepositoryBody.ParentProjectName ?? null; set => _azureDevOpsRepositoryBody.ParentProjectName = value; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.HttpPipeline Pipeline { get; set; } + + /// + /// The provisioning state of the resource.Pending - Provisioning pending.Failed - Provisioning failed.Succeeded - Successful + /// provisioning.Canceled - Provisioning canceled.PendingDeletion - Deletion pending.DeletionSuccess - Deletion successful.DeletionFailure + /// - Deletion failure. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The provisioning state of the resource.Pending - Provisioning pending.Failed - Provisioning failed.Succeeded - Successful provisioning.Canceled - Provisioning canceled.PendingDeletion - Deletion pending.DeletionSuccess - Deletion successful.DeletionFailure - Deletion failure.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The provisioning state of the resource.Pending - Provisioning pending.Failed - Provisioning failed.Succeeded - Successful provisioning.Canceled - Provisioning canceled.PendingDeletion - Deletion pending.DeletionSuccess - Deletion successful.DeletionFailure - Deletion failure.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.DoNotExport] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Succeeded", "Failed", "Canceled", "Pending", "PendingDeletion", "DeletionSuccess", "DeletionFailure")] + public string ProvisioningState { get => _azureDevOpsRepositoryBody.ProvisioningState ?? null; set => _azureDevOpsRepositoryBody.ProvisioningState = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepository + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of UpdateAzSecurityConnectorAzureDevOpsRepo_UpdateViaIdentityExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets.UpdateAzSecurityConnectorAzureDevOpsRepo_UpdateViaIdentityExpanded Clone() + { + var clone = new UpdateAzSecurityConnectorAzureDevOpsRepo_UpdateViaIdentityExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._azureDevOpsRepositoryBody = this._azureDevOpsRepositoryBody; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.DelayBeforePolling: + { + var data = messageData(); + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'AzureDevOpsReposUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + if (true == this.MyInvocation?.BoundParameters?.ContainsKey("OnboardingState")) + { + OnboardingState = (string)this.MyInvocation.BoundParameters["OnboardingState"]; + } + if (true == this.MyInvocation?.BoundParameters?.ContainsKey("ProvisioningState")) + { + ProvisioningState = (string)this.MyInvocation.BoundParameters["ProvisioningState"]; + } + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.AzureDevOpsReposUpdateViaIdentity(InputObject.Id, _azureDevOpsRepositoryBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeUpdate); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SecurityConnectorName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SecurityConnectorName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.OrgName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.OrgName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProjectName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProjectName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.RepoName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.RepoName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.AzureDevOpsReposUpdate(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.SecurityConnectorName ?? null, InputObject.OrgName ?? null, InputObject.ProjectName ?? null, InputObject.RepoName ?? null, _azureDevOpsRepositoryBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeUpdate); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Initializes a new instance of the cmdlet + /// class. + /// + public UpdateAzSecurityConnectorAzureDevOpsRepo_UpdateViaIdentityExpanded() + { + + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepository + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepository + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/cmdlets/UpdateAzSecurityConnectorDevOpsConfiguration_UpdateExpanded.cs b/src/Security/Security.Autorest/generated/cmdlets/UpdateAzSecurityConnectorDevOpsConfiguration_UpdateExpanded.cs new file mode 100644 index 000000000000..da75bb5a1204 --- /dev/null +++ b/src/Security/Security.Autorest/generated/cmdlets/UpdateAzSecurityConnectorDevOpsConfiguration_UpdateExpanded.cs @@ -0,0 +1,623 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Cmdlets; + using System; + + /// Updates a DevOps Configuration. + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzSecurityConnectorDevOpsConfiguration_UpdateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfiguration))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Description(@"Updates a DevOps Configuration.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default", ApiVersion = "2023-09-01-preview")] + public partial class UpdateAzSecurityConnectorDevOpsConfiguration_UpdateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// DevOps Configuration resource. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfiguration _devOpsConfigurationBody = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DevOpsConfiguration(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// + /// Gets or sets one-time OAuth code to exchange for refresh and access tokens.Only used during PUT/PATCH operations. The + /// secret is cleared during GET. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets one-time OAuth code to exchange for refresh and access tokens.Only used during PUT/PATCH operations. The secret is cleared during GET.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets one-time OAuth code to exchange for refresh and access tokens.Only used during PUT/PATCH operations. The secret is cleared during GET.", + SerializedName = @"code", + PossibleTypes = new [] { typeof(string) })] + public string AuthorizationCode { get => _devOpsConfigurationBody.AuthorizationCode ?? null; set => _devOpsConfigurationBody.AuthorizationCode = value; } + + /// AutoDiscovery states. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "AutoDiscovery states.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"AutoDiscovery states.", + SerializedName = @"autoDiscovery", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Disabled", "Enabled", "NotApplicable")] + public string AutoDiscovery { get => _devOpsConfigurationBody.AutoDiscovery ?? null; set => _devOpsConfigurationBody.AutoDiscovery = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Security.Security Client => Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.HttpPipeline Pipeline { get; set; } + + /// + /// The provisioning state of the resource.Pending - Provisioning pending.Failed - Provisioning failed.Succeeded - Successful + /// provisioning.Canceled - Provisioning canceled.PendingDeletion - Deletion pending.DeletionSuccess - Deletion successful.DeletionFailure + /// - Deletion failure. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The provisioning state of the resource.Pending - Provisioning pending.Failed - Provisioning failed.Succeeded - Successful provisioning.Canceled - Provisioning canceled.PendingDeletion - Deletion pending.DeletionSuccess - Deletion successful.DeletionFailure - Deletion failure.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The provisioning state of the resource.Pending - Provisioning pending.Failed - Provisioning failed.Succeeded - Successful provisioning.Canceled - Provisioning canceled.PendingDeletion - Deletion pending.DeletionSuccess - Deletion successful.DeletionFailure - Deletion failure.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.DoNotExport] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Succeeded", "Failed", "Canceled", "Pending", "PendingDeletion", "DeletionSuccess", "DeletionFailure")] + public string ProvisioningState { get => _devOpsConfigurationBody.ProvisioningState ?? null; set => _devOpsConfigurationBody.ProvisioningState = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _securityConnectorName; + + /// The security connector name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The security connector name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The security connector name.", + SerializedName = @"securityConnectorName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string SecurityConnectorName { get => this._securityConnectorName; set => this._securityConnectorName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// Azure subscription ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure subscription ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure subscription ID", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// List of top-level inventory to select when AutoDiscovery is disabled.This field is ignored when AutoDiscovery is enabled. + /// + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "List of top-level inventory to select when AutoDiscovery is disabled.This field is ignored when AutoDiscovery is enabled.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"List of top-level inventory to select when AutoDiscovery is disabled.This field is ignored when AutoDiscovery is enabled.", + SerializedName = @"topLevelInventoryList", + PossibleTypes = new [] { typeof(string) })] + public string[] TopLevelInventoryList { get => _devOpsConfigurationBody.TopLevelInventoryList?.ToArray() ?? null /* fixedArrayOf */; set => _devOpsConfigurationBody.TopLevelInventoryList = (value != null ? new System.Collections.Generic.List(value) : null); } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfiguration + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of UpdateAzSecurityConnectorDevOpsConfiguration_UpdateExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets.UpdateAzSecurityConnectorDevOpsConfiguration_UpdateExpanded Clone() + { + var clone = new UpdateAzSecurityConnectorDevOpsConfiguration_UpdateExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._devOpsConfigurationBody = this._devOpsConfigurationBody; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SecurityConnectorName = this.SecurityConnectorName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.DelayBeforePolling: + { + var data = messageData(); + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'DevOpsConfigurationsUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + if (true == this.MyInvocation?.BoundParameters?.ContainsKey("ProvisioningState")) + { + ProvisioningState = (string)this.MyInvocation.BoundParameters["ProvisioningState"]; + } + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.DevOpsConfigurationsUpdate(SubscriptionId, ResourceGroupName, SecurityConnectorName, _devOpsConfigurationBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeUpdate); + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,SecurityConnectorName=SecurityConnectorName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public UpdateAzSecurityConnectorDevOpsConfiguration_UpdateExpanded() + { + + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfiguration + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfiguration + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/cmdlets/UpdateAzSecurityConnectorDevOpsConfiguration_UpdateViaIdentityExpanded.cs b/src/Security/Security.Autorest/generated/cmdlets/UpdateAzSecurityConnectorDevOpsConfiguration_UpdateViaIdentityExpanded.cs new file mode 100644 index 000000000000..77a132ec683a --- /dev/null +++ b/src/Security/Security.Autorest/generated/cmdlets/UpdateAzSecurityConnectorDevOpsConfiguration_UpdateViaIdentityExpanded.cs @@ -0,0 +1,602 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Cmdlets; + using System; + + /// Updates a DevOps Configuration. + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzSecurityConnectorDevOpsConfiguration_UpdateViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfiguration))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Description(@"Updates a DevOps Configuration.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default", ApiVersion = "2023-09-01-preview")] + public partial class UpdateAzSecurityConnectorDevOpsConfiguration_UpdateViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// DevOps Configuration resource. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfiguration _devOpsConfigurationBody = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DevOpsConfiguration(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// + /// Gets or sets one-time OAuth code to exchange for refresh and access tokens.Only used during PUT/PATCH operations. The + /// secret is cleared during GET. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets one-time OAuth code to exchange for refresh and access tokens.Only used during PUT/PATCH operations. The secret is cleared during GET.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets one-time OAuth code to exchange for refresh and access tokens.Only used during PUT/PATCH operations. The secret is cleared during GET.", + SerializedName = @"code", + PossibleTypes = new [] { typeof(string) })] + public string AuthorizationCode { get => _devOpsConfigurationBody.AuthorizationCode ?? null; set => _devOpsConfigurationBody.AuthorizationCode = value; } + + /// AutoDiscovery states. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "AutoDiscovery states.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"AutoDiscovery states.", + SerializedName = @"autoDiscovery", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Disabled", "Enabled", "NotApplicable")] + public string AutoDiscovery { get => _devOpsConfigurationBody.AutoDiscovery ?? null; set => _devOpsConfigurationBody.AutoDiscovery = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Security.Security Client => Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.HttpPipeline Pipeline { get; set; } + + /// + /// The provisioning state of the resource.Pending - Provisioning pending.Failed - Provisioning failed.Succeeded - Successful + /// provisioning.Canceled - Provisioning canceled.PendingDeletion - Deletion pending.DeletionSuccess - Deletion successful.DeletionFailure + /// - Deletion failure. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The provisioning state of the resource.Pending - Provisioning pending.Failed - Provisioning failed.Succeeded - Successful provisioning.Canceled - Provisioning canceled.PendingDeletion - Deletion pending.DeletionSuccess - Deletion successful.DeletionFailure - Deletion failure.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The provisioning state of the resource.Pending - Provisioning pending.Failed - Provisioning failed.Succeeded - Successful provisioning.Canceled - Provisioning canceled.PendingDeletion - Deletion pending.DeletionSuccess - Deletion successful.DeletionFailure - Deletion failure.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.DoNotExport] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Succeeded", "Failed", "Canceled", "Pending", "PendingDeletion", "DeletionSuccess", "DeletionFailure")] + public string ProvisioningState { get => _devOpsConfigurationBody.ProvisioningState ?? null; set => _devOpsConfigurationBody.ProvisioningState = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// List of top-level inventory to select when AutoDiscovery is disabled.This field is ignored when AutoDiscovery is enabled. + /// + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "List of top-level inventory to select when AutoDiscovery is disabled.This field is ignored when AutoDiscovery is enabled.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"List of top-level inventory to select when AutoDiscovery is disabled.This field is ignored when AutoDiscovery is enabled.", + SerializedName = @"topLevelInventoryList", + PossibleTypes = new [] { typeof(string) })] + public string[] TopLevelInventoryList { get => _devOpsConfigurationBody.TopLevelInventoryList?.ToArray() ?? null /* fixedArrayOf */; set => _devOpsConfigurationBody.TopLevelInventoryList = (value != null ? new System.Collections.Generic.List(value) : null); } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfiguration + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of UpdateAzSecurityConnectorDevOpsConfiguration_UpdateViaIdentityExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets.UpdateAzSecurityConnectorDevOpsConfiguration_UpdateViaIdentityExpanded Clone() + { + var clone = new UpdateAzSecurityConnectorDevOpsConfiguration_UpdateViaIdentityExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._devOpsConfigurationBody = this._devOpsConfigurationBody; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.DelayBeforePolling: + { + var data = messageData(); + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'DevOpsConfigurationsUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + if (true == this.MyInvocation?.BoundParameters?.ContainsKey("ProvisioningState")) + { + ProvisioningState = (string)this.MyInvocation.BoundParameters["ProvisioningState"]; + } + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.DevOpsConfigurationsUpdateViaIdentity(InputObject.Id, _devOpsConfigurationBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeUpdate); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SecurityConnectorName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SecurityConnectorName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.DevOpsConfigurationsUpdate(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.SecurityConnectorName ?? null, _devOpsConfigurationBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeUpdate); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Initializes a new instance of the + /// cmdlet class. + /// + public UpdateAzSecurityConnectorDevOpsConfiguration_UpdateViaIdentityExpanded() + { + + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfiguration + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfiguration + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/cmdlets/UpdateAzSecurityConnector_UpdateExpanded.cs b/src/Security/Security.Autorest/generated/cmdlets/UpdateAzSecurityConnector_UpdateExpanded.cs new file mode 100644 index 000000000000..b9fe7e4e3e35 --- /dev/null +++ b/src/Security/Security.Autorest/generated/cmdlets/UpdateAzSecurityConnector_UpdateExpanded.cs @@ -0,0 +1,575 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Cmdlets; + using System; + + /// Updates a security connector + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzSecurityConnector_UpdateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnector))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Description(@"Updates a security connector")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}", ApiVersion = "2023-10-01-preview")] + public partial class UpdateAzSecurityConnector_UpdateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// The security connector resource. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnector _securityConnectorBody = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SecurityConnector(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Security.Security Client => Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// The security connector environment data. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The security connector environment data.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The security connector environment data.", + SerializedName = @"environmentData", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironment) })] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironment EnvironmentData { get => _securityConnectorBody.EnvironmentData ?? null /* object */; set => _securityConnectorBody.EnvironmentData = value; } + + /// The multi cloud resource's cloud name. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The multi cloud resource's cloud name.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The multi cloud resource's cloud name.", + SerializedName = @"environmentName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Azure", "AWS", "GCP", "Github", "AzureDevOps", "GitLab")] + public string EnvironmentName { get => _securityConnectorBody.EnvironmentName ?? null; set => _securityConnectorBody.EnvironmentName = value; } + + /// + /// Entity tag is used for comparing two or more entities from the same requested resource. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Entity tag is used for comparing two or more entities from the same requested resource.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Entity tag is used for comparing two or more entities from the same requested resource.", + SerializedName = @"etag", + PossibleTypes = new [] { typeof(string) })] + public string Etag { get => _securityConnectorBody.Etag ?? null; set => _securityConnectorBody.Etag = value; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// + /// The multi cloud resource identifier (account id in case of AWS connector, project number in case of GCP connector). + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The multi cloud resource identifier (account id in case of AWS connector, project number in case of GCP connector).")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The multi cloud resource identifier (account id in case of AWS connector, project number in case of GCP connector).", + SerializedName = @"hierarchyIdentifier", + PossibleTypes = new [] { typeof(string) })] + public string HierarchyIdentifier { get => _securityConnectorBody.HierarchyIdentifier ?? null; set => _securityConnectorBody.HierarchyIdentifier = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Kind of the resource + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Kind of the resource")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Kind of the resource", + SerializedName = @"kind", + PossibleTypes = new [] { typeof(string) })] + public string Kind { get => _securityConnectorBody.Kind ?? null; set => _securityConnectorBody.Kind = value; } + + /// Location where the resource is stored + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Location where the resource is stored")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Location where the resource is stored", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + public string Location { get => _securityConnectorBody.Location ?? null; set => _securityConnectorBody.Location = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// The security connector name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The security connector name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The security connector name.", + SerializedName = @"securityConnectorName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("SecurityConnectorName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// A collection of offerings for the security connector. + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "A collection of offerings for the security connector.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A collection of offerings for the security connector.", + SerializedName = @"offerings", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOffering) })] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOffering[] Offering { get => _securityConnectorBody.Offering?.ToArray() ?? null /* fixedArrayOf */; set => _securityConnectorBody.Offering = (value != null ? new System.Collections.Generic.List(value) : null); } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// + /// The name of the resource group within the user's subscription. The name is case insensitive. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group within the user's subscription. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group within the user's subscription. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// Azure subscription ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure subscription ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure subscription ID", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// A list of key value pairs that describe the resource. + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "A list of key value pairs that describe the resource.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A list of key value pairs that describe the resource.", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITags) })] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITags Tag { get => _securityConnectorBody.Tag ?? null /* object */; set => _securityConnectorBody.Tag = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudError + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnector + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'SecurityConnectorsUpdate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.SecurityConnectorsUpdate(SubscriptionId, ResourceGroupName, Name, _securityConnectorBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeUpdate); + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public UpdateAzSecurityConnector_UpdateExpanded() + { + + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudError + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnector + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnector + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/cmdlets/UpdateAzSecurityConnector_UpdateViaIdentityExpanded.cs b/src/Security/Security.Autorest/generated/cmdlets/UpdateAzSecurityConnector_UpdateViaIdentityExpanded.cs new file mode 100644 index 000000000000..4d69a4e05bec --- /dev/null +++ b/src/Security/Security.Autorest/generated/cmdlets/UpdateAzSecurityConnector_UpdateViaIdentityExpanded.cs @@ -0,0 +1,553 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Cmdlets; + using System; + + /// Updates a security connector + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzSecurityConnector_UpdateViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnector))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Description(@"Updates a security connector")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}", ApiVersion = "2023-10-01-preview")] + public partial class UpdateAzSecurityConnector_UpdateViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// The security connector resource. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnector _securityConnectorBody = new Microsoft.Azure.PowerShell.Cmdlets.Security.Models.SecurityConnector(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Security.Security Client => Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// The security connector environment data. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The security connector environment data.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The security connector environment data.", + SerializedName = @"environmentData", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironment) })] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironment EnvironmentData { get => _securityConnectorBody.EnvironmentData ?? null /* object */; set => _securityConnectorBody.EnvironmentData = value; } + + /// The multi cloud resource's cloud name. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The multi cloud resource's cloud name.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The multi cloud resource's cloud name.", + SerializedName = @"environmentName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.PSArgumentCompleterAttribute("Azure", "AWS", "GCP", "Github", "AzureDevOps", "GitLab")] + public string EnvironmentName { get => _securityConnectorBody.EnvironmentName ?? null; set => _securityConnectorBody.EnvironmentName = value; } + + /// + /// Entity tag is used for comparing two or more entities from the same requested resource. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Entity tag is used for comparing two or more entities from the same requested resource.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Entity tag is used for comparing two or more entities from the same requested resource.", + SerializedName = @"etag", + PossibleTypes = new [] { typeof(string) })] + public string Etag { get => _securityConnectorBody.Etag ?? null; set => _securityConnectorBody.Etag = value; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// + /// The multi cloud resource identifier (account id in case of AWS connector, project number in case of GCP connector). + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The multi cloud resource identifier (account id in case of AWS connector, project number in case of GCP connector).")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The multi cloud resource identifier (account id in case of AWS connector, project number in case of GCP connector).", + SerializedName = @"hierarchyIdentifier", + PossibleTypes = new [] { typeof(string) })] + public string HierarchyIdentifier { get => _securityConnectorBody.HierarchyIdentifier ?? null; set => _securityConnectorBody.HierarchyIdentifier = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Kind of the resource + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Kind of the resource")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Kind of the resource", + SerializedName = @"kind", + PossibleTypes = new [] { typeof(string) })] + public string Kind { get => _securityConnectorBody.Kind ?? null; set => _securityConnectorBody.Kind = value; } + + /// Location where the resource is stored + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Location where the resource is stored")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Location where the resource is stored", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + public string Location { get => _securityConnectorBody.Location ?? null; set => _securityConnectorBody.Location = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// A collection of offerings for the security connector. + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "A collection of offerings for the security connector.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A collection of offerings for the security connector.", + SerializedName = @"offerings", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOffering) })] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOffering[] Offering { get => _securityConnectorBody.Offering?.ToArray() ?? null /* fixedArrayOf */; set => _securityConnectorBody.Offering = (value != null ? new System.Collections.Generic.List(value) : null); } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// A list of key value pairs that describe the resource. + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "A list of key value pairs that describe the resource.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Security.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Security.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A list of key value pairs that describe the resource.", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITags) })] + public Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITags Tag { get => _securityConnectorBody.Tag ?? null /* object */; set => _securityConnectorBody.Tag = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudError + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnector + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'SecurityConnectorsUpdate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Security.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.SecurityConnectorsUpdateViaIdentity(InputObject.Id, _securityConnectorBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeUpdate); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SecurityConnectorName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SecurityConnectorName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.SecurityConnectorsUpdate(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.SecurityConnectorName ?? null, _securityConnectorBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SerializationMode.IncludeUpdate); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public UpdateAzSecurityConnector_UpdateViaIdentityExpanded() + { + + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudError + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnector + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnector + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/AsyncCommandRuntime.cs b/src/Security/Security.Autorest/generated/runtime/AsyncCommandRuntime.cs new file mode 100644 index 000000000000..c8e301c2c0ec --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/AsyncCommandRuntime.cs @@ -0,0 +1,832 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell +{ + using System.Management.Automation; + using System.Management.Automation.Host; + using System.Threading; + using System.Linq; + + internal interface IAsyncCommandRuntimeExtensions + { + Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep Wrap(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep func); + System.Collections.Generic.IEnumerable Wrap(System.Collections.Generic.IEnumerable funcs); + + T ExecuteSync(System.Func step); + } + + public class AsyncCommandRuntime : System.Management.Automation.ICommandRuntime2, IAsyncCommandRuntimeExtensions, System.IDisposable + { + private ICommandRuntime2 originalCommandRuntime; + private System.Threading.Thread originalThread; + public bool AllowInteractive { get; set; } = false; + + public CancellationToken cancellationToken; + SemaphoreSlim semaphore = new SemaphoreSlim(1, 1); + ManualResetEventSlim readyToRun = new ManualResetEventSlim(false); + ManualResetEventSlim completed = new ManualResetEventSlim(false); + + System.Action runOnMainThread; + + private System.Management.Automation.PSCmdlet cmdlet; + + internal AsyncCommandRuntime(System.Management.Automation.PSCmdlet cmdlet, CancellationToken cancellationToken) + { + this.originalCommandRuntime = cmdlet.CommandRuntime as ICommandRuntime2; + this.originalThread = System.Threading.Thread.CurrentThread; + this.cancellationToken = cancellationToken; + this.cmdlet = cmdlet; + if (cmdlet.PagingParameters != null) + { + WriteDebug("Client side pagination is enabled for this cmdlet"); + } + cmdlet.CommandRuntime = this; + } + + public PSHost Host => this.originalCommandRuntime.Host; + + public PSTransactionContext CurrentPSTransaction => this.originalCommandRuntime.CurrentPSTransaction; + + private void CheckForInteractive() + { + // This is an interactive call -- if we are not on the original thread, this will only work if this was done at ACR creation time; + if (!AllowInteractive) + { + throw new System.Exception("AsyncCommandRuntime is not configured for interactive calls"); + } + } + private void WaitOurTurn() + { + // wait for our turn to play + semaphore?.Wait(cancellationToken); + + // ensure that completed is not set + completed.Reset(); + } + + private void WaitForCompletion() + { + // wait for the result (or cancellation!) + WaitHandle.WaitAny(new[] { cancellationToken.WaitHandle, completed?.WaitHandle }); + + // let go of the semaphore + semaphore?.Release(); + + } + + public bool ShouldContinue(string query, string caption, bool hasSecurityImpact, ref bool yesToAll, ref bool noToAll) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.ShouldContinue(query, caption, hasSecurityImpact, ref yesToAll, ref noToAll); + } + + CheckForInteractive(); + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool yta = yesToAll; + bool nta = noToAll; + bool result = false; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.ShouldContinue(query, caption, hasSecurityImpact, ref yta, ref nta); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + yesToAll = yta; + noToAll = nta; + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public bool ShouldContinue(string query, string caption) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.ShouldContinue(query, caption); + } + + CheckForInteractive(); + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool result = false; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.ShouldContinue(query, caption); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public bool ShouldContinue(string query, string caption, ref bool yesToAll, ref bool noToAll) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.ShouldContinue(query, caption, ref yesToAll, ref noToAll); + } + + CheckForInteractive(); + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool yta = yesToAll; + bool nta = noToAll; + bool result = false; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.ShouldContinue(query, caption, ref yta, ref nta); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + yesToAll = yta; + noToAll = nta; + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public bool ShouldProcess(string target) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.ShouldProcess(target); + } + + CheckForInteractive(); + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool result = false; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.ShouldProcess(target); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public bool ShouldProcess(string target, string action) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.ShouldProcess(target, action); + } + + CheckForInteractive(); + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool result = false; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.ShouldProcess(target, action); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public bool ShouldProcess(string verboseDescription, string verboseWarning, string caption) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.ShouldProcess(verboseDescription, verboseWarning, caption); + } + + CheckForInteractive(); + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool result = false; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.ShouldProcess(verboseDescription, verboseWarning, caption); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public bool ShouldProcess(string verboseDescription, string verboseWarning, string caption, out ShouldProcessReason shouldProcessReason) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.ShouldProcess(verboseDescription, verboseWarning, caption, out shouldProcessReason); + } + + CheckForInteractive(); + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool result = false; + ShouldProcessReason reason = ShouldProcessReason.None; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.ShouldProcess(verboseDescription, verboseWarning, caption, out reason); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + shouldProcessReason = reason; + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void ThrowTerminatingError(ErrorRecord errorRecord) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.ThrowTerminatingError(errorRecord); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.ThrowTerminatingError(errorRecord); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public bool TransactionAvailable() + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.TransactionAvailable(); + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool result = false; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.TransactionAvailable(); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteCommandDetail(string text) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteCommandDetail(text); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteCommandDetail(text); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteDebug(string text) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteDebug(text); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteDebug(text); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteError(ErrorRecord errorRecord) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteError(errorRecord); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteError(errorRecord); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteInformation(InformationRecord informationRecord) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteInformation(informationRecord); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteInformation(informationRecord); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteObject(object sendToPipeline) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteObject(sendToPipeline); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteObject(sendToPipeline); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteObject(object sendToPipeline, bool enumerateCollection) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteObject(sendToPipeline, enumerateCollection); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteObject(sendToPipeline, enumerateCollection); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteProgress(ProgressRecord progressRecord) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteProgress(progressRecord); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteProgress(progressRecord); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteProgress(long sourceId, ProgressRecord progressRecord) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteProgress(sourceId, progressRecord); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteProgress(sourceId, progressRecord); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteVerbose(string text) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteVerbose(text); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteVerbose(text); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteWarning(string text) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteWarning(text); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteWarning(text); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void Wait(System.Threading.Tasks.Task ProcessRecordAsyncTask, System.Threading.CancellationToken cancellationToken) + { + do + { + WaitHandle.WaitAny(new[] { readyToRun.WaitHandle, ((System.IAsyncResult)ProcessRecordAsyncTask).AsyncWaitHandle }); + if (readyToRun.IsSet) + { + // reset the request for the next time + readyToRun.Reset(); + + // run the delegate on this thread + runOnMainThread(); + + // tell the originator everything is complete + completed.Set(); + } + } + while (!ProcessRecordAsyncTask.IsCompleted); + if (ProcessRecordAsyncTask.IsFaulted) + { + // don't unwrap a Aggregate Exception -- we'll lose the stack trace of the actual exception. + // if( ProcessRecordAsyncTask.Exception is System.AggregateException aggregate ) { + // throw aggregate.InnerException; + // } + throw ProcessRecordAsyncTask.Exception; + } + } + public Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep Wrap(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep func) => func.Target.GetType().Name != "Closure" ? func : (p1, p2, p3) => ExecuteSync>(() => func(p1, p2, p3)); + public System.Collections.Generic.IEnumerable Wrap(System.Collections.Generic.IEnumerable funcs) => funcs?.Select(Wrap); + + public T ExecuteSync(System.Func step) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return step(); + } + + T result = default(T); + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + // set the function to run + runOnMainThread = () => { result = step(); }; + // tell the main thread to go ahead + readyToRun.Set(); + // wait for the result (or cancellation!) + WaitForCompletion(); + // return + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void Dispose() + { + if (cmdlet != null) + { + cmdlet.CommandRuntime = this.originalCommandRuntime; + cmdlet = null; + } + + semaphore?.Dispose(); + semaphore = null; + readyToRun?.Dispose(); + readyToRun = null; + completed?.Dispose(); + completed = null; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/AsyncJob.cs b/src/Security/Security.Autorest/generated/runtime/AsyncJob.cs new file mode 100644 index 000000000000..397010d55b28 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/AsyncJob.cs @@ -0,0 +1,270 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell +{ + using System.Management.Automation; + using System.Management.Automation.Host; + using System.Threading; + + using System.Threading.Tasks; + + public class LongRunningJobCancelledException : System.Exception + { + public LongRunningJobCancelledException(string message) : base(message) + { + + } + } + + public class AsyncJob : Job, System.Management.Automation.ICommandRuntime2 + { + const int MaxRecords = 1000; + + private string _statusMessage = string.Empty; + + public override string StatusMessage => _statusMessage; + + public override bool HasMoreData => Output.Count > 0 || Progress.Count > 0 || Error.Count > 0 || Warning.Count > 0 || Verbose.Count > 0 || Debug.Count > 0; + + public override string Location => "localhost"; + + public PSHost Host => originalCommandRuntime.Host; + + public PSTransactionContext CurrentPSTransaction => originalCommandRuntime.CurrentPSTransaction; + + public override void StopJob() + { + Cancel(); + } + + private readonly PSCmdlet cmdlet; + private readonly ICommandRuntime2 originalCommandRuntime; + private readonly System.Threading.Thread originalThread; + + private void CheckForInteractive() + { + // This is an interactive call -- We should never allow interactivity in AsnycJob cmdlets. + throw new System.Exception("Cmdlets in AsyncJob; interactive calls are not permitted."); + } + private bool IsJobDone => CancellationToken.IsCancellationRequested || this.JobStateInfo.State == JobState.Failed || this.JobStateInfo.State == JobState.Stopped || this.JobStateInfo.State == JobState.Stopping || this.JobStateInfo.State == JobState.Completed; + + private readonly System.Action Cancel; + private readonly CancellationToken CancellationToken; + + internal AsyncJob(PSCmdlet cmdlet, string line, string name, CancellationToken cancellationToken, System.Action cancelMethod) : base(line, name) + { + SetJobState(JobState.NotStarted); + // know how to cancel/check for cancelation + this.CancellationToken = cancellationToken; + this.Cancel = cancelMethod; + + // we might need these. + this.originalCommandRuntime = cmdlet.CommandRuntime as ICommandRuntime2; + this.originalThread = System.Threading.Thread.CurrentThread; + + // the instance of the cmdlet we're going to run + this.cmdlet = cmdlet; + + // set the command runtime to the AsyncJob + cmdlet.CommandRuntime = this; + } + + /// + /// Monitors the task (which should be ProcessRecordAsync) to control + /// the lifetime of the job itself + /// + /// + public void Monitor(Task task) + { + SetJobState(JobState.Running); + task.ContinueWith(antecedent => + { + if (antecedent.IsCanceled) + { + // if the task was canceled, we're just going to call it completed. + SetJobState(JobState.Completed); + } + else if (antecedent.IsFaulted) + { + foreach (var innerException in antecedent.Exception.Flatten().InnerExceptions) + { + WriteError(new System.Management.Automation.ErrorRecord(innerException, string.Empty, System.Management.Automation.ErrorCategory.NotSpecified, null)); + } + + // a fault indicates an actual failure + SetJobState(JobState.Failed); + } + else + { + // otherwiser it's a completed state. + SetJobState(JobState.Completed); + } + }, CancellationToken); + } + + private void CheckForCancellation() + { + if (IsJobDone) + { + throw new LongRunningJobCancelledException("Long running job is canceled or stopping, continuation of the cmdlet is not permitted."); + } + } + + public void WriteInformation(InformationRecord informationRecord) + { + CheckForCancellation(); + + this.Information.Add(informationRecord); + } + + public bool ShouldContinue(string query, string caption, bool hasSecurityImpact, ref bool yesToAll, ref bool noToAll) + { + CheckForInteractive(); + return false; + } + + public void WriteDebug(string text) + { + _statusMessage = text; + CheckForCancellation(); + + if (Debug.IsOpen && Debug.Count < MaxRecords) + { + Debug.Add(new DebugRecord(text)); + } + } + + public void WriteError(ErrorRecord errorRecord) + { + if (Error.IsOpen) + { + Error.Add(errorRecord); + } + } + + public void WriteObject(object sendToPipeline) + { + CheckForCancellation(); + + if (Output.IsOpen) + { + Output.Add(new PSObject(sendToPipeline)); + } + } + + public void WriteObject(object sendToPipeline, bool enumerateCollection) + { + CheckForCancellation(); + + if (enumerateCollection && sendToPipeline is System.Collections.IEnumerable enumerable) + { + foreach (var item in enumerable) + { + WriteObject(item); + } + } + else + { + WriteObject(sendToPipeline); + } + } + + public void WriteProgress(ProgressRecord progressRecord) + { + CheckForCancellation(); + + if (Progress.IsOpen && Progress.Count < MaxRecords) + { + Progress.Add(progressRecord); + } + } + + public void WriteProgress(long sourceId, ProgressRecord progressRecord) + { + CheckForCancellation(); + + if (Progress.IsOpen && Progress.Count < MaxRecords) + { + Progress.Add(progressRecord); + } + } + + public void WriteVerbose(string text) + { + CheckForCancellation(); + + if (Verbose.IsOpen && Verbose.Count < MaxRecords) + { + Verbose.Add(new VerboseRecord(text)); + } + } + + public void WriteWarning(string text) + { + CheckForCancellation(); + + if (Warning.IsOpen && Warning.Count < MaxRecords) + { + Warning.Add(new WarningRecord(text)); + } + } + + public void WriteCommandDetail(string text) + { + WriteVerbose(text); + } + + public bool ShouldProcess(string target) + { + CheckForInteractive(); + return false; + } + + public bool ShouldProcess(string target, string action) + { + CheckForInteractive(); + return false; + } + + public bool ShouldProcess(string verboseDescription, string verboseWarning, string caption) + { + CheckForInteractive(); + return false; + } + + public bool ShouldProcess(string verboseDescription, string verboseWarning, string caption, out ShouldProcessReason shouldProcessReason) + { + CheckForInteractive(); + shouldProcessReason = ShouldProcessReason.None; + return false; + } + + public bool ShouldContinue(string query, string caption) + { + CheckForInteractive(); + return false; + } + + public bool ShouldContinue(string query, string caption, ref bool yesToAll, ref bool noToAll) + { + CheckForInteractive(); + return false; + } + + public bool TransactionAvailable() + { + // interactivity required? + return false; + } + + public void ThrowTerminatingError(ErrorRecord errorRecord) + { + if (Error.IsOpen) + { + Error.Add(errorRecord); + } + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/AsyncOperationResponse.cs b/src/Security/Security.Autorest/generated/runtime/AsyncOperationResponse.cs new file mode 100644 index 000000000000..4e72ca43c21f --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/AsyncOperationResponse.cs @@ -0,0 +1,176 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + [System.ComponentModel.TypeConverter(typeof(AsyncOperationResponseTypeConverter))] + public class AsyncOperationResponse + { + private string _target; + public string Target { get => _target; set => _target = value; } + public AsyncOperationResponse() + { + } + internal AsyncOperationResponse(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json) + { + // pull target + { Target = If(json?.PropertyT("target"), out var _v) ? (string)_v : (string)Target; } + } + public string ToJsonString() + { + return $"{{ \"target\" : \"{this.Target}\" }}"; + } + + public static AsyncOperationResponse FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject json ? new AsyncOperationResponse(json) : null; + } + + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static AsyncOperationResponse FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(jsonText)); + + } + + public partial class AsyncOperationResponseTypeConverter : System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to a type + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static object ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(AsyncOperationResponse).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AsyncOperationResponse.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString()); ; + } + catch + { + // Unable to use JSON pattern + } + + if (typeof(System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return new AsyncOperationResponse { Target = (sourceValue as System.Management.Automation.PSObject).GetValueForProperty("target", "", global::System.Convert.ToString) }; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return new AsyncOperationResponse { Target = (sourceValue as global::System.Collections.IDictionary).GetValueForProperty("target", "", global::System.Convert.ToString) }; + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Attributes/ExternalDocsAttribute.cs b/src/Security/Security.Autorest/generated/runtime/Attributes/ExternalDocsAttribute.cs new file mode 100644 index 000000000000..b79e6c090859 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Attributes/ExternalDocsAttribute.cs @@ -0,0 +1,30 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Security +{ + using System; + using System.Collections.Generic; + using System.Text; + + [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = true)] + public class ExternalDocsAttribute : Attribute + { + + public string Description { get; } + + public string Url { get; } + + public ExternalDocsAttribute(string url) + { + Url = url; + } + + public ExternalDocsAttribute(string url, string description) + { + Url = url; + Description = description; + } + } +} diff --git a/src/Security/Security.Autorest/generated/runtime/Attributes/PSArgumentCompleterAttribute.cs b/src/Security/Security.Autorest/generated/runtime/Attributes/PSArgumentCompleterAttribute.cs new file mode 100644 index 000000000000..688a2497e180 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Attributes/PSArgumentCompleterAttribute.cs @@ -0,0 +1,52 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using System; +using System.Collections.Generic; +using System.Management.Automation; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security +{ + public class PSArgumentCompleterAttribute : ArgumentCompleterAttribute + { + internal string[] ResourceTypes; + + public PSArgumentCompleterAttribute(params string[] argumentList) : base(CreateScriptBlock(argumentList)) + { + ResourceTypes = argumentList; + } + + public static ScriptBlock CreateScriptBlock(string[] resourceTypes) + { + List outputResourceTypes = new List(); + foreach (string resourceType in resourceTypes) + { + if (resourceType.Contains(" ")) + { + outputResourceTypes.Add("\'\'" + resourceType + "\'\'"); + } + else + { + outputResourceTypes.Add(resourceType); + } + } + string scriptResourceTypeList = "'" + String.Join("' , '", outputResourceTypes) + "'"; + string script = "param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter)\n" + + String.Format("$values = {0}\n", scriptResourceTypeList) + + "$values | Where-Object { $_ -Like \"$wordToComplete*\" -or $_ -Like \"'$wordToComplete*\" } | Sort-Object | ForEach-Object { [System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_) }"; + ScriptBlock scriptBlock = ScriptBlock.Create(script); + return scriptBlock; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/BuildTime/Cmdlets/ExportCmdletSurface.cs b/src/Security/Security.Autorest/generated/runtime/BuildTime/Cmdlets/ExportCmdletSurface.cs new file mode 100644 index 000000000000..5d11d5af77e2 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/BuildTime/Cmdlets/ExportCmdletSurface.cs @@ -0,0 +1,113 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Management.Automation; +using System.Text; +using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.PsHelpers; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "CmdletSurface")] + [DoNotExport] + public class ExportCmdletSurface : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ModuleName { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string CmdletFolder { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string OutputFolder { get; set; } + + [Parameter] + public bool IncludeGeneralParameters { get; set; } + + [Parameter] + public bool UseExpandedFormat { get; set; } + + protected override void ProcessRecord() + { + try + { + var variants = GetScriptCmdlets(this, CmdletFolder) + .SelectMany(fi => fi.ToVariants()) + .Where(v => !v.IsDoNotExport) + .ToArray(); + var allProfiles = variants.SelectMany(v => v.Profiles).Distinct().ToArray(); + var profileGroups = allProfiles.Any() + ? variants + .SelectMany(v => (v.Profiles.Any() ? v.Profiles : allProfiles).Select(p => (profile: p, variant: v))) + .GroupBy(pv => pv.profile) + .Select(pvg => new ProfileGroup(pvg.Select(pv => pv.variant).ToArray(), pvg.Key)) + : new[] { new ProfileGroup(variants) }; + foreach (var profileGroup in profileGroups) + { + var variantGroups = profileGroup.Variants + .GroupBy(v => new { v.CmdletName }) + .Select(vg => new VariantGroup(ModuleName, vg.Key.CmdletName, vg.Select(v => v).ToArray(), String.Empty, profileGroup.ProfileName)); + var sb = UseExpandedFormat ? ExpandedFormat(variantGroups) : CondensedFormat(variantGroups); + Directory.CreateDirectory(OutputFolder); + File.WriteAllText(Path.Combine(OutputFolder, $"CmdletSurface-{profileGroup.ProfileName}.md"), sb.ToString()); + } + } + catch (Exception ee) + { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + + private StringBuilder ExpandedFormat(IEnumerable variantGroups) + { + var sb = new StringBuilder(); + foreach (var variantGroup in variantGroups.OrderBy(vg => vg.CmdletName)) + { + sb.Append($"### {variantGroup.CmdletName}{Environment.NewLine}"); + var parameterGroups = variantGroup.ParameterGroups + .Where(pg => !pg.DontShow && (IncludeGeneralParameters || (pg.OrderCategory != ParameterCategory.Azure && pg.OrderCategory != ParameterCategory.Runtime))); + foreach (var parameterGroup in parameterGroups) + { + sb.Append($" - {parameterGroup.ParameterName} `{parameterGroup.ParameterType.ToSyntaxTypeName()}`{Environment.NewLine}"); + } + sb.AppendLine(); + } + + return sb; + } + + private StringBuilder CondensedFormat(IEnumerable variantGroups) + { + var sb = new StringBuilder(); + var condensedGroups = variantGroups + .GroupBy(vg => vg.CmdletNoun) + .Select(vgg => ( + CmdletNoun: vgg.Key, + CmdletVerbs: vgg.Select(vg => vg.CmdletVerb).OrderBy(cv => cv).ToArray(), + ParameterGroups: vgg.SelectMany(vg => vg.ParameterGroups).DistinctBy(p => p.ParameterName).ToArray(), + OutputTypes: vgg.SelectMany(vg => vg.OutputTypes).Select(ot => ot.Type).DistinctBy(t => t.Name).Select(t => t.ToSyntaxTypeName()).ToArray())) + .OrderBy(vg => vg.CmdletNoun); + foreach (var condensedGroup in condensedGroups) + { + sb.Append($"### {condensedGroup.CmdletNoun} [{String.Join(", ", condensedGroup.CmdletVerbs)}] `{String.Join(", ", condensedGroup.OutputTypes)}`{Environment.NewLine}"); + var parameterGroups = condensedGroup.ParameterGroups + .Where(pg => !pg.DontShow && (IncludeGeneralParameters || (pg.OrderCategory != ParameterCategory.Azure && pg.OrderCategory != ParameterCategory.Runtime))); + foreach (var parameterGroup in parameterGroups) + { + sb.Append($" - {parameterGroup.ParameterName} `{parameterGroup.ParameterType.ToSyntaxTypeName()}`{Environment.NewLine}"); + } + sb.AppendLine(); + } + + return sb; + } + } +} diff --git a/src/Security/Security.Autorest/generated/runtime/BuildTime/Cmdlets/ExportExampleStub.cs b/src/Security/Security.Autorest/generated/runtime/BuildTime/Cmdlets/ExportExampleStub.cs new file mode 100644 index 000000000000..f8aad21abb18 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/BuildTime/Cmdlets/ExportExampleStub.cs @@ -0,0 +1,74 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.IO; +using System.Linq; +using System.Management.Automation; +using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.MarkdownTypesExtensions; +using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.PsHelpers; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "ExampleStub")] + [DoNotExport] + public class ExportExampleStub : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ExportsFolder { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string OutputFolder { get; set; } + + protected override void ProcessRecord() + { + try + { + if (!Directory.Exists(ExportsFolder)) + { + throw new ArgumentException($"Exports folder '{ExportsFolder}' does not exist"); + } + + var exportDirectories = Directory.GetDirectories(ExportsFolder); + if (!exportDirectories.Any()) + { + exportDirectories = new[] { ExportsFolder }; + } + + var exampleText = String.Join(String.Empty, DefaultExampleHelpInfos.Select(ehi => ehi.ToHelpExampleOutput())); + foreach (var exportDirectory in exportDirectories) + { + var outputFolder = OutputFolder; + if (exportDirectory != ExportsFolder) + { + outputFolder = Path.Combine(OutputFolder, Path.GetFileName(exportDirectory)); + Directory.CreateDirectory(outputFolder); + } + + var cmdletFilePaths = GetScriptCmdlets(exportDirectory).Select(fi => Path.Combine(outputFolder, $"{fi.Name}.md")).ToArray(); + var currentExamplesFilePaths = Directory.GetFiles(outputFolder).ToArray(); + // Remove examples of non-existing cmdlets + var removedCmdletFilePaths = currentExamplesFilePaths.Except(cmdletFilePaths); + foreach (var removedCmdletFilePath in removedCmdletFilePaths) + { + File.Delete(removedCmdletFilePath); + } + + // Only create example stubs if they don't exist + foreach (var cmdletFilePath in cmdletFilePaths.Except(currentExamplesFilePaths)) + { + File.WriteAllText(cmdletFilePath, exampleText); + } + } + } + catch (Exception ee) + { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + } +} diff --git a/src/Security/Security.Autorest/generated/runtime/BuildTime/Cmdlets/ExportFormatPs1xml.cs b/src/Security/Security.Autorest/generated/runtime/BuildTime/Cmdlets/ExportFormatPs1xml.cs new file mode 100644 index 000000000000..c289484d83bd --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/BuildTime/Cmdlets/ExportFormatPs1xml.cs @@ -0,0 +1,103 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Management.Automation; +using System.Reflection; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "FormatPs1xml")] + [DoNotExport] + public class ExportFormatPs1xml : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string FilePath { get; set; } + + private const string ModelNamespace = @"Microsoft.Azure.PowerShell.Cmdlets.Security.Models"; + private const string SupportNamespace = @"${$project.supportNamespace.fullName}"; + private const string PropertiesExcludedForTableview = @"Id,Type"; + + private static readonly bool IsAzure = Convert.ToBoolean(@"true"); + + private static string SelectedBySuffix = @"#Multiple"; + + protected override void ProcessRecord() + { + try + { + var viewModels = GetFilteredViewParameters().Select(CreateViewModel).ToList(); + var ps1xml = new Configuration + { + ViewDefinitions = new ViewDefinitions + { + Views = viewModels + } + }; + File.WriteAllText(FilePath, ps1xml.ToXmlString()); + } + catch (Exception ee) + { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + + private static IEnumerable GetFilteredViewParameters() + { + //https://stackoverflow.com/a/79738/294804 + //https://stackoverflow.com/a/949285/294804 + var types = Assembly.GetExecutingAssembly().GetExportedTypes() + .Where(t => t.IsClass + && (t.Namespace.StartsWith(ModelNamespace) || t.Namespace.StartsWith(SupportNamespace)) + && !t.GetCustomAttributes().Any()); + return types.Select(t => new ViewParameters(t, t.GetProperties() + .Select(p => new PropertyFormat(p)) + .Where(pf => !pf.Property.GetCustomAttributes().Any() + && (!PropertiesExcludedForTableview.Split(',').Contains(pf.Property.Name)) + && (pf.FormatTable != null || (pf.Origin != PropertyOrigin.Inlined && pf.Property.PropertyType.IsPsSimple()))) + .OrderByDescending(pf => pf.Index.HasValue) + .ThenBy(pf => pf.Index) + .ThenByDescending(pf => pf.Origin.HasValue) + .ThenBy(pf => pf.Origin))).Where(vp => vp.Properties.Any()); + } + + private static View CreateViewModel(ViewParameters viewParameters) + { + var entries = viewParameters.Properties.Select(pf => + (TableColumnHeader: new TableColumnHeader { Label = pf.Label, Width = pf.Width }, + TableColumnItem: new TableColumnItem { PropertyName = pf.Property.Name })).ToArray(); + + return new View + { + Name = viewParameters.Type.FullName, + ViewSelectedBy = new ViewSelectedBy + { + TypeName = string.Concat(viewParameters.Type.FullName, SelectedBySuffix) + }, + TableControl = new TableControl + { + TableHeaders = new TableHeaders + { + TableColumnHeaders = entries.Select(e => e.TableColumnHeader).ToList() + }, + TableRowEntries = new TableRowEntries + { + TableRowEntry = new TableRowEntry + { + TableColumnItems = new TableColumnItems + { + TableItems = entries.Select(e => e.TableColumnItem).ToList() + } + } + } + } + }; + } + } +} diff --git a/src/Security/Security.Autorest/generated/runtime/BuildTime/Cmdlets/ExportHelpMarkdown.cs b/src/Security/Security.Autorest/generated/runtime/BuildTime/Cmdlets/ExportHelpMarkdown.cs new file mode 100644 index 000000000000..252ebd6b250b --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/BuildTime/Cmdlets/ExportHelpMarkdown.cs @@ -0,0 +1,56 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Linq; +using System.Management.Automation; +using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.MarkdownRenderer; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "HelpMarkdown")] + [DoNotExport] + public class ExportHelpMarkdown : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public PSModuleInfo ModuleInfo { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public PSObject[] FunctionInfo { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public PSObject[] HelpInfo { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string DocsFolder { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ExamplesFolder { get; set; } + + [Parameter()] + public SwitchParameter AddComplexInterfaceInfo { get; set; } + + protected override void ProcessRecord() + { + try + { + var helpInfos = HelpInfo.Select(hi => hi.ToPsHelpInfo()); + var variantGroups = FunctionInfo.Select(fi => fi.BaseObject).Cast() + .Join(helpInfos, fi => fi.Name, phi => phi.CmdletName, (fi, phi) => fi.ToVariants(phi)) + .Select(va => new VariantGroup(ModuleInfo.Name, va.First().CmdletName, va, String.Empty)); + WriteMarkdowns(variantGroups, ModuleInfo.ToModuleInfo(), DocsFolder, ExamplesFolder, AddComplexInterfaceInfo.IsPresent); + } + catch (Exception ee) + { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + } +} diff --git a/src/Security/Security.Autorest/generated/runtime/BuildTime/Cmdlets/ExportModelSurface.cs b/src/Security/Security.Autorest/generated/runtime/BuildTime/Cmdlets/ExportModelSurface.cs new file mode 100644 index 000000000000..f69fd4ecfcec --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/BuildTime/Cmdlets/ExportModelSurface.cs @@ -0,0 +1,117 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Management.Automation; +using System.Reflection; +using System.Text; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "ModelSurface")] + [DoNotExport] + public class ExportModelSurface : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string OutputFolder { get; set; } + + [Parameter] + public bool UseExpandedFormat { get; set; } + + private const string ModelNamespace = @"Microsoft.Azure.PowerShell.Cmdlets.Security.Models"; + private const string SupportNamespace = @"${$project.supportNamespace.fullName}"; + + protected override void ProcessRecord() + { + try + { + var types = Assembly.GetExecutingAssembly().GetExportedTypes() + .Where(t => t.IsClass && (t.Namespace.StartsWith(ModelNamespace) || t.Namespace.StartsWith(SupportNamespace))); + var typeInfos = types.Select(t => new ModelTypeInfo + { + Type = t, + TypeName = t.Name, + Properties = t.GetProperties(BindingFlags.Public | BindingFlags.Instance).Where(p => !p.GetIndexParameters().Any()).OrderBy(p => p.Name).ToArray(), + NamespaceGroup = t.Namespace.Split('.').LastOrDefault().EmptyIfNull() + }).Where(mti => mti.Properties.Any()); + var sb = UseExpandedFormat ? ExpandedFormat(typeInfos) : CondensedFormat(typeInfos); + Directory.CreateDirectory(OutputFolder); + File.WriteAllText(Path.Combine(OutputFolder, "ModelSurface.md"), sb.ToString()); + } + catch (Exception ee) + { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + + private static StringBuilder ExpandedFormat(IEnumerable typeInfos) + { + var sb = new StringBuilder(); + foreach (var typeInfo in typeInfos.OrderBy(mti => mti.TypeName).ThenBy(mti => mti.NamespaceGroup)) + { + sb.Append($"### {typeInfo.TypeName} [{typeInfo.NamespaceGroup}]{Environment.NewLine}"); + foreach (var property in typeInfo.Properties) + { + sb.Append($" - {property.Name} `{property.PropertyType.ToSyntaxTypeName()}`{Environment.NewLine}"); + } + sb.AppendLine(); + } + + return sb; + } + + private static StringBuilder CondensedFormat(IEnumerable typeInfos) + { + var sb = new StringBuilder(); + var typeGroups = typeInfos + .GroupBy(mti => mti.TypeName) + .Select(tig => ( + Types: tig.Select(mti => mti.Type).ToArray(), + TypeName: tig.Key, + Properties: tig.SelectMany(mti => mti.Properties).DistinctBy(p => p.Name).OrderBy(p => p.Name).ToArray(), + NamespaceGroups: tig.Select(mti => mti.NamespaceGroup).OrderBy(ng => ng).ToArray() + )) + .OrderBy(tg => tg.TypeName); + foreach (var typeGroup in typeGroups) + { + var aType = typeGroup.Types.Select(GetAssociativeType).FirstOrDefault(t => t != null); + var aText = aType != null ? $@" \<{aType.ToSyntaxTypeName()}\>" : String.Empty; + sb.Append($"### {typeGroup.TypeName}{aText} [{String.Join(", ", typeGroup.NamespaceGroups)}]{Environment.NewLine}"); + foreach (var property in typeGroup.Properties) + { + var propertyAType = GetAssociativeType(property.PropertyType); + var propertyAText = propertyAType != null ? $" <{propertyAType.ToSyntaxTypeName()}>" : String.Empty; + var enumNames = GetEnumFieldNames(property.PropertyType.Unwrap()); + var enumNamesText = enumNames.Any() ? $" **{{{String.Join(", ", enumNames)}}}**" : String.Empty; + sb.Append($" - {property.Name} `{property.PropertyType.ToSyntaxTypeName()}{propertyAText}`{enumNamesText}{Environment.NewLine}"); + } + sb.AppendLine(); + } + + return sb; + } + + //https://stackoverflow.com/a/4963190/294804 + private static Type GetAssociativeType(Type type) => + type.GetInterfaces().FirstOrDefault(i => i.IsGenericType && i.GetGenericTypeDefinition() == typeof(IAssociativeArray<>))?.GetGenericArguments().First(); + + private static string[] GetEnumFieldNames(Type type) => + type.IsValueType && !type.IsPrimitive && type != typeof(decimal) && type != typeof(DateTime) + ? type.GetFields(BindingFlags.Public | BindingFlags.Static).Where(f => f.FieldType == type).Select(p => p.Name).ToArray() + : new string[] { }; + + private class ModelTypeInfo + { + public Type Type { get; set; } + public string TypeName { get; set; } + public PropertyInfo[] Properties { get; set; } + public string NamespaceGroup { get; set; } + } + } +} diff --git a/src/Security/Security.Autorest/generated/runtime/BuildTime/Cmdlets/ExportProxyCmdlet.cs b/src/Security/Security.Autorest/generated/runtime/BuildTime/Cmdlets/ExportProxyCmdlet.cs new file mode 100644 index 000000000000..5ad3825beebd --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/BuildTime/Cmdlets/ExportProxyCmdlet.cs @@ -0,0 +1,180 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.IO; +using System.Linq; +using System.Management.Automation; +using System.Text; +using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.PsHelpers; +using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.MarkdownRenderer; +using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.PsProxyTypeExtensions; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "ProxyCmdlet", DefaultParameterSetName = "Docs")] + [DoNotExport] + public class ExportProxyCmdlet : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ModuleName { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string[] ModulePath { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ExportsFolder { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string InternalFolder { get; set; } + + [Parameter(Mandatory = true, ParameterSetName = "Docs")] + [AllowEmptyString] + public string ModuleDescription { get; set; } + + [Parameter(Mandatory = true, ParameterSetName = "Docs")] + [ValidateNotNullOrEmpty] + public string DocsFolder { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ExamplesFolder { get; set; } + + [Parameter(Mandatory = true, ParameterSetName = "Docs")] + public Guid ModuleGuid { get; set; } + + [Parameter(Mandatory = true, ParameterSetName = "NoDocs")] + public SwitchParameter ExcludeDocs { get; set; } + + [Parameter(ParameterSetName = "Docs")] + public SwitchParameter AddComplexInterfaceInfo { get; set; } + + protected override void ProcessRecord() + { + try + { + var variants = GetModuleCmdletsAndHelpInfo(this, ModulePath).SelectMany(ci => ci.ToVariants()).Where(v => !v.IsDoNotExport).ToArray(); + var allProfiles = variants.SelectMany(v => v.Profiles).Distinct().ToArray(); + var profileGroups = allProfiles.Any() + ? variants + .SelectMany(v => (v.Profiles.Any() ? v.Profiles : allProfiles).Select(p => (profile: p, variant: v))) + .GroupBy(pv => pv.profile) + .Select(pvg => new ProfileGroup(pvg.Select(pv => pv.variant).ToArray(), pvg.Key)) + : new[] { new ProfileGroup(variants) }; + var variantGroups = profileGroups.SelectMany(pg => pg.Variants + .GroupBy(v => new { v.CmdletName, v.IsInternal }) + .Select(vg => new VariantGroup(ModuleName, vg.Key.CmdletName, vg.Select(v => v).ToArray(), + Path.Combine(vg.Key.IsInternal ? InternalFolder : ExportsFolder, pg.ProfileFolder), pg.ProfileName, isInternal: vg.Key.IsInternal))) + .ToArray(); + var license = new StringBuilder(); + license.Append(@" +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the ""License""); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an ""AS IS"" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- +"); + HashSet LicenseSet = new HashSet(); + foreach (var variantGroup in variantGroups) + { + var parameterGroups = variantGroup.ParameterGroups.ToList(); + var isValidProfile = !String.IsNullOrEmpty(variantGroup.ProfileName) && variantGroup.ProfileName != NoProfiles; + var examplesFolder = isValidProfile ? Path.Combine(ExamplesFolder, variantGroup.ProfileName) : ExamplesFolder; + var markdownInfo = new MarkdownHelpInfo(variantGroup, examplesFolder); + List examples = new List(); + foreach (var it in markdownInfo.Examples) + { + examples.Add(it); + } + variantGroup.HelpInfo.Examples = examples.ToArray(); + var sb = new StringBuilder(); + sb.Append($"{Environment.NewLine}"); + sb.Append(variantGroup.ToHelpCommentOutput()); + sb.Append($"function {variantGroup.CmdletName} {{{Environment.NewLine}"); + sb.Append(variantGroup.Aliases.ToAliasOutput()); + sb.Append(variantGroup.OutputTypes.ToOutputTypeOutput()); + sb.Append(variantGroup.ToCmdletBindingOutput()); + sb.Append(variantGroup.ProfileName.ToProfileOutput()); + + sb.Append("param("); + sb.Append($"{(parameterGroups.Any() ? Environment.NewLine : String.Empty)}"); + + foreach (var parameterGroup in parameterGroups) + { + var parameters = parameterGroup.HasAllVariants ? parameterGroup.Parameters.Take(1) : parameterGroup.Parameters; + parameters = parameters.Where(p => !p.IsHidden()); + if (!parameters.Any()) + { + continue; + } + foreach (var parameter in parameters) + { + sb.Append(parameter.ToParameterOutput(variantGroup.HasMultipleVariants, parameterGroup.HasAllVariants)); + } + sb.Append(parameterGroup.Aliases.ToAliasOutput(true)); + sb.Append(parameterGroup.HasValidateNotNull.ToValidateNotNullOutput()); + sb.Append(parameterGroup.HasAllowEmptyArray.ToAllowEmptyArray()); + sb.Append(parameterGroup.CompleterInfo.ToArgumentCompleterOutput()); + sb.Append(parameterGroup.OrderCategory.ToParameterCategoryOutput()); + sb.Append(parameterGroup.InfoAttribute.ToInfoOutput(parameterGroup.ParameterType)); + sb.Append(parameterGroup.ToDefaultInfoOutput()); + sb.Append(parameterGroup.ParameterType.ToParameterTypeOutput()); + sb.Append(parameterGroup.Description.ToParameterDescriptionOutput()); + sb.Append(parameterGroup.ParameterName.ToParameterNameOutput(parameterGroups.IndexOf(parameterGroup) == parameterGroups.Count - 1)); + } + sb.Append($"){Environment.NewLine}{Environment.NewLine}"); + + sb.Append(variantGroup.ToBeginOutput()); + sb.Append(variantGroup.ToProcessOutput()); + sb.Append(variantGroup.ToEndOutput()); + + sb.Append($"}}{Environment.NewLine}"); + + Directory.CreateDirectory(variantGroup.OutputFolder); + File.WriteAllText(variantGroup.FilePath, license.ToString()); + File.AppendAllText(variantGroup.FilePath, sb.ToString()); + if (!LicenseSet.Contains(Path.Combine(variantGroup.OutputFolder, "ProxyCmdletDefinitions.ps1"))) + { + // only add license in the header + File.AppendAllText(Path.Combine(variantGroup.OutputFolder, "ProxyCmdletDefinitions.ps1"), license.ToString()); + LicenseSet.Add(Path.Combine(variantGroup.OutputFolder, "ProxyCmdletDefinitions.ps1")); + } + File.AppendAllText(Path.Combine(variantGroup.OutputFolder, "ProxyCmdletDefinitions.ps1"), sb.ToString()); + } + + if (!ExcludeDocs) + { + var moduleInfo = new PsModuleHelpInfo(ModuleName, ModuleGuid, ModuleDescription); + foreach (var variantGroupsByProfile in variantGroups.GroupBy(vg => vg.ProfileName)) + { + var profileName = variantGroupsByProfile.Key; + var isValidProfile = !String.IsNullOrEmpty(profileName) && profileName != NoProfiles; + var docsFolder = isValidProfile ? Path.Combine(DocsFolder, profileName) : DocsFolder; + var examplesFolder = isValidProfile ? Path.Combine(ExamplesFolder, profileName) : ExamplesFolder; + WriteMarkdowns(variantGroupsByProfile, moduleInfo, docsFolder, examplesFolder, AddComplexInterfaceInfo.IsPresent); + } + } + } + catch (Exception ee) + { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + } +} diff --git a/src/Security/Security.Autorest/generated/runtime/BuildTime/Cmdlets/ExportPsd1.cs b/src/Security/Security.Autorest/generated/runtime/BuildTime/Cmdlets/ExportPsd1.cs new file mode 100644 index 000000000000..1277ad34bbb6 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/BuildTime/Cmdlets/ExportPsd1.cs @@ -0,0 +1,193 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.IO; +using System.Linq; +using System.Management.Automation; +using System.Text; +using System.Text.RegularExpressions; +using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.PsHelpers; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "Psd1")] + [DoNotExport] + public class ExportPsd1 : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ExportsFolder { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string CustomFolder { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string Psd1Path { get; set; } + + [Parameter(Mandatory = true)] + public Guid ModuleGuid { get; set; } + + private static readonly bool IsAzure = Convert.ToBoolean(@"true"); + private const string CustomFolderRelative = "./custom"; + private const string Indent = Psd1Indent; + private const string Undefined = "undefined"; + private bool IsUndefined(string value) => string.Equals(Undefined, value, StringComparison.OrdinalIgnoreCase); + + protected override void ProcessRecord() + { + try + { + if (!Directory.Exists(ExportsFolder)) + { + throw new ArgumentException($"Exports folder '{ExportsFolder}' does not exist"); + } + + if (!Directory.Exists(CustomFolder)) + { + throw new ArgumentException($"Custom folder '{CustomFolder}' does not exist"); + } + + string version = Convert.ToString(@"1.5.1"); + // Validate the module version should be semantic version + // Following regex is official from https://semver.org/ + Regex rx = new Regex(@"^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$", RegexOptions.Compiled); + if (rx.Matches(version).Count != 1) + { + throw new ArgumentException("Module-version is not a valid Semantic Version"); + } + + string previewVersion = null; + if (version.Contains('-')) + { + string[] versions = version.Split("-".ToCharArray(), 2); + version = versions[0]; + previewVersion = versions[1]; + } + + var sb = new StringBuilder(); + sb.AppendLine("@{"); + sb.AppendLine($@"{GuidStart} = '{ModuleGuid}'"); + sb.AppendLine($@"{Indent}RootModule = '{"./Az.Security.psm1"}'"); + sb.AppendLine($@"{Indent}ModuleVersion = '{version}'"); + sb.AppendLine($@"{Indent}CompatiblePSEditions = 'Core', 'Desktop'"); + sb.AppendLine($@"{Indent}Author = '{"Microsoft Corporation"}'"); + sb.AppendLine($@"{Indent}CompanyName = '{"Microsoft Corporation"}'"); + sb.AppendLine($@"{Indent}Copyright = '{"Microsoft Corporation. All rights reserved."}'"); + sb.AppendLine($@"{Indent}Description = '{"Microsoft Azure PowerShell: Security cmdlets"}'"); + sb.AppendLine($@"{Indent}PowerShellVersion = '5.1'"); + sb.AppendLine($@"{Indent}DotNetFrameworkVersion = '4.7.2'"); + + // RequiredModules + if (!IsUndefined("undefined")) + { + sb.AppendLine($@"{Indent}RequiredModules = @({"undefined"})"); + } + + // RequiredAssemblies + if (!IsUndefined("undefined")) + { + sb.AppendLine($@"{Indent}RequiredAssemblies = @({"undefined"})"); + } + else + { + sb.AppendLine($@"{Indent}RequiredAssemblies = '{"./bin/Az.Security.private.dll"}'"); + } + + // NestedModules + if (!IsUndefined("undefined")) + { + sb.AppendLine($@"{Indent}NestedModules = @({"undefined"})"); + } + + // FormatsToProcess + if (!IsUndefined("undefined")) + { + sb.AppendLine($@"{Indent}FormatsToProcess = @({"undefined"})"); + } + else + { + var customFormatPs1xmlFiles = Directory.GetFiles(CustomFolder) + .Where(f => f.EndsWith(".format.ps1xml")) + .Select(f => $"{CustomFolderRelative}/{Path.GetFileName(f)}"); + var formatList = customFormatPs1xmlFiles.Prepend("./Az.Security.format.ps1xml").ToPsList(); + sb.AppendLine($@"{Indent}FormatsToProcess = {formatList}"); + } + + // TypesToProcess + if (!IsUndefined("undefined")) + { + sb.AppendLine($@"{Indent}TypesToProcess = @({"undefined"})"); + } + + // ScriptsToProcess + if (!IsUndefined("undefined")) + { + sb.AppendLine($@"{Indent}ScriptsToProcess = @({"undefined"})"); + } + + var functionInfos = GetScriptCmdlets(ExportsFolder).ToArray(); + // FunctionsToExport + if (!IsUndefined("undefined")) + { + sb.AppendLine($@"{Indent}FunctionsToExport = @({"undefined"})"); + } + else + { + var cmdletsList = functionInfos.Select(fi => fi.Name).Distinct().ToPsList(); + sb.AppendLine($@"{Indent}FunctionsToExport = {cmdletsList}"); + } + + // AliasesToExport + if (!IsUndefined("undefined")) + { + sb.AppendLine($@"{Indent}AliasesToExport = @({"undefined"})"); + } + else + { + var aliasesList = functionInfos.SelectMany(fi => fi.ScriptBlock.Attributes).ToAliasNames().ToPsList(); + if (!String.IsNullOrEmpty(aliasesList)) { + sb.AppendLine($@"{Indent}AliasesToExport = {aliasesList}"); + } + } + + // CmdletsToExport + if (!IsUndefined("undefined")) + { + sb.AppendLine($@"{Indent}CmdletsToExport = @({"undefined"})"); + } + + sb.AppendLine($@"{Indent}PrivateData = @{{"); + sb.AppendLine($@"{Indent}{Indent}PSData = @{{"); + + if (previewVersion != null) + { + sb.AppendLine($@"{Indent}{Indent}{Indent}Prerelease = '{previewVersion}'"); + } + sb.AppendLine($@"{Indent}{Indent}{Indent}Tags = {"Azure ResourceManager ARM PSModule Security".Split(' ').ToPsList().NullIfEmpty() ?? "''"}"); + sb.AppendLine($@"{Indent}{Indent}{Indent}LicenseUri = '{"https://aka.ms/azps-license"}'"); + sb.AppendLine($@"{Indent}{Indent}{Indent}ProjectUri = '{"https://github.com/Azure/azure-powershell"}'"); + sb.AppendLine($@"{Indent}{Indent}{Indent}ReleaseNotes = ''"); + var profilesList = ""; + if (IsAzure && !String.IsNullOrEmpty(profilesList)) + { + sb.AppendLine($@"{Indent}{Indent}{Indent}Profiles = {profilesList}"); + } + + sb.AppendLine($@"{Indent}{Indent}}}"); + sb.AppendLine($@"{Indent}}}"); + sb.AppendLine(@"}"); + + File.WriteAllText(Psd1Path, sb.ToString()); + } + catch (Exception ee) + { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + } +} diff --git a/src/Security/Security.Autorest/generated/runtime/BuildTime/Cmdlets/ExportTestStub.cs b/src/Security/Security.Autorest/generated/runtime/BuildTime/Cmdlets/ExportTestStub.cs new file mode 100644 index 000000000000..9c885900905d --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/BuildTime/Cmdlets/ExportTestStub.cs @@ -0,0 +1,173 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.IO; +using System.Linq; +using System.Management.Automation; +using System.Text; +using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.PsProxyOutputExtensions; +using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.PsHelpers; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "TestStub")] + [DoNotExport] + public class ExportTestStub : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ModuleName { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ExportsFolder { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string OutputFolder { get; set; } + + [Parameter] + public SwitchParameter IncludeGenerated { get; set; } + + protected override void ProcessRecord() + { + try + { + if (!Directory.Exists(ExportsFolder)) + { + throw new ArgumentException($"Exports folder '{ExportsFolder}' does not exist"); + } + + var exportDirectories = Directory.GetDirectories(ExportsFolder); + if (!exportDirectories.Any()) + { + exportDirectories = new[] { ExportsFolder }; + } + var utilFile = Path.Combine(OutputFolder, "utils.ps1"); + if (!File.Exists(utilFile)) + { + var sc = new StringBuilder(); + sc.AppendLine(@"function RandomString([bool]$allChars, [int32]$len) { + if ($allChars) { + return -join ((33..126) | Get-Random -Count $len | % {[char]$_}) + } else { + return -join ((48..57) + (97..122) | Get-Random -Count $len | % {[char]$_}) + } +} +function Start-TestSleep { + [CmdletBinding(DefaultParameterSetName = 'SleepBySeconds')] + param( + [parameter(Mandatory = $true, Position = 0, ParameterSetName = 'SleepBySeconds')] + [ValidateRange(0.0, 2147483.0)] + [double] $Seconds, + + [parameter(Mandatory = $true, ParameterSetName = 'SleepByMilliseconds')] + [ValidateRange('NonNegative')] + [Alias('ms')] + [int] $Milliseconds + ) + + if ($TestMode -ne 'playback') { + switch ($PSCmdlet.ParameterSetName) { + 'SleepBySeconds' { + Start-Sleep -Seconds $Seconds + } + 'SleepByMilliseconds' { + Start-Sleep -Milliseconds $Milliseconds + } + } + } +} + +$env = @{} +if ($UsePreviousConfigForRecord) { + $previousEnv = Get-Content (Join-Path $PSScriptRoot 'env.json') | ConvertFrom-Json + $previousEnv.psobject.properties | Foreach-Object { $env[$_.Name] = $_.Value } +} +# Add script method called AddWithCache to $env, when useCache is set true, it will try to get the value from the $env first. +# example: $val = $env.AddWithCache('key', $val, $true) +$env | Add-Member -Type ScriptMethod -Value { param( [string]$key, [object]$val, [bool]$useCache) if ($this.Contains($key) -and $useCache) { return $this[$key] } else { $this[$key] = $val; return $val } } -Name 'AddWithCache' +function setupEnv() { + # Preload subscriptionId and tenant from context, which will be used in test + # as default. You could change them if needed. + $env.SubscriptionId = (Get-AzContext).Subscription.Id + $env.Tenant = (Get-AzContext).Tenant.Id + # For any resources you created for test, you should add it to $env here. + $envFile = 'env.json' + if ($TestMode -eq 'live') { + $envFile = 'localEnv.json' + } + set-content -Path (Join-Path $PSScriptRoot $envFile) -Value (ConvertTo-Json $env) +} +function cleanupEnv() { + # Clean resources you create for testing +} +"); + File.WriteAllText(utilFile, sc.ToString()); + } + foreach (var exportDirectory in exportDirectories) + { + var outputFolder = OutputFolder; + if (exportDirectory != ExportsFolder) + { + outputFolder = Path.Combine(OutputFolder, Path.GetFileName(exportDirectory)); + Directory.CreateDirectory(outputFolder); + } + + var variantGroups = GetScriptCmdlets(exportDirectory) + .SelectMany(fi => fi.ToVariants()) + .Where(v => !v.IsDoNotExport) + .GroupBy(v => v.CmdletName) + .Select(vg => new VariantGroup(ModuleName, vg.Key, vg.Select(v => v).ToArray(), outputFolder, isTest: true)) + .Where(vtg => !File.Exists(vtg.FilePath) && (IncludeGenerated || !vtg.IsGenerated)); + + foreach (var variantGroup in variantGroups) + { + var sb = new StringBuilder(); + sb.AppendLine($"if(($null -eq $TestName) -or ($TestName -contains '{variantGroup.CmdletName}'))"); + sb.AppendLine(@"{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath)" +); + sb.AppendLine($@" $TestRecordingFile = Join-Path $PSScriptRoot '{variantGroup.CmdletName}.Recording.json'"); + sb.AppendLine(@" $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} +"); + + + sb.AppendLine($"Describe '{variantGroup.CmdletName}' {{"); + var variants = variantGroup.Variants + .Where(v => IncludeGenerated || !v.Attributes.OfType().Any()) + .ToList(); + + foreach (var variant in variants) + { + sb.AppendLine($"{Indent}It '{variant.VariantName}' -skip {{"); + sb.AppendLine($"{Indent}{Indent}{{ throw [System.NotImplementedException] }} | Should -Not -Throw"); + var variantSeparator = variants.IndexOf(variant) == variants.Count - 1 ? String.Empty : Environment.NewLine; + sb.AppendLine($"{Indent}}}{variantSeparator}"); + } + sb.AppendLine("}"); + + File.WriteAllText(variantGroup.FilePath, sb.ToString()); + } + } + } + catch (Exception ee) + { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + } +} diff --git a/src/Security/Security.Autorest/generated/runtime/BuildTime/Cmdlets/GetCommonParameter.cs b/src/Security/Security.Autorest/generated/runtime/BuildTime/Cmdlets/GetCommonParameter.cs new file mode 100644 index 000000000000..23fe060a16c4 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/BuildTime/Cmdlets/GetCommonParameter.cs @@ -0,0 +1,52 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.Collections.Generic; +using System.Linq; +using System.Management.Automation; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell +{ + [Cmdlet(VerbsCommon.Get, "CommonParameter")] + [OutputType(typeof(Dictionary))] + [DoNotExport] + public class GetCommonParameter : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public PSCmdlet PSCmdlet { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public Dictionary PSBoundParameter { get; set; } + + protected override void ProcessRecord() + { + try + { + var variants = PSCmdlet.MyInvocation.MyCommand.ToVariants(); + var commonParameterNames = variants.ToParameterGroups() + .Where(pg => pg.OrderCategory == ParameterCategory.Azure || pg.OrderCategory == ParameterCategory.Runtime) + .Select(pg => pg.ParameterName); + if (variants.Any(v => v.SupportsShouldProcess)) + { + commonParameterNames = commonParameterNames.Append("Confirm").Append("WhatIf"); + } + if (variants.Any(v => v.SupportsPaging)) + { + commonParameterNames = commonParameterNames.Append("First").Append("Skip").Append("IncludeTotalCount"); + } + + var names = commonParameterNames.ToArray(); + var keys = PSBoundParameter.Keys.Where(k => names.Contains(k)); + WriteObject(keys.ToDictionary(key => key, key => PSBoundParameter[key]), true); + } + catch (System.Exception ee) + { + System.Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + } +} diff --git a/src/Security/Security.Autorest/generated/runtime/BuildTime/Cmdlets/GetModuleGuid.cs b/src/Security/Security.Autorest/generated/runtime/BuildTime/Cmdlets/GetModuleGuid.cs new file mode 100644 index 000000000000..763956d0d115 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/BuildTime/Cmdlets/GetModuleGuid.cs @@ -0,0 +1,31 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.Management.Automation; +using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.PsHelpers; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell +{ + [Cmdlet(VerbsCommon.Get, "ModuleGuid")] + [DoNotExport] + public class GetModuleGuid : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string Psd1Path { get; set; } + + protected override void ProcessRecord() + { + try + { + WriteObject(ReadGuidFromPsd1(Psd1Path)); + } + catch (System.Exception ee) + { + System.Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + } +} diff --git a/src/Security/Security.Autorest/generated/runtime/BuildTime/Cmdlets/GetScriptCmdlet.cs b/src/Security/Security.Autorest/generated/runtime/BuildTime/Cmdlets/GetScriptCmdlet.cs new file mode 100644 index 000000000000..7c0b88862694 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/BuildTime/Cmdlets/GetScriptCmdlet.cs @@ -0,0 +1,54 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.Linq; +using System.Management.Automation; +using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.PsHelpers; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell +{ + [Cmdlet(VerbsCommon.Get, "ScriptCmdlet")] + [OutputType(typeof(string[]))] + [DoNotExport] + public class GetScriptCmdlet : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ScriptFolder { get; set; } + + [Parameter] + public SwitchParameter IncludeDoNotExport { get; set; } + + [Parameter] + public SwitchParameter AsAlias { get; set; } + + [Parameter] + public SwitchParameter AsFunctionInfo { get; set; } + + protected override void ProcessRecord() + { + try + { + var functionInfos = GetScriptCmdlets(this, ScriptFolder) + .Where(fi => IncludeDoNotExport || !fi.ScriptBlock.Attributes.OfType().Any()) + .ToArray(); + if (AsFunctionInfo) + { + WriteObject(functionInfos, true); + return; + } + var aliases = functionInfos.SelectMany(i => i.ScriptBlock.Attributes).ToAliasNames(); + var names = functionInfos.Select(fi => fi.Name).Distinct(); + var output = (AsAlias ? aliases : names).DefaultIfEmpty("''").ToArray(); + WriteObject(output, true); + } + catch (System.Exception ee) + { + System.Console.Error.WriteLine($"{ee.GetType().Name}: {ee.Message}"); + System.Console.Error.WriteLine(ee.StackTrace); + throw ee; + } + } + } +} diff --git a/src/Security/Security.Autorest/generated/runtime/BuildTime/CollectionExtensions.cs b/src/Security/Security.Autorest/generated/runtime/BuildTime/CollectionExtensions.cs new file mode 100644 index 000000000000..f3eb85d63ec5 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/BuildTime/CollectionExtensions.cs @@ -0,0 +1,20 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell +{ + internal static class CollectionExtensions + { + public static T[] NullIfEmpty(this T[] collection) => (collection?.Any() ?? false) ? collection : null; + public static IEnumerable EmptyIfNull(this IEnumerable collection) => collection ?? Enumerable.Empty(); + + // https://stackoverflow.com/a/4158364/294804 + public static IEnumerable DistinctBy(this IEnumerable collection, Func selector) => + collection.GroupBy(selector).Select(group => group.First()); + } +} diff --git a/src/Security/Security.Autorest/generated/runtime/BuildTime/MarkdownRenderer.cs b/src/Security/Security.Autorest/generated/runtime/BuildTime/MarkdownRenderer.cs new file mode 100644 index 000000000000..03cf5f1eab31 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/BuildTime/MarkdownRenderer.cs @@ -0,0 +1,122 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.MarkdownTypesExtensions; +using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.PsProxyOutputExtensions; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell +{ + internal static class MarkdownRenderer + { + public static void WriteMarkdowns(IEnumerable variantGroups, PsModuleHelpInfo moduleHelpInfo, string docsFolder, string examplesFolder, bool AddComplexInterfaceInfo = true) + { + Directory.CreateDirectory(docsFolder); + var markdownInfos = variantGroups.Where(vg => !vg.IsInternal).Select(vg => new MarkdownHelpInfo(vg, examplesFolder)).OrderBy(mhi => mhi.CmdletName).ToArray(); + + foreach (var markdownInfo in markdownInfos) + { + var sb = new StringBuilder(); + sb.Append(markdownInfo.ToHelpMetadataOutput()); + sb.Append($"# {markdownInfo.CmdletName}{Environment.NewLine}{Environment.NewLine}"); + sb.Append($"## SYNOPSIS{Environment.NewLine}{markdownInfo.Synopsis.ToDescriptionFormat()}{Environment.NewLine}{Environment.NewLine}"); + + sb.Append($"## SYNTAX{Environment.NewLine}{Environment.NewLine}"); + var hasMultipleParameterSets = markdownInfo.SyntaxInfos.Length > 1; + foreach (var syntaxInfo in markdownInfo.SyntaxInfos) + { + sb.Append(syntaxInfo.ToHelpSyntaxOutput(hasMultipleParameterSets)); + } + + sb.Append($"## DESCRIPTION{Environment.NewLine}{markdownInfo.Description.ToDescriptionFormat()}{Environment.NewLine}{Environment.NewLine}"); + + sb.Append($"## EXAMPLES{Environment.NewLine}{Environment.NewLine}"); + foreach (var exampleInfo in markdownInfo.Examples) + { + sb.Append(exampleInfo.ToHelpExampleOutput()); + } + + sb.Append($"## PARAMETERS{Environment.NewLine}{Environment.NewLine}"); + foreach (var parameter in markdownInfo.Parameters) + { + sb.Append(parameter.ToHelpParameterOutput()); + } + if (markdownInfo.SupportsShouldProcess) + { + foreach (var parameter in SupportsShouldProcessParameters) + { + sb.Append(parameter.ToHelpParameterOutput()); + } + } + + sb.Append($"### CommonParameters{Environment.NewLine}This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).{Environment.NewLine}{Environment.NewLine}"); + + sb.Append($"## INPUTS{Environment.NewLine}{Environment.NewLine}"); + foreach (var input in markdownInfo.Inputs) + { + sb.Append($"### {input}{Environment.NewLine}{Environment.NewLine}"); + } + + sb.Append($"## OUTPUTS{Environment.NewLine}{Environment.NewLine}"); + foreach (var output in markdownInfo.Outputs) + { + sb.Append($"### {output}{Environment.NewLine}{Environment.NewLine}"); + } + + sb.Append($"## NOTES{Environment.NewLine}{Environment.NewLine}"); + if (markdownInfo.Aliases.Any()) + { + sb.Append($"ALIASES{Environment.NewLine}{Environment.NewLine}"); + } + foreach (var alias in markdownInfo.Aliases) + { + sb.Append($"{alias}{Environment.NewLine}{Environment.NewLine}"); + } + + if (AddComplexInterfaceInfo) + { + if (markdownInfo.ComplexInterfaceInfos.Any()) + { + sb.Append($"{ComplexParameterHeader}{Environment.NewLine}"); + } + foreach (var complexInterfaceInfo in markdownInfo.ComplexInterfaceInfos) + { + sb.Append($"{complexInterfaceInfo.ToNoteOutput(includeDashes: true, includeBackticks: true)}{Environment.NewLine}{Environment.NewLine}"); + } + + } + + sb.Append($"## RELATED LINKS{Environment.NewLine}{Environment.NewLine}"); + foreach (var relatedLink in markdownInfo.RelatedLinks) + { + sb.Append($"[{relatedLink}]({relatedLink}){Environment.NewLine}{Environment.NewLine}"); + } + + File.WriteAllText(Path.Combine(docsFolder, $"{markdownInfo.CmdletName}.md"), sb.ToString()); + } + + WriteModulePage(moduleHelpInfo, markdownInfos, docsFolder); + } + + private static void WriteModulePage(PsModuleHelpInfo moduleInfo, MarkdownHelpInfo[] markdownInfos, string docsFolder) + { + var sb = new StringBuilder(); + sb.Append(moduleInfo.ToModulePageMetadataOutput()); + sb.Append($"# {moduleInfo.Name} Module{Environment.NewLine}"); + sb.Append($"## Description{Environment.NewLine}{moduleInfo.Description.ToDescriptionFormat()}{Environment.NewLine}{Environment.NewLine}"); + + sb.Append($"## {moduleInfo.Name} Cmdlets{Environment.NewLine}"); + foreach (var markdownInfo in markdownInfos) + { + sb.Append(markdownInfo.ToModulePageCmdletOutput()); + } + + File.WriteAllText(Path.Combine(docsFolder, $"{moduleInfo.Name}.md"), sb.ToString()); + } + } +} diff --git a/src/Security/Security.Autorest/generated/runtime/BuildTime/Models/PsFormatTypes.cs b/src/Security/Security.Autorest/generated/runtime/BuildTime/Models/PsFormatTypes.cs new file mode 100644 index 000000000000..a1ff26769c3e --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/BuildTime/Models/PsFormatTypes.cs @@ -0,0 +1,138 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Xml.Serialization; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell +{ + internal class ViewParameters + { + public Type Type { get; } + public IEnumerable Properties { get; } + + public ViewParameters(Type type, IEnumerable properties) + { + Type = type; + Properties = properties; + } + } + + internal class PropertyFormat + { + public PropertyInfo Property { get; } + public FormatTableAttribute FormatTable { get; } + + public int? Index { get; } + public string Label { get; } + public int? Width { get; } + public PropertyOrigin? Origin { get; } + + public PropertyFormat(PropertyInfo propertyInfo) + { + Property = propertyInfo; + FormatTable = Property.GetCustomAttributes().FirstOrDefault(); + var origin = Property.GetCustomAttributes().FirstOrDefault(); + + Index = FormatTable?.HasIndex ?? false ? (int?)FormatTable.Index : null; + Label = FormatTable?.Label ?? propertyInfo.Name; + Width = FormatTable?.HasWidth ?? false ? (int?)FormatTable.Width : null; + // If we have an index, we don't want to use Origin. + Origin = FormatTable?.HasIndex ?? false ? null : origin?.Origin; + } + } + + [Serializable] + [XmlRoot(nameof(Configuration))] + public class Configuration + { + [XmlElement("ViewDefinitions")] + public ViewDefinitions ViewDefinitions { get; set; } + } + + [Serializable] + public class ViewDefinitions + { + //https://stackoverflow.com/a/10518657/294804 + [XmlElement("View")] + public List Views { get; set; } + } + + [Serializable] + public class View + { + [XmlElement(nameof(Name))] + public string Name { get; set; } + [XmlElement(nameof(ViewSelectedBy))] + public ViewSelectedBy ViewSelectedBy { get; set; } + [XmlElement(nameof(TableControl))] + public TableControl TableControl { get; set; } + } + + [Serializable] + public class ViewSelectedBy + { + [XmlElement(nameof(TypeName))] + public string TypeName { get; set; } + } + + [Serializable] + public class TableControl + { + [XmlElement(nameof(TableHeaders))] + public TableHeaders TableHeaders { get; set; } + [XmlElement(nameof(TableRowEntries))] + public TableRowEntries TableRowEntries { get; set; } + } + + [Serializable] + public class TableHeaders + { + [XmlElement("TableColumnHeader")] + public List TableColumnHeaders { get; set; } + } + + [Serializable] + public class TableColumnHeader + { + [XmlElement(nameof(Label))] + public string Label { get; set; } + [XmlElement(nameof(Width))] + public int? Width { get; set; } + + //https://stackoverflow.com/a/4095225/294804 + public bool ShouldSerializeWidth() => Width.HasValue; + } + + [Serializable] + public class TableRowEntries + { + [XmlElement(nameof(TableRowEntry))] + public TableRowEntry TableRowEntry { get; set; } + } + + [Serializable] + public class TableRowEntry + { + [XmlElement(nameof(TableColumnItems))] + public TableColumnItems TableColumnItems { get; set; } + } + + [Serializable] + public class TableColumnItems + { + [XmlElement("TableColumnItem")] + public List TableItems { get; set; } + } + + [Serializable] + public class TableColumnItem + { + [XmlElement(nameof(PropertyName))] + public string PropertyName { get; set; } + } +} diff --git a/src/Security/Security.Autorest/generated/runtime/BuildTime/Models/PsHelpMarkdownOutputs.cs b/src/Security/Security.Autorest/generated/runtime/BuildTime/Models/PsHelpMarkdownOutputs.cs new file mode 100644 index 000000000000..3b267faa8b45 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/BuildTime/Models/PsHelpMarkdownOutputs.cs @@ -0,0 +1,199 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Linq; +using System.Management.Automation; +using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.PsHelpOutputExtensions; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell +{ + internal class HelpMetadataOutput + { + public MarkdownHelpInfo HelpInfo { get; } + + public HelpMetadataOutput(MarkdownHelpInfo helpInfo) + { + HelpInfo = helpInfo; + } + + public override string ToString() => $@"--- +external help file:{(!String.IsNullOrEmpty(HelpInfo.ExternalHelpFilename) ? $" {HelpInfo.ExternalHelpFilename}" : String.Empty)} +Module Name: {HelpInfo.ModuleName} +online version: {HelpInfo.OnlineVersion} +schema: {HelpInfo.Schema.ToString(3)} +--- + +"; + } + + internal class HelpSyntaxOutput + { + public MarkdownSyntaxHelpInfo SyntaxInfo { get; } + public bool HasMultipleParameterSets { get; } + + public HelpSyntaxOutput(MarkdownSyntaxHelpInfo syntaxInfo, bool hasMultipleParameterSets) + { + SyntaxInfo = syntaxInfo; + HasMultipleParameterSets = hasMultipleParameterSets; + } + + public override string ToString() + { + var psnText = HasMultipleParameterSets ? $"### {SyntaxInfo.ParameterSetName}{(SyntaxInfo.IsDefault ? " (Default)" : String.Empty)}{Environment.NewLine}" : String.Empty; + return $@"{psnText}``` +{SyntaxInfo.SyntaxText} +``` + +"; + } + } + + internal class HelpExampleOutput + { + private string ExampleTemplate = + "{0}{1}" + Environment.NewLine + + "{2}" + Environment.NewLine + "{3}" + Environment.NewLine + "{4}" + Environment.NewLine + Environment.NewLine + + "{5}" + Environment.NewLine + Environment.NewLine; + + private string ExampleTemplateWithOutput = + "{0}{1}" + Environment.NewLine + + "{2}" + Environment.NewLine + "{3}" + Environment.NewLine + "{4}" + Environment.NewLine + Environment.NewLine + + "{5}" + Environment.NewLine + "{6}" + Environment.NewLine + "{7}" + Environment.NewLine + Environment.NewLine + + "{8}" + Environment.NewLine + Environment.NewLine; + + public MarkdownExampleHelpInfo ExampleInfo { get; } + + public HelpExampleOutput(MarkdownExampleHelpInfo exampleInfo) + { + ExampleInfo = exampleInfo; + } + + public override string ToString() + { + if (string.IsNullOrEmpty(ExampleInfo.Output)) + { + return string.Format(ExampleTemplate, + ExampleNameHeader, ExampleInfo.Name, + ExampleCodeHeader, ExampleInfo.Code, ExampleCodeFooter, + ExampleInfo.Description.ToDescriptionFormat()); + } + else + { + return string.Format(ExampleTemplateWithOutput, + ExampleNameHeader, ExampleInfo.Name, + ExampleCodeHeader, ExampleInfo.Code, ExampleCodeFooter, + ExampleOutputHeader, ExampleInfo.Output, ExampleOutputFooter, + ExampleInfo.Description.ToDescriptionFormat()); ; + } + } + } + + internal class HelpParameterOutput + { + public MarkdownParameterHelpInfo ParameterInfo { get; } + + public HelpParameterOutput(MarkdownParameterHelpInfo parameterInfo) + { + ParameterInfo = parameterInfo; + } + + public override string ToString() + { + var pipelineInputTypes = new[] + { + ParameterInfo.AcceptsPipelineByValue ? "ByValue" : String.Empty, + ParameterInfo.AcceptsPipelineByPropertyName ? "ByPropertyName" : String.Empty + }.JoinIgnoreEmpty(", "); + var pipelineInput = ParameterInfo.AcceptsPipelineByValue || ParameterInfo.AcceptsPipelineByPropertyName + ? $@"{true} ({pipelineInputTypes})" + : false.ToString(); + + return $@"### -{ParameterInfo.Name} +{ParameterInfo.Description.ToDescriptionFormat()} + +```yaml +Type: {ParameterInfo.Type.FullName} +Parameter Sets: {(ParameterInfo.HasAllParameterSets ? "(All)" : ParameterInfo.ParameterSetNames.JoinIgnoreEmpty(", "))} +Aliases:{(ParameterInfo.Aliases.Any() ? $" {ParameterInfo.Aliases.JoinIgnoreEmpty(", ")}" : String.Empty)} + +Required: {ParameterInfo.IsRequired} +Position: {ParameterInfo.Position} +Default value: {ParameterInfo.DefaultValue} +Accept pipeline input: {pipelineInput} +Accept wildcard characters: {ParameterInfo.AcceptsWildcardCharacters} +``` + +"; + } + } + + internal class ModulePageMetadataOutput + { + public PsModuleHelpInfo ModuleInfo { get; } + + private static string HelpLinkPrefix { get; } = @"https://learn.microsoft.com/powershell/module/"; + + public ModulePageMetadataOutput(PsModuleHelpInfo moduleInfo) + { + ModuleInfo = moduleInfo; + } + + public override string ToString() => $@"--- +Module Name: {ModuleInfo.Name} +Module Guid: {ModuleInfo.Guid} +Download Help Link: {HelpLinkPrefix}{ModuleInfo.Name.ToLowerInvariant()} +Help Version: 1.0.0.0 +Locale: en-US +--- + +"; + } + + internal class ModulePageCmdletOutput + { + public MarkdownHelpInfo HelpInfo { get; } + + public ModulePageCmdletOutput(MarkdownHelpInfo helpInfo) + { + HelpInfo = helpInfo; + } + + public override string ToString() => $@"### [{HelpInfo.CmdletName}]({HelpInfo.CmdletName}.md) +{HelpInfo.Synopsis.ToDescriptionFormat()} + +"; + } + + internal static class PsHelpOutputExtensions + { + public static string EscapeAngleBrackets(this string text) => text?.Replace("<", @"\<").Replace(">", @"\>"); + public static string ReplaceSentenceEndWithNewline(this string text) => text?.Replace(". ", $".{Environment.NewLine}").Replace(". ", $".{Environment.NewLine}"); + public static string ReplaceBrWithNewline(this string text) => text?.Replace("
", $"{Environment.NewLine}"); + public static string ToDescriptionFormat(this string text, bool escapeAngleBrackets = true) + { + var description = text?.ReplaceBrWithNewline(); + description = escapeAngleBrackets ? description?.EscapeAngleBrackets() : description; + return description?.ReplaceSentenceEndWithNewline().Trim(); + } + + public const string ExampleNameHeader = "### "; + public const string ExampleCodeHeader = "```powershell"; + public const string ExampleCodeFooter = "```"; + public const string ExampleOutputHeader = "```output"; + public const string ExampleOutputFooter = "```"; + + public static HelpMetadataOutput ToHelpMetadataOutput(this MarkdownHelpInfo helpInfo) => new HelpMetadataOutput(helpInfo); + + public static HelpSyntaxOutput ToHelpSyntaxOutput(this MarkdownSyntaxHelpInfo syntaxInfo, bool hasMultipleParameterSets) => new HelpSyntaxOutput(syntaxInfo, hasMultipleParameterSets); + + public static HelpExampleOutput ToHelpExampleOutput(this MarkdownExampleHelpInfo exampleInfo) => new HelpExampleOutput(exampleInfo); + + public static HelpParameterOutput ToHelpParameterOutput(this MarkdownParameterHelpInfo parameterInfo) => new HelpParameterOutput(parameterInfo); + + public static ModulePageMetadataOutput ToModulePageMetadataOutput(this PsModuleHelpInfo moduleInfo) => new ModulePageMetadataOutput(moduleInfo); + + public static ModulePageCmdletOutput ToModulePageCmdletOutput(this MarkdownHelpInfo helpInfo) => new ModulePageCmdletOutput(helpInfo); + } +} diff --git a/src/Security/Security.Autorest/generated/runtime/BuildTime/Models/PsHelpTypes.cs b/src/Security/Security.Autorest/generated/runtime/BuildTime/Models/PsHelpTypes.cs new file mode 100644 index 000000000000..7fde138b60d5 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/BuildTime/Models/PsHelpTypes.cs @@ -0,0 +1,202 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Management.Automation; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell +{ + internal class PsHelpInfo + { + public string CmdletName { get; } + public string ModuleName { get; } + public string Synopsis { get; } + public string Description { get; } + public string AlertText { get; } + public string Category { get; } + public PsHelpLinkInfo OnlineVersion { get; } + public PsHelpLinkInfo[] RelatedLinks { get; } + public bool? HasCommonParameters { get; } + public bool? HasWorkflowCommonParameters { get; } + + public PsHelpTypeInfo[] InputTypes { get; } + public PsHelpTypeInfo[] OutputTypes { get; } + public PsHelpExampleInfo[] Examples { get; set; } + public string[] Aliases { get; } + + public PsParameterHelpInfo[] Parameters { get; } + public PsHelpSyntaxInfo[] Syntax { get; } + + public object Component { get; } + public object Functionality { get; } + public object PsSnapIn { get; } + public object Role { get; } + public string NonTerminatingErrors { get; } + + public PsHelpInfo(PSObject helpObject = null) + { + helpObject = helpObject ?? new PSObject(); + CmdletName = helpObject.GetProperty("Name").NullIfEmpty() ?? helpObject.GetNestedProperty("details", "name"); + ModuleName = helpObject.GetProperty("ModuleName"); + Synopsis = helpObject.GetProperty("Synopsis"); + Description = helpObject.GetProperty("description").EmptyIfNull().ToDescriptionText().NullIfEmpty() ?? + helpObject.GetNestedProperty("details", "description").EmptyIfNull().ToDescriptionText(); + AlertText = helpObject.GetNestedProperty("alertSet", "alert").EmptyIfNull().ToDescriptionText(); + Category = helpObject.GetProperty("Category"); + HasCommonParameters = helpObject.GetProperty("CommonParameters").ToNullableBool(); + HasWorkflowCommonParameters = helpObject.GetProperty("WorkflowCommonParameters").ToNullableBool(); + + var links = helpObject.GetNestedProperty("relatedLinks", "navigationLink").EmptyIfNull().Select(nl => nl.ToLinkInfo()).ToArray(); + OnlineVersion = links.FirstOrDefault(l => l.Text?.ToLowerInvariant().StartsWith("online version:") ?? links.Length == 1); + RelatedLinks = links.Where(l => !l.Text?.ToLowerInvariant().StartsWith("online version:") ?? links.Length != 1).ToArray(); + + InputTypes = helpObject.GetNestedProperty("inputTypes", "inputType").EmptyIfNull().Select(it => it.ToTypeInfo()).ToArray(); + OutputTypes = helpObject.GetNestedProperty("returnValues", "returnValue").EmptyIfNull().Select(rv => rv.ToTypeInfo()).ToArray(); + Examples = helpObject.GetNestedProperty("examples", "example").EmptyIfNull().Select(e => e.ToExampleInfo()).ToArray(); + Aliases = helpObject.GetProperty("aliases").EmptyIfNull().Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries); + + Parameters = helpObject.GetNestedProperty("parameters", "parameter").EmptyIfNull().Select(p => p.ToPsParameterHelpInfo()).ToArray(); + Syntax = helpObject.GetNestedProperty("syntax", "syntaxItem").EmptyIfNull().Select(si => si.ToSyntaxInfo()).ToArray(); + + Component = helpObject.GetProperty("Component"); + Functionality = helpObject.GetProperty("Functionality"); + PsSnapIn = helpObject.GetProperty("PSSnapIn"); + Role = helpObject.GetProperty("Role"); + NonTerminatingErrors = helpObject.GetProperty("nonTerminatingErrors"); + } + } + + internal class PsHelpTypeInfo + { + public string Name { get; } + public string Description { get; } + + public PsHelpTypeInfo(PSObject typeObject) + { + Name = typeObject.GetNestedProperty("type", "name").EmptyIfNull().Trim(); + Description = typeObject.GetProperty("description").EmptyIfNull().ToDescriptionText(); + } + } + + internal class PsHelpLinkInfo + { + public string Uri { get; } + public string Text { get; } + + public PsHelpLinkInfo(PSObject linkObject) + { + Uri = linkObject.GetProperty("uri"); + Text = linkObject.GetProperty("linkText"); + } + } + + internal class PsHelpSyntaxInfo + { + public string CmdletName { get; } + public PsParameterHelpInfo[] Parameters { get; } + + public PsHelpSyntaxInfo(PSObject syntaxObject) + { + CmdletName = syntaxObject.GetProperty("name"); + Parameters = syntaxObject.GetProperty("parameter").EmptyIfNull().Select(p => p.ToPsParameterHelpInfo()).ToArray(); + } + } + + internal class PsHelpExampleInfo + { + public string Title { get; } + public string Code { get; } + public string Output { get; } + public string Remarks { get; } + + public PsHelpExampleInfo(PSObject exampleObject) + { + Title = exampleObject.GetProperty("title"); + Code = exampleObject.GetProperty("code"); + Output = exampleObject.GetProperty("output"); + Remarks = exampleObject.GetProperty("remarks").EmptyIfNull().ToDescriptionText(); + } + public PsHelpExampleInfo(MarkdownExampleHelpInfo markdownExample) + { + Title = markdownExample.Name; + Code = markdownExample.Code; + Output = markdownExample.Output; + Remarks = markdownExample.Description; + } + + public static implicit operator PsHelpExampleInfo(MarkdownExampleHelpInfo markdownExample) => new PsHelpExampleInfo(markdownExample); + } + + internal class PsParameterHelpInfo + { + public string DefaultValueAsString { get; } + + public string Name { get; } + public string TypeName { get; } + public string Description { get; } + public string SupportsPipelineInput { get; } + public string PositionText { get; } + public string[] ParameterSetNames { get; } + public string[] Aliases { get; } + + public bool? SupportsGlobbing { get; } + public bool? IsRequired { get; } + public bool? IsVariableLength { get; } + public bool? IsDynamic { get; } + + public PsParameterHelpInfo(PSObject parameterHelpObject = null) + { + parameterHelpObject = parameterHelpObject ?? new PSObject(); + DefaultValueAsString = parameterHelpObject.GetProperty("defaultValue"); + Name = parameterHelpObject.GetProperty("name"); + TypeName = parameterHelpObject.GetProperty("parameterValue").NullIfEmpty() ?? parameterHelpObject.GetNestedProperty("type", "name"); + Description = parameterHelpObject.GetProperty("Description").EmptyIfNull().ToDescriptionText(); + SupportsPipelineInput = parameterHelpObject.GetProperty("pipelineInput"); + PositionText = parameterHelpObject.GetProperty("position"); + ParameterSetNames = parameterHelpObject.GetProperty("parameterSetName").EmptyIfNull().Split(new[] { ", " }, StringSplitOptions.RemoveEmptyEntries); + Aliases = parameterHelpObject.GetProperty("aliases").EmptyIfNull().Split(new[] { ", " }, StringSplitOptions.RemoveEmptyEntries); + + SupportsGlobbing = parameterHelpObject.GetProperty("globbing").ToNullableBool(); + IsRequired = parameterHelpObject.GetProperty("required").ToNullableBool(); + IsVariableLength = parameterHelpObject.GetProperty("variableLength").ToNullableBool(); + IsDynamic = parameterHelpObject.GetProperty("isDynamic").ToNullableBool(); + } + } + + internal class PsModuleHelpInfo + { + public string Name { get; } + public Guid Guid { get; } + public string Description { get; } + + public PsModuleHelpInfo(PSModuleInfo moduleInfo) + : this(moduleInfo?.Name ?? String.Empty, moduleInfo?.Guid ?? Guid.NewGuid(), moduleInfo?.Description ?? String.Empty) + { + } + + public PsModuleHelpInfo(string name, Guid guid, string description) + { + Name = name; + Guid = guid; + Description = description; + } + } + + internal static class HelpTypesExtensions + { + public static PsHelpInfo ToPsHelpInfo(this PSObject helpObject) => new PsHelpInfo(helpObject); + public static PsParameterHelpInfo ToPsParameterHelpInfo(this PSObject parameterHelpObject) => new PsParameterHelpInfo(parameterHelpObject); + + public static string ToDescriptionText(this IEnumerable descriptionObject) => descriptionObject != null + ? String.Join(Environment.NewLine, descriptionObject.Select(dl => dl.GetProperty("Text").EmptyIfNull())).NullIfWhiteSpace() + : null; + public static PsHelpTypeInfo ToTypeInfo(this PSObject typeObject) => new PsHelpTypeInfo(typeObject); + public static PsHelpExampleInfo ToExampleInfo(this PSObject exampleObject) => new PsHelpExampleInfo(exampleObject); + public static PsHelpLinkInfo ToLinkInfo(this PSObject linkObject) => new PsHelpLinkInfo(linkObject); + public static PsHelpSyntaxInfo ToSyntaxInfo(this PSObject syntaxObject) => new PsHelpSyntaxInfo(syntaxObject); + public static PsModuleHelpInfo ToModuleInfo(this PSModuleInfo moduleInfo) => new PsModuleHelpInfo(moduleInfo); + } +} diff --git a/src/Security/Security.Autorest/generated/runtime/BuildTime/Models/PsMarkdownTypes.cs b/src/Security/Security.Autorest/generated/runtime/BuildTime/Models/PsMarkdownTypes.cs new file mode 100644 index 000000000000..fc5a8e789ded --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/BuildTime/Models/PsMarkdownTypes.cs @@ -0,0 +1,329 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Management.Automation; +using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.MarkdownTypesExtensions; +using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.PsHelpOutputExtensions; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell +{ + internal class MarkdownHelpInfo + { + public string ExternalHelpFilename { get; } + public string ModuleName { get; } + public string OnlineVersion { get; } + public Version Schema { get; } + + public string CmdletName { get; } + public string[] Aliases { get; } + public string Synopsis { get; } + public string Description { get; } + + public MarkdownSyntaxHelpInfo[] SyntaxInfos { get; } + public MarkdownExampleHelpInfo[] Examples { get; } + public MarkdownParameterHelpInfo[] Parameters { get; } + + public string[] Inputs { get; } + public string[] Outputs { get; } + public ComplexInterfaceInfo[] ComplexInterfaceInfos { get; } + public MarkdownRelatedLinkInfo[] RelatedLinks { get; } + + public bool SupportsShouldProcess { get; } + public bool SupportsPaging { get; } + + public MarkdownHelpInfo(VariantGroup variantGroup, string examplesFolder, string externalHelpFilename = "") + { + ExternalHelpFilename = externalHelpFilename; + ModuleName = variantGroup.RootModuleName != "" ? variantGroup.RootModuleName : variantGroup.ModuleName; + var helpInfo = variantGroup.HelpInfo; + var commentInfo = variantGroup.CommentInfo; + Schema = Version.Parse("2.0.0"); + + CmdletName = variantGroup.CmdletName; + Aliases = (variantGroup.Aliases.NullIfEmpty() ?? helpInfo.Aliases).Where(a => a != "None").ToArray(); + Synopsis = commentInfo.Synopsis; + Description = commentInfo.Description; + + SyntaxInfos = variantGroup.Variants + .Select(v => new MarkdownSyntaxHelpInfo(v, variantGroup.ParameterGroups, v.VariantName == variantGroup.DefaultParameterSetName)) + .OrderByDescending(v => v.IsDefault).ThenBy(v => v.ParameterSetName).ToArray(); + Examples = GetExamplesFromMarkdown(examplesFolder).NullIfEmpty() + ?? helpInfo.Examples.Select(e => e.ToExampleHelpInfo()).ToArray().NullIfEmpty() + ?? DefaultExampleHelpInfos; + + Parameters = variantGroup.ParameterGroups + .Where(pg => !pg.DontShow && !pg.Parameters.All(p => p.IsHidden())) + .Select(pg => new MarkdownParameterHelpInfo( + variantGroup.Variants.SelectMany(v => v.HelpInfo.Parameters).Where(phi => phi.Name == pg.ParameterName).ToArray(), pg)) + .OrderBy(phi => phi.Name).ToArray(); + + Inputs = commentInfo.Inputs; + Outputs = commentInfo.Outputs; + + ComplexInterfaceInfos = variantGroup.ComplexInterfaceInfos; + OnlineVersion = commentInfo.OnlineVersion; + + var relatedLinkLists = new List(); + relatedLinkLists.AddRange(commentInfo.RelatedLinks?.Select(link => new MarkdownRelatedLinkInfo(link))); + relatedLinkLists.AddRange(variantGroup.Variants.SelectMany(v => v.Attributes).OfType()?.Distinct()?.Select(link => new MarkdownRelatedLinkInfo(link.Url, link.Description))); + RelatedLinks = relatedLinkLists?.ToArray(); + + SupportsShouldProcess = variantGroup.SupportsShouldProcess; + SupportsPaging = variantGroup.SupportsPaging; + } + + private MarkdownExampleHelpInfo[] GetExamplesFromMarkdown(string examplesFolder) + { + var filePath = Path.Combine(examplesFolder, $"{CmdletName}.md"); + if (!Directory.Exists(examplesFolder) || !File.Exists(filePath)) return null; + + var lines = File.ReadAllLines(filePath); + var nameIndices = lines.Select((l, i) => l.StartsWith(ExampleNameHeader) ? i : -1).Where(i => i != -1).ToArray(); + //https://codereview.stackexchange.com/a/187148/68772 + var indexCountGroups = nameIndices.Skip(1).Append(lines.Length).Zip(nameIndices, (next, current) => (NameIndex: current, LineCount: next - current)); + var exampleGroups = indexCountGroups.Select(icg => lines.Skip(icg.NameIndex).Take(icg.LineCount).ToArray()); + return exampleGroups.Select(eg => + { + var name = eg.First().Replace(ExampleNameHeader, String.Empty); + var codeStartIndex = eg.Select((l, i) => l.StartsWith(ExampleCodeHeader) ? (int?)i : null).FirstOrDefault(i => i.HasValue); + var codeEndIndex = eg.Select((l, i) => l.StartsWith(ExampleCodeFooter) ? (int?)i : null).FirstOrDefault(i => i.HasValue && i != codeStartIndex); + var code = codeStartIndex.HasValue && codeEndIndex.HasValue + ? String.Join(Environment.NewLine, eg.Skip(codeStartIndex.Value + 1).Take(codeEndIndex.Value - (codeStartIndex.Value + 1))) + : String.Empty; + var outputStartIndex = eg.Select((l, i) => l.StartsWith(ExampleOutputHeader) ? (int?)i : null).FirstOrDefault(i => i.HasValue); + var outputEndIndex = eg.Select((l, i) => l.StartsWith(ExampleOutputFooter) ? (int?)i : null).FirstOrDefault(i => i.HasValue && i > outputStartIndex); + var output = outputStartIndex.HasValue && outputEndIndex.HasValue + ? String.Join(Environment.NewLine, eg.Skip(outputStartIndex.Value + 1).Take(outputEndIndex.Value - (outputStartIndex.Value + 1))) + : String.Empty; + var descriptionStartIndex = (outputEndIndex ?? (codeEndIndex ?? 0)) + 1; + descriptionStartIndex = String.IsNullOrWhiteSpace(eg[descriptionStartIndex]) ? descriptionStartIndex + 1 : descriptionStartIndex; + var descriptionEndIndex = eg.Length - 1; + descriptionEndIndex = String.IsNullOrWhiteSpace(eg[descriptionEndIndex]) ? descriptionEndIndex - 1 : descriptionEndIndex; + var description = String.Join(Environment.NewLine, eg.Skip(descriptionStartIndex).Take((descriptionEndIndex + 1) - descriptionStartIndex)); + return new MarkdownExampleHelpInfo(name, code, output, description); + }).ToArray(); + } + } + + internal class MarkdownSyntaxHelpInfo + { + public Variant Variant { get; } + public bool IsDefault { get; } + public string ParameterSetName { get; } + public Parameter[] Parameters { get; } + public string SyntaxText { get; } + + public MarkdownSyntaxHelpInfo(Variant variant, ParameterGroup[] parameterGroups, bool isDefault) + { + Variant = variant; + IsDefault = isDefault; + ParameterSetName = Variant.VariantName; + Parameters = Variant.Parameters + .Where(p => !p.DontShow && !p.IsHidden()).OrderByDescending(p => p.IsMandatory) + //https://stackoverflow.com/a/6461526/294804 + .ThenByDescending(p => p.Position.HasValue).ThenBy(p => p.Position) + // Use the OrderCategory of the parameter group because the final order category is the highest of the group, and not the order category of the individual parameters from the variants. + .ThenBy(p => parameterGroups.First(pg => pg.ParameterName == p.ParameterName).OrderCategory).ThenBy(p => p.ParameterName).ToArray(); + SyntaxText = CreateSyntaxFormat(); + } + + //https://github.com/PowerShell/platyPS/blob/a607a926bfffe1e1a1e53c19e0057eddd0c07611/src/Markdown.MAML/Renderer/Markdownv2Renderer.cs#L29-L32 + private const int SyntaxLineWidth = 110; + private string CreateSyntaxFormat() + { + var parameterStrings = Parameters.Select(p => p.ToPropertySyntaxOutput().ToString()); + if (Variant.SupportsShouldProcess) + { + parameterStrings = parameterStrings.Append(" [-Confirm]").Append(" [-WhatIf]"); + } + parameterStrings = parameterStrings.Append(" []"); + + var lines = new List(20); + return parameterStrings.Aggregate(Variant.CmdletName, (current, ps) => + { + var combined = current + ps; + if (combined.Length <= SyntaxLineWidth) return combined; + + lines.Add(current); + return ps; + }, last => + { + lines.Add(last); + return String.Join(Environment.NewLine, lines); + }); + } + } + + internal class MarkdownExampleHelpInfo + { + public string Name { get; } + public string Code { get; } + public string Output { get; } + public string Description { get; } + + public MarkdownExampleHelpInfo(string name, string code, string output, string description) + { + Name = name; + Code = code; + Output = output; + Description = description; + } + } + + internal class MarkdownParameterHelpInfo + { + public string Name { get; set; } + public string Description { get; set; } + public Type Type { get; set; } + public string Position { get; set; } + public string DefaultValue { get; set; } + + public bool HasAllParameterSets { get; set; } + public string[] ParameterSetNames { get; set; } + public string[] Aliases { get; set; } + + public bool IsRequired { get; set; } + public bool IsDynamic { get; set; } + public bool AcceptsPipelineByValue { get; set; } + public bool AcceptsPipelineByPropertyName { get; set; } + public bool AcceptsWildcardCharacters { get; set; } + + // For use by common parameters that have no backing data in the objects themselves. + public MarkdownParameterHelpInfo() { } + + public MarkdownParameterHelpInfo(PsParameterHelpInfo[] parameterHelpInfos, ParameterGroup parameterGroup) + { + Name = parameterGroup.ParameterName; + Description = parameterGroup.Description.NullIfEmpty() + ?? parameterHelpInfos.Select(phi => phi.Description).FirstOrDefault(d => !String.IsNullOrEmpty(d)).EmptyIfNull(); + Type = parameterGroup.ParameterType; + Position = parameterGroup.FirstPosition?.ToString() + ?? parameterHelpInfos.Select(phi => phi.PositionText).FirstOrDefault(d => !String.IsNullOrEmpty(d)).ToUpperFirstCharacter().NullIfEmpty() + ?? "Named"; + // This no longer uses firstHelpInfo.DefaultValueAsString since it seems to be broken. For example, it has a value of 0 for Int32, but no default value was declared. + DefaultValue = parameterGroup.DefaultInfo?.Script ?? "None"; + + HasAllParameterSets = parameterGroup.HasAllVariants; + ParameterSetNames = (parameterGroup.Parameters.Select(p => p.VariantName).ToArray().NullIfEmpty() + ?? parameterHelpInfos.SelectMany(phi => phi.ParameterSetNames).Distinct()) + .OrderBy(psn => psn).ToArray(); + Aliases = parameterGroup.Aliases.NullIfEmpty() ?? parameterHelpInfos.SelectMany(phi => phi.Aliases).ToArray(); + + IsRequired = parameterHelpInfos.Select(phi => phi.IsRequired).FirstOrDefault(r => r == true) ?? parameterGroup.Parameters.Any(p => p.IsMandatory); + IsDynamic = parameterHelpInfos.Select(phi => phi.IsDynamic).FirstOrDefault(d => d == true) ?? false; + AcceptsPipelineByValue = parameterHelpInfos.Select(phi => phi.SupportsPipelineInput?.Contains("ByValue")).FirstOrDefault(bv => bv == true) ?? parameterGroup.ValueFromPipeline; + AcceptsPipelineByPropertyName = parameterHelpInfos.Select(phi => phi.SupportsPipelineInput?.Contains("ByPropertyName")).FirstOrDefault(bv => bv == true) ?? parameterGroup.ValueFromPipelineByPropertyName; + AcceptsWildcardCharacters = parameterGroup.SupportsWildcards; + } + } + + internal class MarkdownRelatedLinkInfo + { + public string Url { get; } + public string Description { get; } + + public MarkdownRelatedLinkInfo(string url) + { + Url = url; + } + + public MarkdownRelatedLinkInfo(string url, string description) + { + Url = url; + Description = description; + } + + public override string ToString() + { + if (string.IsNullOrEmpty(Description)) + { + return Url; + } + else + { + return $@"[{Description}]({Url})"; + + } + + } + } + + internal static class MarkdownTypesExtensions + { + public static MarkdownExampleHelpInfo ToExampleHelpInfo(this PsHelpExampleInfo exampleInfo) => new MarkdownExampleHelpInfo(exampleInfo.Title, exampleInfo.Code, exampleInfo.Output, exampleInfo.Remarks); + + public static MarkdownExampleHelpInfo[] DefaultExampleHelpInfos = + { + new MarkdownExampleHelpInfo("Example 1: {{ Add title here }}", $@"{{{{ Add code here }}}}", $@"{{{{ Add output here (remove the output block if the example doesn't have an output) }}}}", @"{{ Add description here }}"), + new MarkdownExampleHelpInfo("Example 2: {{ Add title here }}", $@"{{{{ Add code here }}}}", $@"{{{{ Add output here (remove the output block if the example doesn't have an output) }}}}", @"{{ Add description here }}"), + }; + + public static MarkdownParameterHelpInfo[] SupportsShouldProcessParameters = + { + new MarkdownParameterHelpInfo + { + Name = "Confirm", + Description ="Prompts you for confirmation before running the cmdlet.", + Type = typeof(SwitchParameter), + Position = "Named", + DefaultValue = "None", + HasAllParameterSets = true, + ParameterSetNames = new [] { "(All)" }, + Aliases = new [] { "cf" } + }, + new MarkdownParameterHelpInfo + { + Name = "WhatIf", + Description ="Shows what would happen if the cmdlet runs. The cmdlet is not run.", + Type = typeof(SwitchParameter), + Position = "Named", + DefaultValue = "None", + HasAllParameterSets = true, + ParameterSetNames = new [] { "(All)" }, + Aliases = new [] { "wi" } + } + }; + + public static MarkdownParameterHelpInfo[] SupportsPagingParameters = + { + new MarkdownParameterHelpInfo + { + Name = "First", + Description ="Gets only the first 'n' objects.", + Type = typeof(ulong), + Position = "Named", + DefaultValue = "None", + HasAllParameterSets = true, + ParameterSetNames = new [] { "(All)" }, + Aliases = new string[0] + }, + new MarkdownParameterHelpInfo + { + Name = "IncludeTotalCount", + Description ="Reports the number of objects in the data set (an integer) followed by the objects. If the cmdlet cannot determine the total count, it returns \"Unknown total count\".", + Type = typeof(SwitchParameter), + Position = "Named", + DefaultValue = "None", + HasAllParameterSets = true, + ParameterSetNames = new [] { "(All)" }, + Aliases = new string[0] + }, + new MarkdownParameterHelpInfo + { + Name = "Skip", + Description ="Ignores the first 'n' objects and then gets the remaining objects.", + Type = typeof(ulong), + Position = "Named", + DefaultValue = "None", + HasAllParameterSets = true, + ParameterSetNames = new [] { "(All)" }, + Aliases = new string[0] + } + }; + } +} diff --git a/src/Security/Security.Autorest/generated/runtime/BuildTime/Models/PsProxyOutputs.cs b/src/Security/Security.Autorest/generated/runtime/BuildTime/Models/PsProxyOutputs.cs new file mode 100644 index 000000000000..2b53448c92b9 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/BuildTime/Models/PsProxyOutputs.cs @@ -0,0 +1,644 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Management.Automation; +using System.Text; +using System.Text.RegularExpressions; +using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.PsProxyOutputExtensions; +using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.PsProxyTypeExtensions; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell +{ + internal class OutputTypeOutput + { + public PSTypeName[] OutputTypes { get; } + + public OutputTypeOutput(IEnumerable outputTypes) + { + OutputTypes = outputTypes.ToArray(); + } + + public override string ToString() => OutputTypes != null && OutputTypes.Any() ? $"[OutputType({OutputTypes.Select(ot => $"[{ot}]").JoinIgnoreEmpty(ItemSeparator)})]{Environment.NewLine}" : String.Empty; + } + + internal class CmdletBindingOutput + { + public VariantGroup VariantGroup { get; } + + public CmdletBindingOutput(VariantGroup variantGroup) + { + VariantGroup = variantGroup; + } + + public override string ToString() + { + var dpsText = VariantGroup.DefaultParameterSetName.IsValidDefaultParameterSetName() ? $"DefaultParameterSetName='{VariantGroup.DefaultParameterSetName}'" : String.Empty; + var sspText = VariantGroup.SupportsShouldProcess ? $"SupportsShouldProcess{ItemSeparator}ConfirmImpact='Medium'" : String.Empty; + var pbText = $"PositionalBinding={false.ToPsBool()}"; + var propertyText = new[] { dpsText, pbText, sspText }.JoinIgnoreEmpty(ItemSeparator); + return $"[CmdletBinding({propertyText})]{Environment.NewLine}"; + } + } + + internal class ParameterOutput + { + public Parameter Parameter { get; } + public bool HasMultipleVariantsInVariantGroup { get; } + public bool HasAllVariantsInParameterGroup { get; } + + public ParameterOutput(Parameter parameter, bool hasMultipleVariantsInVariantGroup, bool hasAllVariantsInParameterGroup) + { + Parameter = parameter; + HasMultipleVariantsInVariantGroup = hasMultipleVariantsInVariantGroup; + HasAllVariantsInParameterGroup = hasAllVariantsInParameterGroup; + } + + public override string ToString() + { + var psnText = HasMultipleVariantsInVariantGroup && !HasAllVariantsInParameterGroup ? $"ParameterSetName='{Parameter.VariantName}'" : String.Empty; + var positionText = Parameter.Position != null ? $"Position={Parameter.Position}" : String.Empty; + var mandatoryText = Parameter.IsMandatory ? "Mandatory" : String.Empty; + var dontShowText = Parameter.DontShow ? "DontShow" : String.Empty; + var vfpText = Parameter.ValueFromPipeline ? "ValueFromPipeline" : String.Empty; + var vfpbpnText = Parameter.ValueFromPipelineByPropertyName ? "ValueFromPipelineByPropertyName" : String.Empty; + var propertyText = new[] { psnText, positionText, mandatoryText, dontShowText, vfpText, vfpbpnText }.JoinIgnoreEmpty(ItemSeparator); + return $"{Indent}[Parameter({propertyText})]{Environment.NewLine}"; + } + } + + internal class AliasOutput + { + public string[] Aliases { get; } + public bool IncludeIndent { get; } + + public AliasOutput(string[] aliases, bool includeIndent = false) + { + Aliases = aliases; + IncludeIndent = includeIndent; + } + + public override string ToString() => Aliases?.Any() ?? false ? $"{(IncludeIndent ? Indent : String.Empty)}[Alias({Aliases.Select(an => $"'{an}'").JoinIgnoreEmpty(ItemSeparator)})]{Environment.NewLine}" : String.Empty; + } + + internal class ValidateNotNullOutput + { + public bool HasValidateNotNull { get; } + + public ValidateNotNullOutput(bool hasValidateNotNull) + { + HasValidateNotNull = hasValidateNotNull; + } + + public override string ToString() => HasValidateNotNull ? $"{Indent}[ValidateNotNull()]{Environment.NewLine}" : String.Empty; + } + + internal class AllowEmptyArrayOutput + { + public bool HasAllowEmptyArray { get; } + + public AllowEmptyArrayOutput(bool hasAllowEmptyArray) + { + HasAllowEmptyArray = hasAllowEmptyArray; + } + + public override string ToString() => HasAllowEmptyArray ? $"{Indent}[AllowEmptyCollection()]{Environment.NewLine}" : String.Empty; + } + internal class ArgumentCompleterOutput + { + public CompleterInfo CompleterInfo { get; } + + public ArgumentCompleterOutput(CompleterInfo completerInfo) + { + CompleterInfo = completerInfo; + } + + public override string ToString() => CompleterInfo != null + ? $"{Indent}[ArgumentCompleter({(CompleterInfo.IsTypeCompleter ? $"[{CompleterInfo.Type.Unwrap().ToPsType()}]" : $"{{{CompleterInfo.Script.ToPsSingleLine("; ")}}}")})]{Environment.NewLine}" + : String.Empty; + } + + internal class PSArgumentCompleterOutput : ArgumentCompleterOutput + { + public PSArgumentCompleterInfo PSArgumentCompleterInfo { get; } + + public PSArgumentCompleterOutput(PSArgumentCompleterInfo completerInfo) : base(completerInfo) + { + PSArgumentCompleterInfo = completerInfo; + } + + + public override string ToString() => PSArgumentCompleterInfo != null + ? $"{Indent}[{typeof(PSArgumentCompleterAttribute)}({(PSArgumentCompleterInfo.IsTypeCompleter ? $"[{PSArgumentCompleterInfo.Type.Unwrap().ToPsType()}]" : $"{PSArgumentCompleterInfo.ResourceTypes?.Select(r => $"\"{r}\"")?.JoinIgnoreEmpty(", ")}")})]{Environment.NewLine}" + : String.Empty; + } + + internal class DefaultInfoOutput + { + public bool HasDefaultInfo { get; } + public DefaultInfo DefaultInfo { get; } + + public DefaultInfoOutput(ParameterGroup parameterGroup) + { + HasDefaultInfo = parameterGroup.HasDefaultInfo; + DefaultInfo = parameterGroup.DefaultInfo; + } + + public override string ToString() + { + var nameText = !String.IsNullOrEmpty(DefaultInfo?.Name) ? $"Name='{DefaultInfo?.Name}'" : String.Empty; + var descriptionText = !String.IsNullOrEmpty(DefaultInfo?.Description) ? $"Description='{DefaultInfo?.Description.ToPsStringLiteral()}'" : String.Empty; + var scriptText = !String.IsNullOrEmpty(DefaultInfo?.Script) ? $"Script='{DefaultInfo?.Script.ToPsSingleLine("; ")}'" : String.Empty; + var propertyText = new[] { nameText, descriptionText, scriptText }.JoinIgnoreEmpty(ItemSeparator); + return HasDefaultInfo ? $"{Indent}[{typeof(DefaultInfoAttribute).ToPsAttributeType()}({propertyText})]{Environment.NewLine}" : String.Empty; + } + } + + internal class ParameterTypeOutput + { + public Type ParameterType { get; } + + public ParameterTypeOutput(Type parameterType) + { + ParameterType = parameterType; + } + + public override string ToString() => $"{Indent}[{ParameterType.ToPsType()}]{Environment.NewLine}"; + } + + internal class ParameterNameOutput + { + public string ParameterName { get; } + public bool IsLast { get; } + + public ParameterNameOutput(string parameterName, bool isLast) + { + ParameterName = parameterName; + IsLast = isLast; + } + + public override string ToString() => $"{Indent}${{{ParameterName}}}{(IsLast ? String.Empty : $",{Environment.NewLine}")}{Environment.NewLine}"; + } + + internal class BaseOutput + { + public VariantGroup VariantGroup { get; } + + protected static readonly bool IsAzure = Convert.ToBoolean(@"true"); + + public BaseOutput(VariantGroup variantGroup) + { + VariantGroup = variantGroup; + } + public string ClearTelemetryContext() + { + return (!VariantGroup.IsInternal && IsAzure) ? $@"{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext()" : ""; + } + } + + internal class BeginOutput : BaseOutput + { + public BeginOutput(VariantGroup variantGroup) : base(variantGroup) + { + } + + public string GetProcessCustomAttributesAtRuntime() + { + return VariantGroup.IsInternal ? "" : IsAzure ? $@"{Indent}{Indent}$cmdInfo = Get-Command -Name $mapping[$parameterSet] +{Indent}{Indent}[Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) +{Indent}{Indent}if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){{ +{Indent}{Indent}{Indent}[Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) +{Indent}{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) +{Indent}{Indent}}}" : $@"{Indent}{Indent}$cmdInfo = Get-Command -Name $mapping[$parameterSet]{Environment.NewLine}{Indent}{Indent}[Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) +{Indent}{Indent}[Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)"; + } + + private string GetTelemetry() + { + if (!VariantGroup.IsInternal && IsAzure) + { + return $@" +{Indent}{Indent}if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) {{ +{Indent}{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() +{Indent}{Indent}}} +{Indent}{Indent}$preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId +{Indent}{Indent}if ($preTelemetryId -eq '') {{ +{Indent}{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() +{Indent}{Indent}{Indent}[Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) +{Indent}{Indent}}} else {{ +{Indent}{Indent}{Indent}$internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets +{Indent}{Indent}{Indent}if ($internalCalledCmdlets -eq '') {{ +{Indent}{Indent}{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name +{Indent}{Indent}{Indent}}} else {{ +{Indent}{Indent}{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name +{Indent}{Indent}{Indent}}} +{Indent}{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' +{Indent}{Indent}}} +"; + } + return ""; + } + public override string ToString() => $@"begin {{ +{Indent}try {{ +{Indent}{Indent}$outBuffer = $null +{Indent}{Indent}if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) {{ +{Indent}{Indent}{Indent}$PSBoundParameters['OutBuffer'] = 1 +{Indent}{Indent}}} +{Indent}{Indent}$parameterSet = $PSCmdlet.ParameterSetName +{GetTelemetry()} +{GetParameterSetToCmdletMapping()}{GetDefaultValuesStatements()} +{GetProcessCustomAttributesAtRuntime()} +{Indent}{Indent}$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) +{Indent}{Indent}$scriptCmd = {{& $wrappedCmd @PSBoundParameters}} +{Indent}{Indent}$steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) +{Indent}{Indent}$steppablePipeline.Begin($PSCmdlet) +{Indent}}} catch {{ +{ClearTelemetryContext()} +{Indent}{Indent}throw +{Indent}}} +}} + +"; + + private string GetParameterSetToCmdletMapping() + { + var sb = new StringBuilder(); + sb.AppendLine($"{Indent}{Indent}$mapping = @{{"); + foreach (var variant in VariantGroup.Variants) + { + sb.AppendLine($@"{Indent}{Indent}{Indent}{variant.VariantName} = '{variant.PrivateModuleName}\{variant.PrivateCmdletName}';"); + } + sb.Append($"{Indent}{Indent}}}"); + return sb.ToString(); + } + + private string GetDefaultValuesStatements() + { + var defaultInfos = VariantGroup.ParameterGroups.Where(pg => pg.HasDefaultInfo).Select(pg => pg.DefaultInfo).ToArray(); + var sb = new StringBuilder(); + + foreach (var defaultInfo in defaultInfos) + { + var variantListString = defaultInfo.ParameterGroup.VariantNames.ToPsList(); + var parameterName = defaultInfo.ParameterGroup.ParameterName; + sb.AppendLine(); + var setCondition = " "; + if (!String.IsNullOrEmpty(defaultInfo.SetCondition)) + { + setCondition = $" -and {defaultInfo.SetCondition}"; + } + sb.AppendLine($"{Indent}{Indent}if (({variantListString}) -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('{parameterName}'){setCondition}) {{"); + sb.AppendLine($"{Indent}{Indent}{Indent}$PSBoundParameters['{parameterName}'] = {defaultInfo.Script}"); + sb.Append($"{Indent}{Indent}}}"); + } + return sb.ToString(); + } + + } + + internal class ProcessOutput : BaseOutput + { + public ProcessOutput(VariantGroup variantGroup) : base(variantGroup) + { + } + + private string GetFinally() + { + if (IsAzure && !VariantGroup.IsInternal) + { + return $@" +{Indent}finally {{ +{Indent}{Indent}$backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId +{Indent}{Indent}$backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets +{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() +{Indent}}} +"; + } + return ""; + } + public override string ToString() => $@"process {{ +{Indent}try {{ +{Indent}{Indent}$steppablePipeline.Process($_) +{Indent}}} catch {{ +{ClearTelemetryContext()} +{Indent}{Indent}throw +{Indent}}} +{GetFinally()} +}} +"; + } + + internal class EndOutput : BaseOutput + { + public EndOutput(VariantGroup variantGroup) : base(variantGroup) + { + } + + private string GetTelemetry() + { + if (!VariantGroup.IsInternal && IsAzure) + { + return $@" +{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId +{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets +{Indent}{Indent}if ($preTelemetryId -eq '') {{ +{Indent}{Indent}{Indent}[Microsoft.Azure.PowerShell.Cmdlets.Security.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) +{Indent}{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() +{Indent}{Indent}}} +{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId +"; + } + return ""; + } + public override string ToString() => $@"end {{ +{Indent}try {{ +{Indent}{Indent}$steppablePipeline.End() +{GetTelemetry()} +{Indent}}} catch {{ +{ClearTelemetryContext()} +{Indent}{Indent}throw +{Indent}}} +}} +"; + } + + internal class HelpCommentOutput + { + public VariantGroup VariantGroup { get; } + public CommentInfo CommentInfo { get; } + + public HelpCommentOutput(VariantGroup variantGroup) + { + VariantGroup = variantGroup; + CommentInfo = variantGroup.CommentInfo; + } + + public override string ToString() + { + var inputs = String.Join(Environment.NewLine, CommentInfo.Inputs.Select(i => $".Inputs{Environment.NewLine}{i}")); + var inputsText = !String.IsNullOrEmpty(inputs) ? $"{Environment.NewLine}{inputs}" : String.Empty; + var outputs = String.Join(Environment.NewLine, CommentInfo.Outputs.Select(o => $".Outputs{Environment.NewLine}{o}")); + var outputsText = !String.IsNullOrEmpty(outputs) ? $"{Environment.NewLine}{outputs}" : String.Empty; + var notes = String.Join($"{Environment.NewLine}{Environment.NewLine}", VariantGroup.ComplexInterfaceInfos.Select(cii => cii.ToNoteOutput())); + var notesText = !String.IsNullOrEmpty(notes) ? $"{Environment.NewLine}.Notes{Environment.NewLine}{ComplexParameterHeader}{notes}" : String.Empty; + var relatedLinks = String.Join(Environment.NewLine, CommentInfo.RelatedLinks.Select(l => $".Link{Environment.NewLine}{l}")); + var relatedLinksText = !String.IsNullOrEmpty(relatedLinks) ? $"{Environment.NewLine}{relatedLinks}" : String.Empty; + var externalUrls = String.Join(Environment.NewLine, CommentInfo.ExternalUrls.Select(l => $".Link{Environment.NewLine}{l}")); + var externalUrlsText = !String.IsNullOrEmpty(externalUrls) ? $"{Environment.NewLine}{externalUrls}" : String.Empty; + var examples = ""; + foreach (var example in VariantGroup.HelpInfo.Examples) + { + examples = examples + ".Example" + "\r\n" + example.Code + "\r\n"; + } + return $@"<# +.Synopsis +{CommentInfo.Synopsis.ToDescriptionFormat(false)} +.Description +{CommentInfo.Description.ToDescriptionFormat(false)} +{examples}{inputsText}{outputsText}{notesText} +.Link +{CommentInfo.OnlineVersion}{relatedLinksText}{externalUrlsText} +#> +"; + } + } + + internal class ParameterDescriptionOutput + { + public string Description { get; } + + public ParameterDescriptionOutput(string description) + { + Description = description; + } + + public override string ToString() => !String.IsNullOrEmpty(Description) + ? Description.ToDescriptionFormat(false).NormalizeNewLines() + .Split(new[] { Environment.NewLine }, StringSplitOptions.None) + .Aggregate(String.Empty, (c, n) => c + $"{Indent}# {n}{Environment.NewLine}") + : String.Empty; + } + + internal class ProfileOutput + { + public string ProfileName { get; } + + public ProfileOutput(string profileName) + { + ProfileName = profileName; + } + + public override string ToString() => ProfileName != NoProfiles ? $"[{typeof(ProfileAttribute).ToPsAttributeType()}('{ProfileName}')]{Environment.NewLine}" : String.Empty; + } + + internal class DescriptionOutput + { + public string Description { get; } + + public DescriptionOutput(string description) + { + Description = description; + } + + public override string ToString() => !String.IsNullOrEmpty(Description) ? $"[{typeof(DescriptionAttribute).ToPsAttributeType()}('{Description.ToPsStringLiteral()}')]{Environment.NewLine}" : String.Empty; + } + + internal class ParameterCategoryOutput + { + public ParameterCategory Category { get; } + + public ParameterCategoryOutput(ParameterCategory category) + { + Category = category; + } + + public override string ToString() => $"{Indent}[{typeof(CategoryAttribute).ToPsAttributeType()}('{Category}')]{Environment.NewLine}"; + } + + internal class InfoOutput + { + public InfoAttribute Info { get; } + public Type ParameterType { get; } + + public InfoOutput(InfoAttribute info, Type parameterType) + { + Info = info; + ParameterType = parameterType; + } + + public override string ToString() + { + // Rendering of InfoAttribute members that are not used currently + /*var serializedNameText = Info.SerializedName != null ? $"SerializedName='{Info.SerializedName}'" : String.Empty; + var readOnlyText = Info.ReadOnly ? "ReadOnly" : String.Empty; + var descriptionText = !String.IsNullOrEmpty(Info.Description) ? $"Description='{Info.Description.ToPsStringLiteral()}'" : String.Empty;*/ + + var requiredText = Info.Required ? "Required" : String.Empty; + var unwrappedType = ParameterType.Unwrap(); + var hasValidPossibleTypes = Info.PossibleTypes.Any(pt => pt != unwrappedType); + var possibleTypesText = hasValidPossibleTypes + ? $"PossibleTypes=({Info.PossibleTypes.Select(pt => $"[{pt.ToPsType()}]").JoinIgnoreEmpty(ItemSeparator)})" + : String.Empty; + var propertyText = new[] { /*serializedNameText, */requiredText,/* readOnlyText,*/ possibleTypesText/*, descriptionText*/ }.JoinIgnoreEmpty(ItemSeparator); + return hasValidPossibleTypes ? $"{Indent}[{typeof(InfoAttribute).ToPsAttributeType()}({propertyText})]{Environment.NewLine}" : String.Empty; + } + } + + internal class PropertySyntaxOutput + { + public string ParameterName { get; } + public Type ParameterType { get; } + public bool IsMandatory { get; } + public int? Position { get; } + + public bool IncludeSpace { get; } + public bool IncludeDash { get; } + + public PropertySyntaxOutput(Parameter parameter) + { + ParameterName = parameter.ParameterName; + ParameterType = parameter.ParameterType; + IsMandatory = parameter.IsMandatory; + Position = parameter.Position; + IncludeSpace = true; + IncludeDash = true; + } + + public PropertySyntaxOutput(ComplexInterfaceInfo complexInterfaceInfo) + { + ParameterName = complexInterfaceInfo.Name; + ParameterType = complexInterfaceInfo.Type; + IsMandatory = complexInterfaceInfo.Required; + Position = null; + IncludeSpace = false; + IncludeDash = false; + } + + public override string ToString() + { + var leftOptional = !IsMandatory ? "[" : String.Empty; + var leftPositional = Position != null ? "[" : String.Empty; + var rightPositional = Position != null ? "]" : String.Empty; + var type = ParameterType != typeof(SwitchParameter) ? $" <{ParameterType.ToSyntaxTypeName()}>" : String.Empty; + var rightOptional = !IsMandatory ? "]" : String.Empty; + var space = IncludeSpace ? " " : String.Empty; + var dash = IncludeDash ? "-" : String.Empty; + return $"{space}{leftOptional}{leftPositional}{dash}{ParameterName}{rightPositional}{type}{rightOptional}"; + } + } + + internal static class PsProxyOutputExtensions + { + public const string NoParameters = "__NoParameters"; + + public const string AllParameterSets = "__AllParameterSets"; + + public const string HalfIndent = " "; + + public const string Indent = HalfIndent + HalfIndent; + + public const string ItemSeparator = ", "; + + public static readonly string ComplexParameterHeader = $"COMPLEX PARAMETER PROPERTIES{Environment.NewLine}{Environment.NewLine}To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables.{Environment.NewLine}{Environment.NewLine}"; + + public static string ToPsBool(this bool value) => $"${value.ToString().ToLowerInvariant()}"; + + public static string ToPsType(this Type type) + { + var regex = new Regex(@"^(.*)`{1}\d+(.*)$"); + var typeText = type.ToString(); + var match = regex.Match(typeText); + return match.Success ? $"{match.Groups[1]}{match.Groups[2]}" : typeText; + } + + public static string ToPsAttributeType(this Type type) => type.ToPsType().RemoveEnd("Attribute"); + + // https://stackoverflow.com/a/5284606/294804 + private static string RemoveEnd(this string text, string suffix) => text.EndsWith(suffix) ? text.Substring(0, text.Length - suffix.Length) : text; + + public static string ToPsSingleLine(this string value, string replacer = " ") => value.ReplaceNewLines(replacer, new[] { "
", "\r\n", "\n" }); + + public static string ToPsStringLiteral(this string value) => value?.Replace("'", "''").Replace("‘", "''").Replace("’", "''").ToPsSingleLine().Trim() ?? String.Empty; + + public static string JoinIgnoreEmpty(this IEnumerable values, string separator) => String.Join(separator, values?.Where(v => !String.IsNullOrEmpty(v))); + + // https://stackoverflow.com/a/41961738/294804 + public static string ToSyntaxTypeName(this Type type) + { + if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>)) + { + return $"{type.GetGenericArguments().First().ToSyntaxTypeName()}?"; + } + + if (type.IsGenericType) + { + var genericTypes = String.Join(ItemSeparator, type.GetGenericArguments().Select(ToSyntaxTypeName)); + return $"{type.Name.Split('`').First()}<{genericTypes}>"; + } + + return type.Name; + } + + public static OutputTypeOutput ToOutputTypeOutput(this IEnumerable outputTypes) => new OutputTypeOutput(outputTypes); + + public static CmdletBindingOutput ToCmdletBindingOutput(this VariantGroup variantGroup) => new CmdletBindingOutput(variantGroup); + + public static ParameterOutput ToParameterOutput(this Parameter parameter, bool hasMultipleVariantsInVariantGroup, bool hasAllVariantsInParameterGroup) => new ParameterOutput(parameter, hasMultipleVariantsInVariantGroup, hasAllVariantsInParameterGroup); + + public static AliasOutput ToAliasOutput(this string[] aliases, bool includeIndent = false) => new AliasOutput(aliases, includeIndent); + + public static ValidateNotNullOutput ToValidateNotNullOutput(this bool hasValidateNotNull) => new ValidateNotNullOutput(hasValidateNotNull); + + public static AllowEmptyArrayOutput ToAllowEmptyArray(this bool hasAllowEmptyArray) => new AllowEmptyArrayOutput(hasAllowEmptyArray); + + public static ArgumentCompleterOutput ToArgumentCompleterOutput(this CompleterInfo completerInfo) => (completerInfo is PSArgumentCompleterInfo psArgumentCompleterInfo) ? psArgumentCompleterInfo.ToArgumentCompleterOutput() : new ArgumentCompleterOutput(completerInfo); + + public static PSArgumentCompleterOutput ToArgumentCompleterOutput(this PSArgumentCompleterInfo completerInfo) => new PSArgumentCompleterOutput(completerInfo); + + public static DefaultInfoOutput ToDefaultInfoOutput(this ParameterGroup parameterGroup) => new DefaultInfoOutput(parameterGroup); + + public static ParameterTypeOutput ToParameterTypeOutput(this Type parameterType) => new ParameterTypeOutput(parameterType); + + public static ParameterNameOutput ToParameterNameOutput(this string parameterName, bool isLast) => new ParameterNameOutput(parameterName, isLast); + + public static BeginOutput ToBeginOutput(this VariantGroup variantGroup) => new BeginOutput(variantGroup); + + public static ProcessOutput ToProcessOutput(this VariantGroup variantGroup) => new ProcessOutput(variantGroup); + + public static EndOutput ToEndOutput(this VariantGroup variantGroup) => new EndOutput(variantGroup); + + public static HelpCommentOutput ToHelpCommentOutput(this VariantGroup variantGroup) => new HelpCommentOutput(variantGroup); + + public static ParameterDescriptionOutput ToParameterDescriptionOutput(this string description) => new ParameterDescriptionOutput(description); + + public static ProfileOutput ToProfileOutput(this string profileName) => new ProfileOutput(profileName); + + public static DescriptionOutput ToDescriptionOutput(this string description) => new DescriptionOutput(description); + + public static ParameterCategoryOutput ToParameterCategoryOutput(this ParameterCategory category) => new ParameterCategoryOutput(category); + + public static PropertySyntaxOutput ToPropertySyntaxOutput(this Parameter parameter) => new PropertySyntaxOutput(parameter); + + public static PropertySyntaxOutput ToPropertySyntaxOutput(this ComplexInterfaceInfo complexInterfaceInfo) => new PropertySyntaxOutput(complexInterfaceInfo); + + public static InfoOutput ToInfoOutput(this InfoAttribute info, Type parameterType) => new InfoOutput(info, parameterType); + + public static string ToNoteOutput(this ComplexInterfaceInfo complexInterfaceInfo, string currentIndent = "", bool includeDashes = false, bool includeBackticks = false, bool isFirst = true) + { + string RenderProperty(ComplexInterfaceInfo info, string indent, bool dash, bool backtick) => + $"{indent}{(dash ? "- " : String.Empty)}{(backtick ? "`" : String.Empty)}{info.ToPropertySyntaxOutput()}{(backtick ? "`" : String.Empty)}: {info.Description}"; + + var nested = complexInterfaceInfo.NestedInfos.Select(ni => + { + var nestedIndent = $"{currentIndent}{HalfIndent}"; + return ni.IsComplexInterface + ? ni.ToNoteOutput(nestedIndent, includeDashes, includeBackticks, false) + : RenderProperty(ni, nestedIndent, includeDashes, includeBackticks); + }).Prepend(RenderProperty(complexInterfaceInfo, currentIndent, !isFirst && includeDashes, includeBackticks)); + return String.Join(Environment.NewLine, nested); + } + } +} diff --git a/src/Security/Security.Autorest/generated/runtime/BuildTime/Models/PsProxyTypes.cs b/src/Security/Security.Autorest/generated/runtime/BuildTime/Models/PsProxyTypes.cs new file mode 100644 index 000000000000..6def7cd4c376 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/BuildTime/Models/PsProxyTypes.cs @@ -0,0 +1,544 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Management.Automation; +using System.Reflection; +using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.PsProxyOutputExtensions; +using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell.PsProxyTypeExtensions; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell +{ + internal class ProfileGroup + { + public string ProfileName { get; } + public Variant[] Variants { get; } + public string ProfileFolder { get; } + + public ProfileGroup(Variant[] variants, string profileName = NoProfiles) + { + ProfileName = profileName; + Variants = variants; + ProfileFolder = ProfileName != NoProfiles ? ProfileName : String.Empty; + } + } + + internal class VariantGroup + { + public string ModuleName { get; } + + public string RootModuleName { get => @""; } + public string CmdletName { get; } + public string CmdletVerb { get; } + public string CmdletNoun { get; } + public string ProfileName { get; } + public Variant[] Variants { get; } + public ParameterGroup[] ParameterGroups { get; } + public ComplexInterfaceInfo[] ComplexInterfaceInfos { get; } + + public string[] Aliases { get; } + public PSTypeName[] OutputTypes { get; } + public bool SupportsShouldProcess { get; } + public bool SupportsPaging { get; } + public string DefaultParameterSetName { get; } + public bool HasMultipleVariants { get; } + public PsHelpInfo HelpInfo { get; } + public bool IsGenerated { get; } + public bool IsInternal { get; } + public string OutputFolder { get; } + public string FileName { get; } + public string FilePath { get; } + + public CommentInfo CommentInfo { get; } + + public VariantGroup(string moduleName, string cmdletName, Variant[] variants, string outputFolder, string profileName = NoProfiles, bool isTest = false, bool isInternal = false) + { + ModuleName = moduleName; + CmdletName = cmdletName; + var cmdletNameParts = CmdletName.Split('-'); + CmdletVerb = cmdletNameParts.First(); + CmdletNoun = cmdletNameParts.Last(); + ProfileName = profileName; + Variants = variants; + ParameterGroups = Variants.ToParameterGroups().OrderBy(pg => pg.OrderCategory).ThenByDescending(pg => pg.IsMandatory).ToArray(); + var aliasDuplicates = ParameterGroups.SelectMany(pg => pg.Aliases) + //https://stackoverflow.com/a/18547390/294804 + .GroupBy(a => a).Where(g => g.Count() > 1).Select(g => g.Key).ToArray(); + if (aliasDuplicates.Any()) + { + throw new ParsingMetadataException($"The alias(es) [{String.Join(", ", aliasDuplicates)}] are defined on multiple parameters for cmdlet '{CmdletName}', which is not supported."); + } + ComplexInterfaceInfos = ParameterGroups.Where(pg => !pg.DontShow && pg.IsComplexInterface).OrderBy(pg => pg.ParameterName).Select(pg => pg.ComplexInterfaceInfo).ToArray(); + + Aliases = Variants.SelectMany(v => v.Attributes).ToAliasNames().ToArray(); + OutputTypes = Variants.SelectMany(v => v.Info.OutputType).Where(ot => ot.Type != null).GroupBy(ot => ot.Type).Select(otg => otg.First()).ToArray(); + SupportsShouldProcess = Variants.Any(v => v.SupportsShouldProcess); + SupportsPaging = Variants.Any(v => v.SupportsPaging); + DefaultParameterSetName = DetermineDefaultParameterSetName(); + HasMultipleVariants = Variants.Length > 1; + HelpInfo = Variants.Select(v => v.HelpInfo).FirstOrDefault() ?? new PsHelpInfo(); + IsGenerated = Variants.All(v => v.Attributes.OfType().Any()); + IsInternal = isInternal; + OutputFolder = outputFolder; + FileName = $"{CmdletName}{(isTest ? ".Tests" : String.Empty)}.ps1"; + FilePath = Path.Combine(OutputFolder, FileName); + + CommentInfo = new CommentInfo(this); + } + + private string DetermineDefaultParameterSetName() + { + var defaultParameterSet = Variants + .Select(v => v.Metadata.DefaultParameterSetName) + .LastOrDefault(dpsn => dpsn.IsValidDefaultParameterSetName()); + + if (String.IsNullOrEmpty(defaultParameterSet)) + { + var variantParamCountGroups = Variants + .Where(v => !v.IsNotSuggestDefaultParameterSet) + .Select(v => ( + variant: v.VariantName, + paramCount: v.CmdletOnlyParameters.Count(p => p.IsMandatory), + isSimple: v.CmdletOnlyParameters.Where(p => p.IsMandatory).All(p => p.ParameterType.IsPsSimple()))) + .GroupBy(vpc => vpc.isSimple) + .ToArray(); + if (variantParamCountGroups.Length == 0) + { + variantParamCountGroups = Variants + .Select(v => ( + variant: v.VariantName, + paramCount: v.CmdletOnlyParameters.Count(p => p.IsMandatory), + isSimple: v.CmdletOnlyParameters.Where(p => p.IsMandatory).All(p => p.ParameterType.IsPsSimple()))) + .GroupBy(vpc => vpc.isSimple) + .ToArray(); + } + var variantParameterCounts = (variantParamCountGroups.Any(g => g.Key) ? variantParamCountGroups.Where(g => g.Key) : variantParamCountGroups).SelectMany(g => g).ToArray(); + var smallestParameterCount = variantParameterCounts.Min(vpc => vpc.paramCount); + defaultParameterSet = variantParameterCounts.First(vpc => vpc.paramCount == smallestParameterCount).variant; + } + + return defaultParameterSet; + } + } + + internal class Variant + { + public string CmdletName { get; } + public string VariantName { get; } + public CommandInfo Info { get; } + public CommandMetadata Metadata { get; } + public PsHelpInfo HelpInfo { get; } + public bool HasParameterSets { get; } + public bool IsFunction { get; } + public string PrivateModuleName { get; } + public string PrivateCmdletName { get; } + public bool SupportsShouldProcess { get; } + public bool SupportsPaging { get; } + + public Attribute[] Attributes { get; } + public Parameter[] Parameters { get; } + public Parameter[] CmdletOnlyParameters { get; } + public bool IsInternal { get; } + public bool IsDoNotExport { get; } + public bool IsNotSuggestDefaultParameterSet { get; } + public string[] Profiles { get; } + + public Variant(string cmdletName, string variantName, CommandInfo info, CommandMetadata metadata, bool hasParameterSets = false, PsHelpInfo helpInfo = null) + { + CmdletName = cmdletName; + VariantName = variantName; + Info = info; + HelpInfo = helpInfo ?? new PsHelpInfo(); + Metadata = metadata; + HasParameterSets = hasParameterSets; + IsFunction = Info.CommandType == CommandTypes.Function; + PrivateModuleName = Info.Source; + PrivateCmdletName = Metadata.Name; + SupportsShouldProcess = Metadata.SupportsShouldProcess; + SupportsPaging = Metadata.SupportsPaging; + + Attributes = this.ToAttributes(); + Parameters = this.ToParameters().OrderBy(p => p.OrderCategory).ThenByDescending(p => p.IsMandatory).ToArray(); + IsInternal = Attributes.OfType().Any(); + IsDoNotExport = Attributes.OfType().Any(); + IsNotSuggestDefaultParameterSet = Attributes.OfType().Any(); + CmdletOnlyParameters = Parameters.Where(p => !p.Categories.Any(c => c == ParameterCategory.Azure || c == ParameterCategory.Runtime)).ToArray(); + Profiles = Attributes.OfType().SelectMany(pa => pa.Profiles).ToArray(); + } + } + + internal class ParameterGroup + { + public string ParameterName { get; } + public Parameter[] Parameters { get; } + + public string[] VariantNames { get; } + public string[] AllVariantNames { get; } + public bool HasAllVariants { get; } + public Type ParameterType { get; } + public string Description { get; } + + public string[] Aliases { get; } + public bool HasValidateNotNull { get; } + public bool HasAllowEmptyArray { get; } + public CompleterInfo CompleterInfo { get; } + public DefaultInfo DefaultInfo { get; } + public bool HasDefaultInfo { get; } + public ParameterCategory OrderCategory { get; } + public bool DontShow { get; } + public bool IsMandatory { get; } + public bool SupportsWildcards { get; } + public bool IsComplexInterface { get; } + public ComplexInterfaceInfo ComplexInterfaceInfo { get; } + public InfoAttribute InfoAttribute { get; } + + public int? FirstPosition { get; } + public bool ValueFromPipeline { get; } + public bool ValueFromPipelineByPropertyName { get; } + public bool IsInputType { get; } + + public ParameterGroup(string parameterName, Parameter[] parameters, string[] allVariantNames) + { + ParameterName = parameterName; + Parameters = parameters; + + VariantNames = Parameters.Select(p => p.VariantName).ToArray(); + AllVariantNames = allVariantNames; + HasAllVariants = VariantNames.Any(vn => vn == AllParameterSets) || !AllVariantNames.Except(VariantNames).Any(); + var types = Parameters.Select(p => p.ParameterType).Distinct().ToArray(); + if (types.Length > 1) + { + throw new ParsingMetadataException($"The parameter '{ParameterName}' has multiple parameter types [{String.Join(", ", types.Select(t => t.Name))}] defined, which is not supported."); + } + ParameterType = types.First(); + Description = Parameters.Select(p => p.Description).FirstOrDefault(d => !String.IsNullOrEmpty(d)).EmptyIfNull(); + + Aliases = Parameters.SelectMany(p => p.Attributes).ToAliasNames().ToArray(); + HasValidateNotNull = Parameters.SelectMany(p => p.Attributes.OfType()).Any(); + HasAllowEmptyArray = Parameters.SelectMany(p => p.Attributes.OfType()).Any(); + CompleterInfo = Parameters.Select(p => p.CompleterInfoAttribute).FirstOrDefault()?.ToCompleterInfo() + ?? Parameters.Select(p => p.PSArgumentCompleterAttribute).FirstOrDefault()?.ToPSArgumentCompleterInfo() + ?? Parameters.Select(p => p.ArgumentCompleterAttribute).FirstOrDefault()?.ToCompleterInfo(); + DefaultInfo = Parameters.Select(p => p.DefaultInfoAttribute).FirstOrDefault()?.ToDefaultInfo(this) + ?? Parameters.Select(p => p.DefaultValueAttribute).FirstOrDefault(dv => dv != null)?.ToDefaultInfo(this); + HasDefaultInfo = DefaultInfo != null && !String.IsNullOrEmpty(DefaultInfo.Script); + // When DefaultInfo is present, force all parameters from this group to be optional. + if (HasDefaultInfo) + { + foreach (var parameter in Parameters) + { + parameter.IsMandatory = false; + } + } + OrderCategory = Parameters.Select(p => p.OrderCategory).Distinct().DefaultIfEmpty(ParameterCategory.Body).Min(); + DontShow = Parameters.All(p => p.DontShow); + IsMandatory = HasAllVariants && Parameters.Any(p => p.IsMandatory); + SupportsWildcards = Parameters.Any(p => p.SupportsWildcards); + IsComplexInterface = Parameters.Any(p => p.IsComplexInterface); + ComplexInterfaceInfo = Parameters.Where(p => p.IsComplexInterface).Select(p => p.ComplexInterfaceInfo).FirstOrDefault(); + InfoAttribute = Parameters.Select(p => p.InfoAttribute).First(); + + FirstPosition = Parameters.Select(p => p.Position).FirstOrDefault(p => p != null); + ValueFromPipeline = Parameters.Any(p => p.ValueFromPipeline); + ValueFromPipelineByPropertyName = Parameters.Any(p => p.ValueFromPipelineByPropertyName); + IsInputType = ValueFromPipeline || ValueFromPipelineByPropertyName; + } + } + + internal class Parameter + { + public string VariantName { get; } + public string ParameterName { get; } + public ParameterMetadata Metadata { get; } + public PsParameterHelpInfo HelpInfo { get; } + public Type ParameterType { get; } + public Attribute[] Attributes { get; } + public ParameterCategory[] Categories { get; } + public ParameterCategory OrderCategory { get; } + public PSDefaultValueAttribute DefaultValueAttribute { get; } + public DefaultInfoAttribute DefaultInfoAttribute { get; } + public ParameterAttribute ParameterAttribute { get; } + public bool SupportsWildcards { get; } + public CompleterInfoAttribute CompleterInfoAttribute { get; } + public ArgumentCompleterAttribute ArgumentCompleterAttribute { get; } + public PSArgumentCompleterAttribute PSArgumentCompleterAttribute { get; } + + public bool ValueFromPipeline { get; } + public bool ValueFromPipelineByPropertyName { get; } + public int? Position { get; } + public bool DontShow { get; } + public bool IsMandatory { get; set; } + + public InfoAttribute InfoAttribute { get; } + public ComplexInterfaceInfo ComplexInterfaceInfo { get; } + public bool IsComplexInterface { get; } + public string Description { get; } + + public Parameter(string variantName, string parameterName, ParameterMetadata metadata, PsParameterHelpInfo helpInfo = null) + { + VariantName = variantName; + ParameterName = parameterName; + Metadata = metadata; + HelpInfo = helpInfo ?? new PsParameterHelpInfo(); + + Attributes = Metadata.Attributes.ToArray(); + ParameterType = Attributes.OfType().FirstOrDefault()?.Type ?? Metadata.ParameterType; + Categories = Attributes.OfType().SelectMany(ca => ca.Categories).Distinct().ToArray(); + OrderCategory = Categories.DefaultIfEmpty(ParameterCategory.Body).Min(); + DefaultValueAttribute = Attributes.OfType().FirstOrDefault(); + DefaultInfoAttribute = Attributes.OfType().FirstOrDefault(); + ParameterAttribute = Attributes.OfType().FirstOrDefault(pa => pa.ParameterSetName == VariantName || pa.ParameterSetName == AllParameterSets); + if (ParameterAttribute == null) + { + throw new ParsingMetadataException($"The variant '{VariantName}' has multiple parameter sets defined, which is not supported."); + } + SupportsWildcards = Attributes.OfType().Any(); + CompleterInfoAttribute = Attributes.OfType().FirstOrDefault(); + PSArgumentCompleterAttribute = Attributes.OfType().FirstOrDefault(); + ArgumentCompleterAttribute = Attributes.OfType().FirstOrDefault(attr => !attr.GetType().Equals(typeof(PSArgumentCompleterAttribute))); + + ValueFromPipeline = ParameterAttribute.ValueFromPipeline; + ValueFromPipelineByPropertyName = ParameterAttribute.ValueFromPipelineByPropertyName; + Position = ParameterAttribute.Position == Int32.MinValue ? (int?)null : ParameterAttribute.Position; + DontShow = ParameterAttribute.DontShow; + IsMandatory = ParameterAttribute.Mandatory; + + var complexParameterName = ParameterName.ToUpperInvariant(); + var complexMessage = $"{Environment.NewLine}."; + var description = ParameterAttribute.HelpMessage.NullIfEmpty() ?? HelpInfo.Description.NullIfEmpty() ?? InfoAttribute?.Description.NullIfEmpty() ?? String.Empty; + // Remove the complex type message as it will be reinserted if this is a complex type + description = description.NormalizeNewLines().Replace(complexMessage, String.Empty).Replace(complexMessage.ToPsSingleLine(), String.Empty); + // Make an InfoAttribute for processing only if one isn't provided + InfoAttribute = Attributes.OfType().FirstOrDefault() ?? new InfoAttribute { PossibleTypes = new[] { ParameterType.Unwrap() }, Required = IsMandatory }; + // Set the description if the InfoAttribute does not have one since they are exported without a description + InfoAttribute.Description = String.IsNullOrEmpty(InfoAttribute.Description) ? description : InfoAttribute.Description; + ComplexInterfaceInfo = InfoAttribute.ToComplexInterfaceInfo(complexParameterName, ParameterType, true); + IsComplexInterface = ComplexInterfaceInfo.IsComplexInterface; + Description = $"{description}{(IsComplexInterface ? complexMessage : String.Empty)}"; + } + } + + internal class ComplexInterfaceInfo + { + public InfoAttribute InfoAttribute { get; } + + public string Name { get; } + public Type Type { get; } + public bool Required { get; } + public bool ReadOnly { get; } + public string Description { get; } + + public ComplexInterfaceInfo[] NestedInfos { get; } + public bool IsComplexInterface { get; } + + public ComplexInterfaceInfo(string name, Type type, InfoAttribute infoAttribute, bool? required, List seenTypes) + { + Name = name; + Type = type; + InfoAttribute = infoAttribute; + + Required = required ?? InfoAttribute.Required; + ReadOnly = InfoAttribute.ReadOnly; + Description = InfoAttribute.Description.ToPsSingleLine(); + + var unwrappedType = Type.Unwrap(); + var hasBeenSeen = seenTypes?.Contains(unwrappedType) ?? false; + (seenTypes ?? (seenTypes = new List())).Add(unwrappedType); + NestedInfos = hasBeenSeen ? new ComplexInterfaceInfo[] { } : + unwrappedType.GetInterfaces() + .Concat(InfoAttribute.PossibleTypes) + .SelectMany(pt => pt.GetProperties() + .SelectMany(pi => pi.GetCustomAttributes(true).OfType() + .Select(ia => ia.ToComplexInterfaceInfo(pi.Name, pi.PropertyType, seenTypes: seenTypes)))) + .Where(cii => !cii.ReadOnly).OrderByDescending(cii => cii.Required).ToArray(); + // https://stackoverflow.com/a/503359/294804 + var associativeArrayInnerType = Type.GetInterfaces() + .FirstOrDefault(i => i.IsGenericType && i.GetGenericTypeDefinition() == typeof(IAssociativeArray<>)) + ?.GetTypeInfo().GetGenericArguments().First(); + if (!hasBeenSeen && associativeArrayInnerType != null) + { + var anyInfo = new InfoAttribute { Description = "This indicates any property can be added to this object." }; + NestedInfos = NestedInfos.Prepend(anyInfo.ToComplexInterfaceInfo("(Any)", associativeArrayInnerType)).ToArray(); + } + IsComplexInterface = NestedInfos.Any(); + } + } + + internal class CommentInfo + { + public string Description { get; } + public string Synopsis { get; } + + public string[] Examples { get; } + public string[] Inputs { get; } + public string[] Outputs { get; } + + public string OnlineVersion { get; } + public string[] RelatedLinks { get; } + public string[] ExternalUrls { get; } + + private const string HelpLinkPrefix = @"https://learn.microsoft.com/powershell/module/"; + + public CommentInfo(VariantGroup variantGroup) + { + var helpInfo = variantGroup.HelpInfo; + Description = variantGroup.Variants.SelectMany(v => v.Attributes).OfType().FirstOrDefault()?.Description.NullIfEmpty() + ?? helpInfo.Description.EmptyIfNull(); + // If there is no Synopsis, PowerShell may put in the Syntax string as the Synopsis. This seems unintended, so we remove the Synopsis in this situation. + var synopsis = helpInfo.Synopsis.EmptyIfNull().Trim().StartsWith(variantGroup.CmdletName) ? String.Empty : helpInfo.Synopsis; + Synopsis = synopsis.NullIfEmpty() ?? Description; + + Examples = helpInfo.Examples.Select(rl => rl.Code).ToArray(); + + Inputs = (variantGroup.ParameterGroups.Where(pg => pg.IsInputType).Select(pg => pg.ParameterType.FullName).ToArray().NullIfEmpty() ?? + helpInfo.InputTypes.Where(it => it.Name.NullIfWhiteSpace() != null).Select(it => it.Name).ToArray()) + .Where(i => i != "None").Distinct().OrderBy(i => i).ToArray(); + Outputs = (variantGroup.OutputTypes.Select(ot => ot.Type.FullName).ToArray().NullIfEmpty() ?? + helpInfo.OutputTypes.Where(it => it.Name.NullIfWhiteSpace() != null).Select(ot => ot.Name).ToArray()) + .Where(o => o != "None").Distinct().OrderBy(o => o).ToArray(); + + // Use root module name in the help link + var moduleName = variantGroup.RootModuleName == "" ? variantGroup.ModuleName.ToLowerInvariant() : variantGroup.RootModuleName.ToLowerInvariant(); + OnlineVersion = helpInfo.OnlineVersion?.Uri.NullIfEmpty() ?? $@"{HelpLinkPrefix}{moduleName}/{variantGroup.CmdletName.ToLowerInvariant()}"; + RelatedLinks = helpInfo.RelatedLinks.Select(rl => rl.Text).ToArray(); + + // Get external urls from attribute + ExternalUrls = variantGroup.Variants.SelectMany(v => v.Attributes).OfType()?.Select(e => e.Url)?.Distinct()?.ToArray(); + } + } + + internal class CompleterInfo + { + public string Name { get; } + public string Description { get; } + public string Script { get; } + public Type Type { get; } + public bool IsTypeCompleter { get; } + + public CompleterInfo(CompleterInfoAttribute infoAttribute) + { + Name = infoAttribute.Name; + Description = infoAttribute.Description; + Script = infoAttribute.Script; + } + + public CompleterInfo(ArgumentCompleterAttribute completerAttribute) + { + Script = completerAttribute.ScriptBlock?.ToString(); + if (completerAttribute.Type != null) + { + Type = completerAttribute.Type; + IsTypeCompleter = true; + } + } + } + + internal class PSArgumentCompleterInfo : CompleterInfo + { + public string[] ResourceTypes { get; } + + public PSArgumentCompleterInfo(PSArgumentCompleterAttribute completerAttribute) : base(completerAttribute) + { + ResourceTypes = completerAttribute.ResourceTypes; + } + } + + internal class DefaultInfo + { + public string Name { get; } + public string Description { get; } + public string Script { get; } + public string SetCondition { get; } + public ParameterGroup ParameterGroup { get; } + + public DefaultInfo(DefaultInfoAttribute infoAttribute, ParameterGroup parameterGroup) + { + Name = infoAttribute.Name; + Description = infoAttribute.Description; + Script = infoAttribute.Script; + SetCondition = infoAttribute.SetCondition; + ParameterGroup = parameterGroup; + } + + public DefaultInfo(PSDefaultValueAttribute defaultValueAttribute, ParameterGroup parameterGroup) + { + Description = defaultValueAttribute.Help; + ParameterGroup = parameterGroup; + if (defaultValueAttribute.Value != null) + { + Script = defaultValueAttribute.Value.ToString(); + } + } + } + + internal static class PsProxyTypeExtensions + { + public const string NoProfiles = "__NoProfiles"; + + public static bool IsValidDefaultParameterSetName(this string parameterSetName) => + !String.IsNullOrEmpty(parameterSetName) && parameterSetName != AllParameterSets; + + public static Variant[] ToVariants(this CommandInfo info, PsHelpInfo helpInfo) + { + var metadata = new CommandMetadata(info); + var privateCmdletName = metadata.Name.Split('!').First(); + var parts = privateCmdletName.Split('_'); + return parts.Length > 1 + ? new[] { new Variant(parts[0], parts[1], info, metadata, helpInfo: helpInfo) } + // Process multiple parameter sets, so we declare a variant per parameter set. + : info.ParameterSets.Select(ps => new Variant(privateCmdletName, ps.Name, info, metadata, true, helpInfo)).ToArray(); + } + + public static Variant[] ToVariants(this CmdletAndHelpInfo info) => info.CommandInfo.ToVariants(info.HelpInfo); + + public static Variant[] ToVariants(this CommandInfo info, PSObject helpInfo = null) => info.ToVariants(helpInfo?.ToPsHelpInfo()); + + public static Parameter[] ToParameters(this Variant variant) + { + var parameters = variant.Metadata.Parameters.AsEnumerable(); + var parameterHelp = variant.HelpInfo.Parameters.AsEnumerable(); + + if (variant.HasParameterSets) + { + parameters = parameters.Where(p => p.Value.ParameterSets.Keys.Any(k => k == variant.VariantName || k == AllParameterSets)); + parameterHelp = parameterHelp.Where(ph => (!ph.ParameterSetNames.Any() || ph.ParameterSetNames.Any(psn => psn == variant.VariantName || psn == AllParameterSets)) && ph.Name != "IncludeTotalCount"); + } + var result = parameters.Select(p => new Parameter(variant.VariantName, p.Key, p.Value, parameterHelp.FirstOrDefault(ph => ph.Name == p.Key))); + if (variant.SupportsPaging) + { + // If supportsPaging is set, we will need to add First and Skip parameters since they are treated as common parameters which as not contained on Metadata>parameters + variant.Info.Parameters["First"].Attributes.OfType().FirstOrDefault(pa => pa.ParameterSetName == variant.VariantName || pa.ParameterSetName == AllParameterSets).HelpMessage = "Gets only the first 'n' objects."; + variant.Info.Parameters["Skip"].Attributes.OfType().FirstOrDefault(pa => pa.ParameterSetName == variant.VariantName || pa.ParameterSetName == AllParameterSets).HelpMessage = "Ignores the first 'n' objects and then gets the remaining objects."; + result = result.Append(new Parameter(variant.VariantName, "First", variant.Info.Parameters["First"], parameterHelp.FirstOrDefault(ph => ph.Name == "First"))); + result = result.Append(new Parameter(variant.VariantName, "Skip", variant.Info.Parameters["Skip"], parameterHelp.FirstOrDefault(ph => ph.Name == "Skip"))); + } + return result.ToArray(); + } + + public static Attribute[] ToAttributes(this Variant variant) => variant.IsFunction + ? ((FunctionInfo)variant.Info).ScriptBlock.Attributes.ToArray() + : variant.Metadata.CommandType.GetCustomAttributes(false).Cast().ToArray(); + + public static IEnumerable ToParameterGroups(this Variant[] variants) + { + var allVariantNames = variants.Select(vg => vg.VariantName).ToArray(); + return variants + .SelectMany(v => v.Parameters) + .GroupBy(p => p.ParameterName, StringComparer.InvariantCultureIgnoreCase) + .Select(pg => new ParameterGroup(pg.Key, pg.Select(p => p).ToArray(), allVariantNames)); + } + + public static ComplexInterfaceInfo ToComplexInterfaceInfo(this InfoAttribute infoAttribute, string name, Type type, bool? required = null, List seenTypes = null) + => new ComplexInterfaceInfo(name, type, infoAttribute, required, seenTypes); + + public static CompleterInfo ToCompleterInfo(this CompleterInfoAttribute infoAttribute) => new CompleterInfo(infoAttribute); + public static CompleterInfo ToCompleterInfo(this ArgumentCompleterAttribute completerAttribute) => new CompleterInfo(completerAttribute); + public static PSArgumentCompleterInfo ToPSArgumentCompleterInfo(this PSArgumentCompleterAttribute completerAttribute) => new PSArgumentCompleterInfo(completerAttribute); + public static DefaultInfo ToDefaultInfo(this DefaultInfoAttribute infoAttribute, ParameterGroup parameterGroup) => new DefaultInfo(infoAttribute, parameterGroup); + public static DefaultInfo ToDefaultInfo(this PSDefaultValueAttribute defaultValueAttribute, ParameterGroup parameterGroup) => new DefaultInfo(defaultValueAttribute, parameterGroup); + } +} diff --git a/src/Security/Security.Autorest/generated/runtime/BuildTime/PsAttributes.cs b/src/Security/Security.Autorest/generated/runtime/BuildTime/PsAttributes.cs new file mode 100644 index 000000000000..99a703bf105c --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/BuildTime/PsAttributes.cs @@ -0,0 +1,131 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security +{ + [AttributeUsage(AttributeTargets.Class)] + public class DescriptionAttribute : Attribute + { + public string Description { get; } + + public DescriptionAttribute(string description) + { + Description = description; + } + } + + [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property)] + public class DoNotExportAttribute : Attribute + { + } + + [AttributeUsage(AttributeTargets.Class)] + public class InternalExportAttribute : Attribute + { + } + + [AttributeUsage(AttributeTargets.Class)] + public class GeneratedAttribute : Attribute + { + } + + [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property)] + public class DoNotFormatAttribute : Attribute + { + } + + [AttributeUsage(AttributeTargets.Class)] + public class ProfileAttribute : Attribute + { + public string[] Profiles { get; } + + public ProfileAttribute(params string[] profiles) + { + Profiles = profiles; + } + } + + [AttributeUsage(AttributeTargets.Class)] + public class HttpPathAttribute : Attribute + { + public string Path { get; set; } + public string ApiVersion { get; set; } + } + + [AttributeUsage(AttributeTargets.Class)] + public class NotSuggestDefaultParameterSetAttribute : Attribute + { + } + + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] + public class CategoryAttribute : Attribute + { + public ParameterCategory[] Categories { get; } + + public CategoryAttribute(params ParameterCategory[] categories) + { + Categories = categories; + } + } + + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] + public class ExportAsAttribute : Attribute + { + public Type Type { get; set; } + + public ExportAsAttribute(Type type) + { + Type = type; + } + } + + public enum ParameterCategory + { + // Note: Order is significant + Uri = 0, + Path, + Query, + Header, + Cookie, + Body, + Azure, + Runtime + } + + [AttributeUsage(AttributeTargets.Property)] + public class OriginAttribute : Attribute + { + public PropertyOrigin Origin { get; } + + public OriginAttribute(PropertyOrigin origin) + { + Origin = origin; + } + } + + public enum PropertyOrigin + { + // Note: Order is significant + Inherited = 0, + Owned, + Inlined + } + + [AttributeUsage(AttributeTargets.Property)] + public class ConstantAttribute : Attribute + { + } + + [AttributeUsage(AttributeTargets.Property)] + public class FormatTableAttribute : Attribute + { + public int Index { get; set; } = -1; + public bool HasIndex => Index != -1; + public string Label { get; set; } + public int Width { get; set; } = -1; + public bool HasWidth => Width != -1; + } +} diff --git a/src/Security/Security.Autorest/generated/runtime/BuildTime/PsExtensions.cs b/src/Security/Security.Autorest/generated/runtime/BuildTime/PsExtensions.cs new file mode 100644 index 000000000000..4bfa58eeed7c --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/BuildTime/PsExtensions.cs @@ -0,0 +1,176 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Management.Automation; +using System.Reflection; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell +{ + internal static class PsExtensions + { + public static PSObject AddMultipleTypeNameIntoPSObject(this object obj, string multipleTag = "#Multiple") + { + var psObj = new PSObject(obj); + psObj.TypeNames.Insert(0, $"{psObj.TypeNames[0]}{multipleTag}"); + return psObj; + } + + // https://stackoverflow.com/a/863944/294804 + // https://stackoverflow.com/a/4452598/294804 + // https://stackoverflow.com/a/28701974/294804 + // Note: This will unwrap nested collections, but we don't generate nested collections. + public static Type Unwrap(this Type type) + { + if (type.IsArray) + { + return type.GetElementType().Unwrap(); + } + + var typeInfo = type.GetTypeInfo(); + if (typeInfo.IsGenericType + && (typeInfo.GetGenericTypeDefinition() == typeof(Nullable<>) || typeof(IEnumerable<>).IsAssignableFrom(type))) + { + return typeInfo.GetGenericArguments().First().Unwrap(); + } + + return type; + } + + // https://stackoverflow.com/a/863944/294804 + private static bool IsSimple(this Type type) + { + var typeInfo = type.GetTypeInfo(); + return typeInfo.IsPrimitive + || typeInfo.IsEnum + || type == typeof(string) + || type == typeof(decimal); + } + + // https://stackoverflow.com/a/32025393/294804 + private static bool HasImplicitConversion(this Type baseType, Type targetType) => + baseType.GetMethods(BindingFlags.Public | BindingFlags.Static) + .Where(mi => mi.Name == "op_Implicit" && mi.ReturnType == targetType) + .Any(mi => mi.GetParameters().FirstOrDefault()?.ParameterType == baseType); + + public static bool IsPsSimple(this Type type) + { + var unwrappedType = type.Unwrap(); + return unwrappedType.IsSimple() + || unwrappedType == typeof(SwitchParameter) + || unwrappedType == typeof(Hashtable) + || unwrappedType == typeof(PSCredential) + || unwrappedType == typeof(ScriptBlock) + || unwrappedType == typeof(DateTime) + || unwrappedType == typeof(Uri) + || unwrappedType.HasImplicitConversion(typeof(string)); + } + + public static string ToPsList(this IEnumerable items) => String.Join(", ", items.Select(i => $"'{i}'")); + + public static IEnumerable ToAliasNames(this IEnumerable attributes) => attributes.OfType().SelectMany(aa => aa.AliasNames).Distinct(); + + public static bool IsArrayAndElementTypeIsT(this object item) + { + var itemType = item.GetType(); + var tType = typeof(T); + return itemType.IsArray && !tType.IsArray && tType.IsAssignableFrom(itemType.GetElementType()); + } + + public static bool IsTArrayAndElementTypeIsItem(this object item) + { + var itemType = item.GetType(); + var tType = typeof(T); + return !itemType.IsArray && tType.IsArray && (tType.GetElementType()?.IsAssignableFrom(itemType) ?? false); + } + + public static bool IsTypeOrArrayOfType(this object item) => item is T || item.IsArrayAndElementTypeIsT() || item.IsTArrayAndElementTypeIsItem(); + + public static T NormalizeArrayType(this object item) + { + if (item is T result) + { + return result; + } + + if (item.IsArrayAndElementTypeIsT()) + { + var array = (T[])Convert.ChangeType(item, typeof(T[])); + return array.FirstOrDefault(); + } + + if (item.IsTArrayAndElementTypeIsItem()) + { + var tType = typeof(T); + var array = Array.CreateInstance(tType.GetElementType(), 1); + array.SetValue(item, 0); + return (T)Convert.ChangeType(array, tType); + } + + return default(T); + } + + public static T GetNestedProperty(this PSObject psObject, params string[] names) => psObject.Properties.GetNestedProperty(names); + + public static T GetNestedProperty(this PSMemberInfoCollection properties, params string[] names) + { + var lastName = names.Last(); + var nestedProperties = names.Take(names.Length - 1).Aggregate(properties, (p, n) => p?.GetProperty(n)?.Properties); + return nestedProperties != null ? nestedProperties.GetProperty(lastName) : default(T); + } + + public static T GetProperty(this PSObject psObject, string name) => psObject.Properties.GetProperty(name); + + public static T GetProperty(this PSMemberInfoCollection properties, string name) + { + switch (properties[name]?.Value) + { + case PSObject psObject when psObject.BaseObject is PSCustomObject && psObject.ImmediateBaseObject.IsTypeOrArrayOfType(): + return psObject.ImmediateBaseObject.NormalizeArrayType(); + case PSObject psObject when psObject.BaseObject.IsTypeOrArrayOfType(): + return psObject.BaseObject.NormalizeArrayType(); + case object value when value.IsTypeOrArrayOfType(): + return value.NormalizeArrayType(); + default: + return default(T); + } + } + + public static IEnumerable RunScript(this PSCmdlet cmdlet, string script) + => PsHelpers.RunScript(cmdlet.InvokeCommand, script); + + public static void RunScript(this PSCmdlet cmdlet, string script) + => cmdlet.RunScript(script); + + public static IEnumerable RunScript(this EngineIntrinsics engineIntrinsics, string script) + => PsHelpers.RunScript(engineIntrinsics.InvokeCommand, script); + + public static void RunScript(this EngineIntrinsics engineIntrinsics, string script) + => engineIntrinsics.RunScript(script); + + public static IEnumerable RunScript(this PSCmdlet cmdlet, ScriptBlock block) + => PsHelpers.RunScript(cmdlet.InvokeCommand, block.ToString()); + + public static void RunScript(this PSCmdlet cmdlet, ScriptBlock block) + => cmdlet.RunScript(block.ToString()); + + public static IEnumerable RunScript(this EngineIntrinsics engineIntrinsics, ScriptBlock block) + => PsHelpers.RunScript(engineIntrinsics.InvokeCommand, block.ToString()); + + public static void RunScript(this EngineIntrinsics engineIntrinsics, ScriptBlock block) + => engineIntrinsics.RunScript(block.ToString()); + + /// + /// Returns if a parameter should be hidden by checking for . + /// + /// A PowerShell parameter. + public static bool IsHidden(this Parameter parameter) + { + return parameter.Attributes.Any(attr => attr is DoNotExportAttribute); + } + } +} diff --git a/src/Security/Security.Autorest/generated/runtime/BuildTime/PsHelpers.cs b/src/Security/Security.Autorest/generated/runtime/BuildTime/PsHelpers.cs new file mode 100644 index 000000000000..83e344d68d3d --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/BuildTime/PsHelpers.cs @@ -0,0 +1,105 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Management.Automation; +using Pwsh = System.Management.Automation.PowerShell; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell +{ + internal static class PsHelpers + { + public static IEnumerable RunScript(string script) + => Pwsh.Create().AddScript(script).Invoke(); + + public static void RunScript(string script) + => RunScript(script); + + public static IEnumerable RunScript(CommandInvocationIntrinsics cii, string script) + => cii.InvokeScript(script).Select(o => o?.BaseObject).Where(o => o != null).OfType(); + + public static void RunScript(CommandInvocationIntrinsics cii, string script) + => RunScript(cii, script); + + public static IEnumerable GetModuleCmdlets(PSCmdlet cmdlet, params string[] modulePaths) + { + var getCmdletsCommand = String.Join(" + ", modulePaths.Select(mp => $"(Get-Command -Module (Import-Module '{mp}' -PassThru))")); + return (cmdlet?.RunScript(getCmdletsCommand) ?? RunScript(getCmdletsCommand)) + .Where(ci => ci.CommandType != CommandTypes.Alias); + } + + public static IEnumerable GetModuleCmdlets(params string[] modulePaths) + => GetModuleCmdlets(null, modulePaths); + + public static IEnumerable GetScriptCmdlets(PSCmdlet cmdlet, string scriptFolder) + { + // https://stackoverflow.com/a/40969712/294804 + var wrappedFolder = scriptFolder.Contains("'") ? $@"""{scriptFolder}""" : $@"'{scriptFolder}'"; + var getCmdletsCommand = $@" +$currentFunctions = Get-ChildItem function: +Get-ChildItem -Path {wrappedFolder} -Recurse -Include '*.ps1' -File | ForEach-Object {{ . $_.FullName }} +Get-ChildItem function: | Where-Object {{ ($currentFunctions -notcontains $_) -and $_.CmdletBinding }} +"; + return cmdlet?.RunScript(getCmdletsCommand) ?? RunScript(getCmdletsCommand); + } + + public static IEnumerable GetScriptCmdlets(string scriptFolder) + => GetScriptCmdlets(null, scriptFolder); + + public static IEnumerable GetScriptHelpInfo(PSCmdlet cmdlet, params string[] modulePaths) + { + var importModules = String.Join(Environment.NewLine, modulePaths.Select(mp => $"Import-Module '{mp}'")); + var getHelpCommand = $@" +$currentFunctions = Get-ChildItem function: +{importModules} +Get-ChildItem function: | Where-Object {{ ($currentFunctions -notcontains $_) -and $_.CmdletBinding }} | ForEach-Object {{ Get-Help -Name $_.Name -Full }} +"; + return cmdlet?.RunScript(getHelpCommand) ?? RunScript(getHelpCommand); + } + + public static IEnumerable GetScriptHelpInfo(params string[] modulePaths) + => GetScriptHelpInfo(null, modulePaths); + + public static IEnumerable GetModuleCmdletsAndHelpInfo(PSCmdlet cmdlet, params string[] modulePaths) + { + var getCmdletAndHelp = String.Join(" + ", modulePaths.Select(mp => + $@"(Get-Command -Module (Import-Module '{mp}' -PassThru) | Where-Object {{ $_.CommandType -ne 'Alias' }} | ForEach-Object {{ @{{ CommandInfo = $_; HelpInfo = ( invoke-command {{ try {{ Get-Help -Name $_.Name -Full }} catch{{ '' }} }} ) }} }})" + )); + return (cmdlet?.RunScript(getCmdletAndHelp) ?? RunScript(getCmdletAndHelp)) + .Select(h => new CmdletAndHelpInfo { CommandInfo = (h["CommandInfo"] as PSObject)?.BaseObject as CommandInfo, HelpInfo = h["HelpInfo"] as PSObject }); + } + + public static IEnumerable GetModuleCmdletsAndHelpInfo(params string[] modulePaths) + => GetModuleCmdletsAndHelpInfo(null, modulePaths); + + public static CmdletAndHelpInfo ToCmdletAndHelpInfo(this CommandInfo commandInfo, PSObject helpInfo) => new CmdletAndHelpInfo { CommandInfo = commandInfo, HelpInfo = helpInfo }; + + public const string Psd1Indent = " "; + public const string GuidStart = Psd1Indent + "GUID"; + + public static Guid ReadGuidFromPsd1(string psd1Path) + { + var guid = Guid.NewGuid(); + if (File.Exists(psd1Path)) + { + var currentGuid = File.ReadAllLines(psd1Path) + .FirstOrDefault(l => l.TrimStart().StartsWith(GuidStart.TrimStart()))?.Split(new[] { " = " }, StringSplitOptions.RemoveEmptyEntries) + .LastOrDefault()?.Replace("'", String.Empty); + guid = currentGuid != null ? Guid.Parse(currentGuid) : guid; + } + + return guid; + } + } + + internal class CmdletAndHelpInfo + { + public CommandInfo CommandInfo { get; set; } + public PSObject HelpInfo { get; set; } + } +} diff --git a/src/Security/Security.Autorest/generated/runtime/BuildTime/StringExtensions.cs b/src/Security/Security.Autorest/generated/runtime/BuildTime/StringExtensions.cs new file mode 100644 index 000000000000..cfcaa1e9c964 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/BuildTime/StringExtensions.cs @@ -0,0 +1,24 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Linq; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell +{ + internal static class StringExtensions + { + public static string NullIfEmpty(this string text) => String.IsNullOrEmpty(text) ? null : text; + public static string NullIfWhiteSpace(this string text) => String.IsNullOrWhiteSpace(text) ? null : text; + public static string EmptyIfNull(this string text) => text ?? String.Empty; + + public static bool? ToNullableBool(this string text) => String.IsNullOrEmpty(text) ? (bool?)null : Convert.ToBoolean(text.ToLowerInvariant()); + + public static string ToUpperFirstCharacter(this string text) => String.IsNullOrEmpty(text) ? text : $"{text[0].ToString().ToUpperInvariant()}{text.Remove(0, 1)}"; + + public static string ReplaceNewLines(this string value, string replacer = " ", string[] newLineSymbols = null) + => (newLineSymbols ?? new []{ "\r\n", "\n" }).Aggregate(value.EmptyIfNull(), (current, symbol) => current.Replace(symbol, replacer)); + public static string NormalizeNewLines(this string value) => value.ReplaceNewLines("\u00A0").Replace("\u00A0", Environment.NewLine); + } +} diff --git a/src/Security/Security.Autorest/generated/runtime/BuildTime/XmlExtensions.cs b/src/Security/Security.Autorest/generated/runtime/BuildTime/XmlExtensions.cs new file mode 100644 index 000000000000..d8d3e53d3442 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/BuildTime/XmlExtensions.cs @@ -0,0 +1,28 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.IO; +using System.Xml; +using System.Xml.Serialization; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell +{ + internal static class XmlExtensions + { + public static string ToXmlString(this T inputObject, bool excludeDeclaration = false) + { + var serializer = new XmlSerializer(typeof(T)); + //https://stackoverflow.com/a/760290/294804 + //https://stackoverflow.com/a/3732234/294804 + var namespaces = new XmlSerializerNamespaces(new[] { XmlQualifiedName.Empty }); + var xmlSettings = new XmlWriterSettings { OmitXmlDeclaration = excludeDeclaration, Indent = true }; + using (var stringWriter = new StringWriter()) + using (var xmlWriter = XmlWriter.Create(stringWriter, xmlSettings)) + { + serializer.Serialize(xmlWriter, inputObject, namespaces); + return stringWriter.ToString(); + } + } + } +} diff --git a/src/Security/Security.Autorest/generated/runtime/CmdInfoHandler.cs b/src/Security/Security.Autorest/generated/runtime/CmdInfoHandler.cs new file mode 100644 index 000000000000..11f5ed7d072a --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/CmdInfoHandler.cs @@ -0,0 +1,40 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Management.Automation; +using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime +{ + using NextDelegate = Func, Task>, Task>; + using SignalDelegate = Func, Task>; + + public class CmdInfoHandler + { + private readonly string processRecordId; + private readonly string parameterSetName; + private readonly InvocationInfo invocationInfo; + + public CmdInfoHandler(string processRecordId, InvocationInfo invocationInfo, string parameterSetName) + { + this.processRecordId = processRecordId; + this.parameterSetName = parameterSetName; + this.invocationInfo = invocationInfo; + } + + public Task SendAsync(HttpRequestMessage request, CancellationToken token, Action cancel, SignalDelegate signal, NextDelegate next) + { + request.Headers.Add("x-ms-client-request-id", processRecordId); + request.Headers.Add("CommandName", invocationInfo?.InvocationName); + request.Headers.Add("FullCommandName", invocationInfo?.MyCommand?.Name); + request.Headers.Add("ParameterSetName", parameterSetName); + + // continue with pipeline. + return next(request, token, cancel, signal); + } + } +} diff --git a/src/Security/Security.Autorest/generated/runtime/Context.cs b/src/Security/Security.Autorest/generated/runtime/Context.cs new file mode 100644 index 000000000000..20473c3cb46a --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Context.cs @@ -0,0 +1,33 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime +{ + + using System; + using System.Linq; + using System.Collections; + using System.Collections.Generic; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + using GetEventData = System.Func; + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + /// + /// The IContext Interface defines the communication mechanism for input customization. + /// + /// + /// In the context, we will have client, pipeline, PSBoundParamters, default EventListener, Cancellation. + /// + public interface IContext + { + System.Management.Automation.InvocationInfo InvocationInformation { get; set; } + System.Threading.CancellationTokenSource CancellationTokenSource { get; set; } + System.Collections.Generic.IDictionary ExtensibleParameters { get; } + HttpPipeline Pipeline { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.Security.Security Client { get; } + } +} diff --git a/src/Security/Security.Autorest/generated/runtime/Conversions/ConversionException.cs b/src/Security/Security.Autorest/generated/runtime/Conversions/ConversionException.cs new file mode 100644 index 000000000000..5fed56f1e205 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Conversions/ConversionException.cs @@ -0,0 +1,17 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json +{ + internal class ConversionException : Exception + { + internal ConversionException(string message) + : base(message) { } + + internal ConversionException(JsonNode node, Type targetType) + : base($"Cannot convert '{node.Type}' to a {targetType.Name}") { } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Conversions/IJsonConverter.cs b/src/Security/Security.Autorest/generated/runtime/Conversions/IJsonConverter.cs new file mode 100644 index 000000000000..57dc4f7bfbea --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Conversions/IJsonConverter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json +{ + internal interface IJsonConverter + { + JsonNode ToJson(object value); + + object FromJson(JsonNode node); + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Conversions/Instances/BinaryConverter.cs b/src/Security/Security.Autorest/generated/runtime/Conversions/Instances/BinaryConverter.cs new file mode 100644 index 000000000000..5b4adb9fb6fb --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Conversions/Instances/BinaryConverter.cs @@ -0,0 +1,24 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json +{ + public sealed class BinaryConverter : JsonConverter + { + internal override JsonNode ToJson(byte[] value) => new XBinary(value); + + internal override byte[] FromJson(JsonNode node) + { + switch (node.Type) + { + case JsonType.String : return Convert.FromBase64String(node.ToString()); // Base64 Encoded + case JsonType.Binary : return ((XBinary)node).Value; + } + + throw new ConversionException(node, typeof(byte[])); + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Conversions/Instances/BooleanConverter.cs b/src/Security/Security.Autorest/generated/runtime/Conversions/Instances/BooleanConverter.cs new file mode 100644 index 000000000000..85853d31f76c --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Conversions/Instances/BooleanConverter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json +{ + public sealed class BooleanConverter : JsonConverter + { + internal override JsonNode ToJson(bool value) => new JsonBoolean(value); + + internal override bool FromJson(JsonNode node) => (bool)node; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Conversions/Instances/DateTimeConverter.cs b/src/Security/Security.Autorest/generated/runtime/Conversions/Instances/DateTimeConverter.cs new file mode 100644 index 000000000000..e7d805ab8ffa --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Conversions/Instances/DateTimeConverter.cs @@ -0,0 +1,18 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json +{ + public sealed class DateTimeConverter : JsonConverter + { + internal override JsonNode ToJson(DateTime value) + { + return new JsonDate(value); + } + + internal override DateTime FromJson(JsonNode node) => (DateTime)node; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Conversions/Instances/DateTimeOffsetConverter.cs b/src/Security/Security.Autorest/generated/runtime/Conversions/Instances/DateTimeOffsetConverter.cs new file mode 100644 index 000000000000..6b84be381378 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Conversions/Instances/DateTimeOffsetConverter.cs @@ -0,0 +1,15 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json +{ + public sealed class DateTimeOffsetConverter : JsonConverter + { + internal override JsonNode ToJson(DateTimeOffset value) => new JsonDate(value); + + internal override DateTimeOffset FromJson(JsonNode node) => (DateTimeOffset)node; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Conversions/Instances/DecimalConverter.cs b/src/Security/Security.Autorest/generated/runtime/Conversions/Instances/DecimalConverter.cs new file mode 100644 index 000000000000..83edb857c301 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Conversions/Instances/DecimalConverter.cs @@ -0,0 +1,16 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json +{ + public sealed class DecimalConverter : JsonConverter + { + internal override JsonNode ToJson(decimal value) => new JsonNumber(value.ToString()); + + internal override decimal FromJson(JsonNode node) + { + return (decimal)node; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Conversions/Instances/DoubleConverter.cs b/src/Security/Security.Autorest/generated/runtime/Conversions/Instances/DoubleConverter.cs new file mode 100644 index 000000000000..11021ccd9db2 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Conversions/Instances/DoubleConverter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json +{ + public sealed class DoubleConverter : JsonConverter + { + internal override JsonNode ToJson(double value) => new JsonNumber(value); + + internal override double FromJson(JsonNode node) => (double)node; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Conversions/Instances/EnumConverter.cs b/src/Security/Security.Autorest/generated/runtime/Conversions/Instances/EnumConverter.cs new file mode 100644 index 000000000000..e88d4a52c4e4 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Conversions/Instances/EnumConverter.cs @@ -0,0 +1,30 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json +{ + public sealed class EnumConverter : IJsonConverter + { + private readonly Type type; + + internal EnumConverter(Type type) + { + this.type = type ?? throw new ArgumentNullException(nameof(type)); + } + + public JsonNode ToJson(object value) => new JsonString(value.ToString()); + + public object FromJson(JsonNode node) + { + if (node.Type == JsonType.Number) + { + return Enum.ToObject(type, (int)node); + } + + return Enum.Parse(type, node.ToString(), ignoreCase: true); + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Conversions/Instances/GuidConverter.cs b/src/Security/Security.Autorest/generated/runtime/Conversions/Instances/GuidConverter.cs new file mode 100644 index 000000000000..621ce696bf8f --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Conversions/Instances/GuidConverter.cs @@ -0,0 +1,15 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json +{ + public sealed class GuidConverter : JsonConverter + { + internal override JsonNode ToJson(Guid value) => new JsonString(value.ToString()); + + internal override Guid FromJson(JsonNode node) => (Guid)node; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Conversions/Instances/HashSet'1Converter.cs b/src/Security/Security.Autorest/generated/runtime/Conversions/Instances/HashSet'1Converter.cs new file mode 100644 index 000000000000..3d9c2b5365c5 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Conversions/Instances/HashSet'1Converter.cs @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.Collections.Generic; +using System.Linq; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json +{ + public sealed class HashSetConverter : JsonConverter> + { + internal override JsonNode ToJson(HashSet value) + { + return new XSet(value); + } + + internal override HashSet FromJson(JsonNode node) + { + var collection = node as ICollection; + + if (collection.Count == 0) return null; + + // TODO: Remove Linq depedency + return new HashSet(collection.Cast()); + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Conversions/Instances/Int16Converter.cs b/src/Security/Security.Autorest/generated/runtime/Conversions/Instances/Int16Converter.cs new file mode 100644 index 000000000000..0e96c3ecf1ca --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Conversions/Instances/Int16Converter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json +{ + public sealed class Int16Converter : JsonConverter + { + internal override JsonNode ToJson(short value) => new JsonNumber(value); + + internal override short FromJson(JsonNode node) => (short)node; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Conversions/Instances/Int32Converter.cs b/src/Security/Security.Autorest/generated/runtime/Conversions/Instances/Int32Converter.cs new file mode 100644 index 000000000000..52bf4659fac9 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Conversions/Instances/Int32Converter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json +{ + public sealed class Int32Converter : JsonConverter + { + internal override JsonNode ToJson(int value) => new JsonNumber(value); + + internal override int FromJson(JsonNode node) => (int)node; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Conversions/Instances/Int64Converter.cs b/src/Security/Security.Autorest/generated/runtime/Conversions/Instances/Int64Converter.cs new file mode 100644 index 000000000000..3ad9d387e175 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Conversions/Instances/Int64Converter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json +{ + public sealed class Int64Converter : JsonConverter + { + internal override JsonNode ToJson(long value) => new JsonNumber(value); + + internal override long FromJson(JsonNode node) => (long)node; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Conversions/Instances/JsonArrayConverter.cs b/src/Security/Security.Autorest/generated/runtime/Conversions/Instances/JsonArrayConverter.cs new file mode 100644 index 000000000000..c137a3ae8fcb --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Conversions/Instances/JsonArrayConverter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json +{ + public sealed class JsonArrayConverter : JsonConverter + { + internal override JsonNode ToJson(JsonArray value) => value; + + internal override JsonArray FromJson(JsonNode node) => (JsonArray)node; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Conversions/Instances/JsonObjectConverter.cs b/src/Security/Security.Autorest/generated/runtime/Conversions/Instances/JsonObjectConverter.cs new file mode 100644 index 000000000000..365234ea81d6 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Conversions/Instances/JsonObjectConverter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json +{ + public sealed class JsonObjectConverter : JsonConverter + { + internal override JsonNode ToJson(JsonObject value) => value; + + internal override JsonObject FromJson(JsonNode node) => (JsonObject)node; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Conversions/Instances/SingleConverter.cs b/src/Security/Security.Autorest/generated/runtime/Conversions/Instances/SingleConverter.cs new file mode 100644 index 000000000000..8311fb2f08a4 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Conversions/Instances/SingleConverter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json +{ + public sealed class SingleConverter : JsonConverter + { + internal override JsonNode ToJson(float value) => new JsonNumber(value.ToString()); + + internal override float FromJson(JsonNode node) => (float)node; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Conversions/Instances/StringConverter.cs b/src/Security/Security.Autorest/generated/runtime/Conversions/Instances/StringConverter.cs new file mode 100644 index 000000000000..58da24ba5111 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Conversions/Instances/StringConverter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json +{ + public sealed class StringConverter : JsonConverter + { + internal override JsonNode ToJson(string value) => new JsonString(value); + + internal override string FromJson(JsonNode node) => node.ToString(); + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Conversions/Instances/TimeSpanConverter.cs b/src/Security/Security.Autorest/generated/runtime/Conversions/Instances/TimeSpanConverter.cs new file mode 100644 index 000000000000..0215ea1cc23a --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Conversions/Instances/TimeSpanConverter.cs @@ -0,0 +1,15 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json +{ + public sealed class TimeSpanConverter : JsonConverter + { + internal override JsonNode ToJson(TimeSpan value) => new JsonString(value.ToString()); + + internal override TimeSpan FromJson(JsonNode node) => (TimeSpan)node; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Conversions/Instances/UInt16Converter.cs b/src/Security/Security.Autorest/generated/runtime/Conversions/Instances/UInt16Converter.cs new file mode 100644 index 000000000000..1e419a74ca39 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Conversions/Instances/UInt16Converter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json +{ + public sealed class UInt16Converter : JsonConverter + { + internal override JsonNode ToJson(ushort value) => new JsonNumber(value); + + internal override ushort FromJson(JsonNode node) => (ushort)node; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Conversions/Instances/UInt32Converter.cs b/src/Security/Security.Autorest/generated/runtime/Conversions/Instances/UInt32Converter.cs new file mode 100644 index 000000000000..15e01406e926 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Conversions/Instances/UInt32Converter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json +{ + public sealed class UInt32Converter : JsonConverter + { + internal override JsonNode ToJson(uint value) => new JsonNumber(value); + + internal override uint FromJson(JsonNode node) => (uint)node; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Conversions/Instances/UInt64Converter.cs b/src/Security/Security.Autorest/generated/runtime/Conversions/Instances/UInt64Converter.cs new file mode 100644 index 000000000000..314ddec8a41f --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Conversions/Instances/UInt64Converter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json +{ + public sealed class UInt64Converter : JsonConverter + { + internal override JsonNode ToJson(ulong value) => new JsonNumber(value.ToString()); + + internal override ulong FromJson(JsonNode node) => (ulong)node; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Conversions/Instances/UriConverter.cs b/src/Security/Security.Autorest/generated/runtime/Conversions/Instances/UriConverter.cs new file mode 100644 index 000000000000..a25fd816d12e --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Conversions/Instances/UriConverter.cs @@ -0,0 +1,15 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json +{ + public sealed class UriConverter : JsonConverter + { + internal override JsonNode ToJson(Uri value) => new JsonString(value.AbsoluteUri); + + internal override Uri FromJson(JsonNode node) => (Uri)node; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Conversions/JsonConverter.cs b/src/Security/Security.Autorest/generated/runtime/Conversions/JsonConverter.cs new file mode 100644 index 000000000000..11c1ae54c88f --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Conversions/JsonConverter.cs @@ -0,0 +1,21 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json +{ + public abstract class JsonConverter : IJsonConverter + { + internal abstract T FromJson(JsonNode node); + + internal abstract JsonNode ToJson(T value); + + #region IConverter + + object IJsonConverter.FromJson(JsonNode node) => FromJson(node); + + JsonNode IJsonConverter.ToJson(object value) => ToJson((T)value); + + #endregion + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Conversions/JsonConverterAttribute.cs b/src/Security/Security.Autorest/generated/runtime/Conversions/JsonConverterAttribute.cs new file mode 100644 index 000000000000..5eeeb41b0e86 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Conversions/JsonConverterAttribute.cs @@ -0,0 +1,18 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json +{ + public sealed class JsonConverterAttribute : Attribute + { + internal JsonConverterAttribute(Type type) + { + Converter = (IJsonConverter)Activator.CreateInstance(type); + } + + internal IJsonConverter Converter { get; } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Conversions/JsonConverterFactory.cs b/src/Security/Security.Autorest/generated/runtime/Conversions/JsonConverterFactory.cs new file mode 100644 index 000000000000..5a55ce748240 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Conversions/JsonConverterFactory.cs @@ -0,0 +1,91 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json +{ + public sealed class JsonConverterFactory + { + private static readonly Dictionary converters = new Dictionary(); + + static JsonConverterFactory() + { + AddInternal(new BooleanConverter()); + AddInternal(new DateTimeConverter()); + AddInternal(new DateTimeOffsetConverter()); + AddInternal(new BinaryConverter()); + AddInternal(new DecimalConverter()); + AddInternal(new DoubleConverter()); + AddInternal(new GuidConverter()); + AddInternal(new Int16Converter()); + AddInternal(new Int32Converter()); + AddInternal(new Int64Converter()); + AddInternal(new SingleConverter()); + AddInternal(new StringConverter()); + AddInternal(new TimeSpanConverter()); + AddInternal(new UInt16Converter()); + AddInternal(new UInt32Converter()); + AddInternal(new UInt64Converter()); + AddInternal(new UriConverter()); + + // Hash sets + AddInternal(new HashSetConverter()); + AddInternal(new HashSetConverter()); + AddInternal(new HashSetConverter()); + AddInternal(new HashSetConverter()); + AddInternal(new HashSetConverter()); + AddInternal(new HashSetConverter()); + + // JSON + + AddInternal(new JsonObjectConverter()); + AddInternal(new JsonArrayConverter()); + } + + internal static Dictionary Instances => converters; + + internal static IJsonConverter Get(Type type) + { + var details = TypeDetails.Get(type); + + if (details.JsonConverter == null) + { + throw new ConversionException($"No converter found for '{type.Name}'."); + } + + return details.JsonConverter; + } + + internal static bool TryGet(Type type, out IJsonConverter converter) + { + var typeDetails = TypeDetails.Get(type); + + converter = typeDetails.JsonConverter; + + return converter != null; + } + + private static void AddInternal(JsonConverter converter) + => converters.Add(typeof(T), converter); + + private static void AddInternal(IJsonConverter converter) + => converters.Add(typeof(T), converter); + + internal static void Add(JsonConverter converter) + { + if (converter == null) + { + throw new ArgumentNullException(nameof(converter)); + } + + AddInternal(converter); + + var type = TypeDetails.Get(); + + type.JsonConverter = converter; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Conversions/StringLikeConverter.cs b/src/Security/Security.Autorest/generated/runtime/Conversions/StringLikeConverter.cs new file mode 100644 index 000000000000..15a953c9ca94 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Conversions/StringLikeConverter.cs @@ -0,0 +1,45 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Reflection; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json +{ + public sealed class StringLikeConverter : IJsonConverter + { + private readonly Type type; + private readonly MethodInfo parseMethod; + + internal StringLikeConverter(Type type) + { + this.type = type ?? throw new ArgumentNullException(nameof(type)); + this.parseMethod = StringLikeHelper.GetParseMethod(type); + } + + public object FromJson(JsonNode node) => + parseMethod.Invoke(null, new[] { node.ToString() }); + + public JsonNode ToJson(object value) => new JsonString(value.ToString()); + } + + internal static class StringLikeHelper + { + private static readonly Type[] parseMethodParamaterTypes = new[] { typeof(string) }; + + internal static bool IsStringLike(Type type) + { + return GetParseMethod(type) != null; + } + + internal static MethodInfo GetParseMethod(Type type) + { + MethodInfo method = type.GetMethod("Parse", parseMethodParamaterTypes); + + if (method?.IsPublic != true) return null; + + return method; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Customizations/IJsonSerializable.cs b/src/Security/Security.Autorest/generated/runtime/Customizations/IJsonSerializable.cs new file mode 100644 index 000000000000..8859c3311b76 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Customizations/IJsonSerializable.cs @@ -0,0 +1,263 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json; +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime +{ + public interface IJsonSerializable + { + JsonNode ToJson(JsonObject container = null, SerializationMode serializationMode = SerializationMode.None); + } + internal static class JsonSerializable + { + /// + /// Serializes an enumerable and returns a JsonNode. + /// + /// an IEnumerable collection of items + /// A JsonNode that contains the collection of items serialized. + private static JsonNode ToJsonValue(System.Collections.IEnumerable enumerable) + { + if (enumerable != null) + { + // is it a byte array of some kind? + if (enumerable is System.Collections.Generic.IEnumerable byteEnumerable) + { + return new XBinary(System.Linq.Enumerable.ToArray(byteEnumerable)); + } + + var hasValues = false; + // just create an array of value nodes. + var result = new XNodeArray(); + foreach (var each in enumerable) + { + // we had at least one value. + hasValues = true; + + // try to serialize it. + var node = ToJsonValue(each); + if (null != node) + { + result.Add(node); + } + } + + // if we were able to add values, (or it was just empty), return it. + if (result.Count > 0 || !hasValues) + { + return result; + } + } + + // we couldn't serialize the values. Sorry. + return null; + } + + /// + /// Serializes a valuetype to a JsonNode. + /// + /// a ValueType (ie, a primitive, enum or struct) to be serialized + /// a JsonNode with the serialized value + private static JsonNode ToJsonValue(ValueType vValue) + { + // numeric type + if (vValue is SByte || vValue is Int16 || vValue is Int32 || vValue is Int64 || vValue is Byte || vValue is UInt16 || vValue is UInt32 || vValue is UInt64 || vValue is decimal || vValue is float || vValue is double) + { + return new JsonNumber(vValue.ToString()); + } + + // boolean type + if (vValue is bool bValue) + { + return new JsonBoolean(bValue); + } + + // dates + if (vValue is DateTime dtValue) + { + return new JsonDate(dtValue); + } + + // DictionaryEntity struct type + if (vValue is System.Collections.DictionaryEntry deValue) + { + return new JsonObject { { deValue.Key.ToString(), ToJsonValue(deValue.Value) } }; + } + + // sorry, no idea. + return null; + } + /// + /// Attempts to serialize an object by using ToJson() or ToJsonString() if they exist. + /// + /// the object to be serialized. + /// the serialized JsonNode (if successful), otherwise, null + private static JsonNode TryToJsonValue(dynamic oValue) + { + object jsonValue = null; + dynamic v = oValue; + try + { + jsonValue = v.ToJson().ToString(); + } + catch + { + // no harm... + try + { + jsonValue = v.ToJsonString().ToString(); + } + catch + { + // no worries here either. + } + } + + // if we got something out, let's use it. + if (null != jsonValue) + { + // JsonNumber is really a literal json value. Just don't try to cast that back to an actual number, ok? + return new JsonNumber(jsonValue.ToString()); + } + + return null; + } + + /// + /// Serialize an object by using a variety of methods. + /// + /// the object to be serialized. + /// the serialized JsonNode (if successful), otherwise, null + internal static JsonNode ToJsonValue(object value) + { + // things that implement our interface are preferred. + if (value is Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IJsonSerializable jsonSerializable) + { + return jsonSerializable.ToJson(); + } + + // strings are easy. + if (value is string || value is char) + { + return new JsonString(value.ToString()); + } + + // value types are fairly straightforward (fallback to ToJson()/ToJsonString() or literal JsonString ) + if (value is System.ValueType vValue) + { + return ToJsonValue(vValue) ?? TryToJsonValue(vValue) ?? new JsonString(vValue.ToString()); + } + + // dictionaries are objects that should be able to serialize + if (value is System.Collections.Generic.IDictionary dictionary) + { + return Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.JsonSerializable.ToJson(dictionary, null); + } + + // hashtables are converted to dictionaries for serialization + if (value is System.Collections.Hashtable hashtable) + { + var dict = new System.Collections.Generic.Dictionary(); + DictionaryExtensions.HashTableToDictionary(hashtable, dict); + return Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.JsonSerializable.ToJson(dict, null); + } + + // enumerable collections are handled like arrays (again, fallback to ToJson()/ToJsonString() or literal JsonString) + if (value is System.Collections.IEnumerable enumerableValue) + { + // some kind of enumerable value + return ToJsonValue(enumerableValue) ?? TryToJsonValue(value) ?? new JsonString(value.ToString()); + } + + // at this point, we're going to fallback to a string literal here, since we really have no idea what it is. + return new JsonString(value.ToString()); + } + + internal static JsonObject ToJson(System.Collections.Generic.Dictionary dictionary, JsonObject container) => ToJson((System.Collections.Generic.IDictionary)dictionary, container); + + /// + /// Serializes a dictionary into a JsonObject container. + /// + /// The dictionary to serailize + /// the container to serialize the dictionary into + /// the container + internal static JsonObject ToJson(System.Collections.Generic.IDictionary dictionary, JsonObject container) + { + container = container ?? new JsonObject(); + if (dictionary != null && dictionary.Count > 0) + { + foreach (var key in dictionary) + { + // currently, we don't serialize null values. + if (null != key.Value) + { + container.Add(key.Key, ToJsonValue(key.Value)); + continue; + } + } + } + return container; + } + + internal static Func> DeserializeDictionary(Func> dictionaryFactory) + { + return (node) => FromJson(node, dictionaryFactory(), (object)(DeserializeDictionary(dictionaryFactory)) as Func); + } + + internal static System.Collections.Generic.IDictionary FromJson(JsonObject json, System.Collections.Generic.Dictionary container, System.Func objectFactory, System.Collections.Generic.HashSet excludes = null) => FromJson(json, (System.Collections.Generic.IDictionary)container, objectFactory, excludes); + + + internal static System.Collections.Generic.IDictionary FromJson(JsonObject json, System.Collections.Generic.IDictionary container, System.Func objectFactory, System.Collections.Generic.HashSet excludes = null) + { + if (null == json) + { + return container; + } + + foreach (var key in json.Keys) + { + if (true == excludes?.Contains(key)) + { + continue; + } + + var value = json[key]; + try + { + switch (value.Type) + { + case JsonType.Null: + // skip null values. + continue; + + case JsonType.Array: + case JsonType.Boolean: + case JsonType.Date: + case JsonType.Binary: + case JsonType.Number: + case JsonType.String: + container.Add(key, (V)value.ToValue()); + break; + case JsonType.Object: + if (objectFactory != null) + { + var v = objectFactory(value as JsonObject); + if (null != v) + { + container.Add(key, v); + } + } + break; + } + } + catch + { + } + } + return container; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Customizations/JsonArray.cs b/src/Security/Security.Autorest/generated/runtime/Customizations/JsonArray.cs new file mode 100644 index 000000000000..68366260e942 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Customizations/JsonArray.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json +{ + public partial class JsonArray + { + internal override object ToValue() => Count == 0 ? new object[0] : System.Linq.Enumerable.ToArray(System.Linq.Enumerable.Select(this, each => each.ToValue())); + } + + +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Customizations/JsonBoolean.cs b/src/Security/Security.Autorest/generated/runtime/Customizations/JsonBoolean.cs new file mode 100644 index 000000000000..984581bf55f2 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Customizations/JsonBoolean.cs @@ -0,0 +1,16 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json +{ + internal partial class JsonBoolean + { + internal static JsonBoolean Create(bool? value) => value is bool b ? new JsonBoolean(b) : null; + internal bool ToBoolean() => Value; + + internal override object ToValue() => Value; + } + + +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Customizations/JsonNode.cs b/src/Security/Security.Autorest/generated/runtime/Customizations/JsonNode.cs new file mode 100644 index 000000000000..5157dabcd130 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Customizations/JsonNode.cs @@ -0,0 +1,21 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json +{ + using System; + using System.Collections.Generic; + + public partial class JsonNode + { + /// + /// Returns the content of this node as the underlying value. + /// Will default to the string representation if not overridden in child classes. + /// + /// an object with the underlying value of the node. + internal virtual object ToValue() { + return this.ToString(); + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Customizations/JsonNumber.cs b/src/Security/Security.Autorest/generated/runtime/Customizations/JsonNumber.cs new file mode 100644 index 000000000000..916959278f0e --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Customizations/JsonNumber.cs @@ -0,0 +1,78 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json +{ + using System; + + public partial class JsonNumber + { + internal static readonly DateTime EpochDate = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); + private static long ToUnixTime(DateTime dateTime) + { + return (long)dateTime.Subtract(EpochDate).TotalSeconds; + } + private static DateTime FromUnixTime(long totalSeconds) + { + return EpochDate.AddSeconds(totalSeconds); + } + internal byte ToByte() => this; + internal int ToInt() => this; + internal long ToLong() => this; + internal short ToShort() => this; + internal UInt16 ToUInt16() => this; + internal UInt32 ToUInt32() => this; + internal UInt64 ToUInt64() => this; + internal decimal ToDecimal() => this; + internal double ToDouble() => this; + internal float ToFloat() => this; + + internal static JsonNumber Create(int? value) => value is int n ? new JsonNumber(n) : null; + internal static JsonNumber Create(long? value) => value is long n ? new JsonNumber(n) : null; + internal static JsonNumber Create(float? value) => value is float n ? new JsonNumber(n) : null; + internal static JsonNumber Create(double? value) => value is double n ? new JsonNumber(n) : null; + internal static JsonNumber Create(decimal? value) => value is decimal n ? new JsonNumber(n) : null; + internal static JsonNumber Create(DateTime? value) => value is DateTime date ? new JsonNumber(ToUnixTime(date)) : null; + + public static implicit operator DateTime(JsonNumber number) => FromUnixTime(number); + internal DateTime ToDateTime() => this; + + internal JsonNumber(decimal value) + { + this.value = value.ToString(); + } + internal override object ToValue() + { + if (IsInteger) + { + if (int.TryParse(this.value, out int iValue)) + { + return iValue; + } + if (long.TryParse(this.value, out long lValue)) + { + return lValue; + } + } + else + { + if (float.TryParse(this.value, out float fValue)) + { + return fValue; + } + if (double.TryParse(this.value, out double dValue)) + { + return dValue; + } + if (decimal.TryParse(this.value, out decimal dcValue)) + { + return dcValue; + } + } + return null; + } + } + + +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Customizations/JsonObject.cs b/src/Security/Security.Autorest/generated/runtime/Customizations/JsonObject.cs new file mode 100644 index 000000000000..be3896c58d42 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Customizations/JsonObject.cs @@ -0,0 +1,183 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json +{ + using System; + using System.Collections.Generic; + + public partial class JsonObject + { + internal override object ToValue() => Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.JsonSerializable.FromJson(this, new System.Collections.Generic.Dictionary(), (obj) => obj.ToValue()); + + internal void SafeAdd(string name, Func valueFn) + { + if (valueFn != null) + { + var value = valueFn(); + if (null != value) + { + items.Add(name, value); + } + } + } + + internal void SafeAdd(string name, JsonNode value) + { + if (null != value) + { + items.Add(name, value); + } + } + + internal T NullableProperty(string propertyName) where T : JsonNode + { + if (this.TryGetValue(propertyName, out JsonNode value)) + { + if (value.IsNull) + { + return null; + } + if (value is T tval) + { + return tval; + } + /* it's present, but not the correct type... */ + //throw new Exception($"Property {propertyName} in object expected type {typeof(T).Name} but value of type {value.Type.ToString()} was found."); + } + return null; + } + + internal JsonObject Property(string propertyName) + { + return PropertyT(propertyName); + } + + internal T PropertyT(string propertyName) where T : JsonNode + { + if (this.TryGetValue(propertyName, out JsonNode value)) + { + if (value.IsNull) + { + return null; // we're going to assume that the consumer knows what to do if null is explicity returned? + } + + if (value is T tval) + { + return tval; + } + /* it's present, but not the correct type... */ + // throw new Exception($"Property {propertyName} in object expected type {typeof(T).Name} but value of type {value.Type.ToString()} was found."); + } + return null; + } + + internal int NumberProperty(string propertyName, ref int output) => output = this.PropertyT(propertyName)?.ToInt() ?? output; + internal float NumberProperty(string propertyName, ref float output) => output = this.PropertyT(propertyName)?.ToFloat() ?? output; + internal byte NumberProperty(string propertyName, ref byte output) => output = this.PropertyT(propertyName)?.ToByte() ?? output; + internal long NumberProperty(string propertyName, ref long output) => output = this.PropertyT(propertyName)?.ToLong() ?? output; + internal double NumberProperty(string propertyName, ref double output) => output = this.PropertyT(propertyName)?.ToDouble() ?? output; + internal decimal NumberProperty(string propertyName, ref decimal output) => output = this.PropertyT(propertyName)?.ToDecimal() ?? output; + internal short NumberProperty(string propertyName, ref short output) => output = this.PropertyT(propertyName)?.ToShort() ?? output; + internal DateTime NumberProperty(string propertyName, ref DateTime output) => output = this.PropertyT(propertyName)?.ToDateTime() ?? output; + + internal int? NumberProperty(string propertyName, ref int? output) => output = this.NullableProperty(propertyName)?.ToInt() ?? null; + internal float? NumberProperty(string propertyName, ref float? output) => output = this.NullableProperty(propertyName)?.ToFloat() ?? null; + internal byte? NumberProperty(string propertyName, ref byte? output) => output = this.NullableProperty(propertyName)?.ToByte() ?? null; + internal long? NumberProperty(string propertyName, ref long? output) => output = this.NullableProperty(propertyName)?.ToLong() ?? null; + internal double? NumberProperty(string propertyName, ref double? output) => output = this.NullableProperty(propertyName)?.ToDouble() ?? null; + internal decimal? NumberProperty(string propertyName, ref decimal? output) => output = this.NullableProperty(propertyName)?.ToDecimal() ?? null; + internal short? NumberProperty(string propertyName, ref short? output) => output = this.NullableProperty(propertyName)?.ToShort() ?? null; + + internal DateTime? NumberProperty(string propertyName, ref DateTime? output) => output = this.NullableProperty(propertyName)?.ToDateTime() ?? null; + + + internal string StringProperty(string propertyName) => this.PropertyT(propertyName)?.ToString(); + internal string StringProperty(string propertyName, ref string output) => output = this.PropertyT(propertyName)?.ToString() ?? output; + internal char StringProperty(string propertyName, ref char output) => output = this.PropertyT(propertyName)?.ToChar() ?? output; + internal char? StringProperty(string propertyName, ref char? output) => output = this.PropertyT(propertyName)?.ToChar() ?? null; + + internal DateTime StringProperty(string propertyName, ref DateTime output) => DateTime.TryParse(this.PropertyT(propertyName)?.ToString(), out output) ? output : output; + internal DateTime? StringProperty(string propertyName, ref DateTime? output) => output = DateTime.TryParse(this.PropertyT(propertyName)?.ToString(), out var o) ? o : output; + + + internal bool BooleanProperty(string propertyName, ref bool output) => output = this.PropertyT(propertyName)?.ToBoolean() ?? output; + internal bool? BooleanProperty(string propertyName, ref bool? output) => output = this.PropertyT(propertyName)?.ToBoolean() ?? null; + + internal T[] ArrayProperty(string propertyName, ref T[] output, Func deserializer) + { + var array = this.PropertyT(propertyName); + if (array != null) + { + output = new T[array.Count]; + for (var i = 0; i < output.Length; i++) + { + output[i] = deserializer(array[i]); + } + } + return output; + } + internal T[] ArrayProperty(string propertyName, Func deserializer) + { + var array = this.PropertyT(propertyName); + if (array != null) + { + var output = new T[array.Count]; + for (var i = 0; i < output.Length; i++) + { + output[i] = deserializer(array[i]); + } + return output; + } + return new T[0]; + } + internal void IterateArrayProperty(string propertyName, Action deserializer) + { + var array = this.PropertyT(propertyName); + if (array != null) + { + for (var i = 0; i < array.Count; i++) + { + deserializer(array[i]); + } + } + } + + internal Dictionary DictionaryProperty(string propertyName, ref Dictionary output, Func deserializer) + { + var dictionary = this.PropertyT(propertyName); + if (output == null) + { + output = new Dictionary(); + } + else + { + output.Clear(); + } + if (dictionary != null) + { + foreach (var key in dictionary.Keys) + { + output[key] = deserializer(dictionary[key]); + } + } + return output; + } + + internal static JsonObject Create(IDictionary source, Func selector) + { + if (source == null || selector == null) + { + return null; + } + var result = new JsonObject(); + + foreach (var key in source.Keys) + { + result.SafeAdd(key, selector(source[key])); + } + return result; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Customizations/JsonString.cs b/src/Security/Security.Autorest/generated/runtime/Customizations/JsonString.cs new file mode 100644 index 000000000000..e32bbeb0dde7 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Customizations/JsonString.cs @@ -0,0 +1,34 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json +{ + using System; + using System.Globalization; + using System.Linq; + + public partial class JsonString + { + internal static string DateFormat = "yyyy-MM-dd"; + internal static string DateTimeFormat = "yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK"; + internal static string DateTimeRfc1123Format = "R"; + + internal static JsonString Create(string value) => value == null ? null : new JsonString(value); + internal static JsonString Create(char? value) => value is char c ? new JsonString(c.ToString()) : null; + + internal static JsonString CreateDate(DateTime? value) => value is DateTime date ? new JsonString(date.ToString(DateFormat, CultureInfo.CurrentCulture)) : null; + internal static JsonString CreateDateTime(DateTime? value) => value is DateTime date ? new JsonString(date.ToString(DateTimeFormat, CultureInfo.CurrentCulture)) : null; + internal static JsonString CreateDateTimeRfc1123(DateTime? value) => value is DateTime date ? new JsonString(date.ToString(DateTimeRfc1123Format, CultureInfo.CurrentCulture)) : null; + + internal char ToChar() => this.Value?.ToString()?.FirstOrDefault() ?? default(char); + public static implicit operator char(JsonString value) => value?.ToString()?.FirstOrDefault() ?? default(char); + public static implicit operator char? (JsonString value) => value?.ToString()?.FirstOrDefault(); + + public static implicit operator DateTime(JsonString value) => DateTime.TryParse(value, out var output) ? output : default(DateTime); + public static implicit operator DateTime? (JsonString value) => DateTime.TryParse(value, out var output) ? output : default(DateTime?); + + } + + +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Customizations/XNodeArray.cs b/src/Security/Security.Autorest/generated/runtime/Customizations/XNodeArray.cs new file mode 100644 index 000000000000..e9c54db36a11 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Customizations/XNodeArray.cs @@ -0,0 +1,44 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json +{ + using System; + using System.Linq; + + public partial class XNodeArray + { + internal static XNodeArray Create(T[] source, Func selector) + { + if (source == null || selector == null) + { + return null; + } + var result = new XNodeArray(); + foreach (var item in source.Select(selector)) + { + result.SafeAdd(item); + } + return result; + } + internal void SafeAdd(JsonNode item) + { + if (item != null) + { + items.Add(item); + } + } + internal void SafeAdd(Func itemFn) + { + if (itemFn != null) + { + var item = itemFn(); + if (item != null) + { + items.Add(item); + } + } + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Debugging.cs b/src/Security/Security.Autorest/generated/runtime/Debugging.cs new file mode 100644 index 000000000000..11495781f8a4 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Debugging.cs @@ -0,0 +1,28 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime +{ + internal static class AttachDebugger + { + internal static void Break() + { + while (!System.Diagnostics.Debugger.IsAttached) + { + System.Console.Error.WriteLine($"Waiting for debugger to attach to process {System.Diagnostics.Process.GetCurrentProcess().Id}"); + for (int i = 0; i < 50; i++) + { + if (System.Diagnostics.Debugger.IsAttached) + { + break; + } + System.Threading.Thread.Sleep(100); + System.Console.Error.Write("."); + } + System.Console.Error.WriteLine(); + } + System.Diagnostics.Debugger.Break(); + } + } +} diff --git a/src/Security/Security.Autorest/generated/runtime/DictionaryExtensions.cs b/src/Security/Security.Autorest/generated/runtime/DictionaryExtensions.cs new file mode 100644 index 000000000000..230d0c82ac00 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/DictionaryExtensions.cs @@ -0,0 +1,33 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime +{ + internal static class DictionaryExtensions + { + internal static void HashTableToDictionary(System.Collections.Hashtable hashtable, System.Collections.Generic.IDictionary dictionary) + { + if (null == hashtable) + { + return; + } + foreach (var each in hashtable.Keys) + { + var key = each.ToString(); + var value = hashtable[key]; + if (null != value) + { + try + { + dictionary[key] = (V)value; + } + catch + { + // Values getting dropped; not compatible with target dictionary. Not sure what to do here. + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/EventData.cs b/src/Security/Security.Autorest/generated/runtime/EventData.cs new file mode 100644 index 000000000000..255230aa9956 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/EventData.cs @@ -0,0 +1,78 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime +{ + + using System; + using System.Threading; + + ///Represents the data in signaled event. + public partial class EventData + { + /// + /// The type of the event being signaled + /// + public string Id; + + /// + /// The user-ready message from the event. + /// + public string Message; + + /// + /// When the event is about a parameter, this is the parameter name. + /// Used in Validation Events + /// + public string Parameter; + + /// + /// This represents a numeric value associated with the event. + /// Use for progress-style events + /// + public double Value; + + /// + /// Any extended data for an event should be serialized and stored here. + /// + public string ExtendedData; + + /// + /// If the event triggers after the request message has been created, this will contain the Request Message (which in HTTP calls would be HttpRequestMessage) + /// + /// Typically you'd cast this to the expected type to use it: + /// + /// if(eventData.RequestMessgae is HttpRequestMessage httpRequest) + /// { + /// httpRequest.Headers.Add("x-request-flavor", "vanilla"); + /// } + /// + /// + public object RequestMessage; + + /// + /// If the event triggers after the response is back, this will contain the Response Message (which in HTTP calls would be HttpResponseMessage) + /// + /// Typically you'd cast this to the expected type to use it: + /// + /// if(eventData.ResponseMessage is HttpResponseMessage httpResponse){ + /// var flavor = httpResponse.Headers.GetValue("x-request-flavor"); + /// } + /// + /// + public object ResponseMessage; + + /// + /// Cancellation method for this event. + /// + /// If the event consumer wishes to cancel the request that initiated this event, call Cancel() + /// + /// + /// The original initiator of the request must provide the implementation of this. + /// + public System.Action Cancel; + } + +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/EventDataExtensions.cs b/src/Security/Security.Autorest/generated/runtime/EventDataExtensions.cs new file mode 100644 index 000000000000..a0f55016613d --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/EventDataExtensions.cs @@ -0,0 +1,94 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime +{ + using System; + + /// + /// PowerShell-specific data on top of the llc# EventData + /// + /// + /// In PowerShell, we add on the EventDataConverter to support sending events between modules. + /// Obviously, this code would need to be duplcated on both modules. + /// This is preferable to sharing a common library, as versioning makes that problematic. + /// + [System.ComponentModel.TypeConverter(typeof(EventDataConverter))] + public partial class EventData : EventArgs + { + } + + /// + /// A PowerShell PSTypeConverter to adapt an EventData object that has been passed. + /// Usually used between modules. + /// + public class EventDataConverter : System.Management.Automation.PSTypeConverter + { + public override bool CanConvertTo(object sourceValue, Type destinationType) => false; + public override object ConvertTo(object sourceValue, Type destinationType, IFormatProvider formatProvider, bool ignoreCase) => null; + public override bool CanConvertFrom(dynamic sourceValue, Type destinationType) => destinationType == typeof(EventData) && CanConvertFrom(sourceValue); + public override object ConvertFrom(dynamic sourceValue, Type destinationType, IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Verifies that a given object has the required members to convert it to the target type (EventData) + /// + /// Uses a dynamic type so that it is able to use the simplest code without excessive checking. + /// + /// The instance to verify + /// True, if the object has all the required parameters. + public static bool CanConvertFrom(dynamic sourceValue) + { + try + { + // check if this has *required* parameters... + sourceValue?.Id?.GetType(); + sourceValue?.Message?.GetType(); + sourceValue?.Cancel?.GetType(); + + // remaining parameters are not *required*, + // and if they have values, it will copy them at conversion time. + } + catch + { + // if anything throws an exception (because it's null, or doesn't have that member) + return false; + } + return true; + } + + /// + /// Returns result of the delegate as the expected type, or default(T) + /// + /// This isolates any exceptions from the consumer. + /// + /// A delegate that returns a value + /// The desired output type + /// The value from the function if the type is correct + private static T To(Func srcValue) + { + try { return srcValue(); } + catch { return default(T); } + } + + /// + /// Converts an incoming object to the expected type by treating the incoming object as a dynamic, and coping the expected values. + /// + /// the incoming object + /// EventData + public static EventData ConvertFrom(dynamic sourceValue) + { + return new EventData + { + Id = To(() => sourceValue.Id), + Message = To(() => sourceValue.Message), + Parameter = To(() => sourceValue.Parameter), + Value = To(() => sourceValue.Value), + RequestMessage = To(() => sourceValue.RequestMessage), + ResponseMessage = To(() => sourceValue.ResponseMessage), + Cancel = To(() => sourceValue.Cancel) + }; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/EventListener.cs b/src/Security/Security.Autorest/generated/runtime/EventListener.cs new file mode 100644 index 000000000000..99dfeed718d5 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/EventListener.cs @@ -0,0 +1,247 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime +{ + + using System; + using System.Linq; + using System.Collections; + using System.Collections.Generic; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + using GetEventData = System.Func; + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + public interface IValidates + { + Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IEventListener listener); + } + + /// + /// The IEventListener Interface defines the communication mechanism for Signaling events during a remote call. + /// + /// + /// The interface is designed to be as minimal as possible, allow for quick peeking of the event type (id) + /// and the cancellation status and provides a delegate for retrieving the event details themselves. + /// + public interface IEventListener + { + Task Signal(string id, CancellationToken token, GetEventData createMessage); + CancellationToken Token { get; } + System.Action Cancel { get; } + } + + internal static partial class Extensions + { + public static Task Signal(this IEventListener instance, string id, CancellationToken token, Func createMessage) => instance.Signal(id, token, createMessage); + public static Task Signal(this IEventListener instance, string id, CancellationToken token) => instance.Signal(id, token, () => new EventData { Id = id, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, string messageText) => instance.Signal(id, token, () => new EventData { Id = id, Message = messageText, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, string messageText, HttpRequestMessage request) => instance.Signal(id, token, () => new EventData { Id = id, Message = messageText, RequestMessage = request, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, string messageText, HttpResponseMessage response) => instance.Signal(id, token, () => new EventData { Id = id, Message = messageText, RequestMessage = response.RequestMessage, ResponseMessage = response, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, string messageText, double magnitude) => instance.Signal(id, token, () => new EventData { Id = id, Message = messageText, Value = magnitude, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, string messageText, double magnitude, HttpRequestMessage request) => instance.Signal(id, token, () => new EventData { Id = id, Message = messageText, RequestMessage = request, Value = magnitude, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, string messageText, double magnitude, HttpResponseMessage response) => instance.Signal(id, token, () => new EventData { Id = id, Message = messageText, RequestMessage = response.RequestMessage, ResponseMessage = response, Value = magnitude, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, HttpRequestMessage request) => instance.Signal(id, token, () => new EventData { Id = id, RequestMessage = request, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, HttpRequestMessage request, HttpResponseMessage response) => instance.Signal(id, token, () => new EventData { Id = id, RequestMessage = request, ResponseMessage = response, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, HttpResponseMessage response) => instance.Signal(id, token, () => new EventData { Id = id, RequestMessage = response.RequestMessage, ResponseMessage = response, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, EventData message) => instance.Signal(id, token, () => { message.Id = id; message.Cancel = instance.Cancel; return message; }); + + public static Task Signal(this IEventListener instance, string id, Func createMessage) => instance.Signal(id, instance.Token, createMessage); + public static Task Signal(this IEventListener instance, string id) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, string messageText) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Message = messageText, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, string messageText, HttpRequestMessage request) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Message = messageText, RequestMessage = request, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, string messageText, HttpResponseMessage response) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Message = messageText, RequestMessage = response.RequestMessage, ResponseMessage = response, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, string messageText, double magnitude) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Message = messageText, Value = magnitude, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, string messageText, double magnitude, HttpRequestMessage request) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Message = messageText, RequestMessage = request, Value = magnitude, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, string messageText, double magnitude, HttpResponseMessage response) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Message = messageText, RequestMessage = response.RequestMessage, ResponseMessage = response, Value = magnitude, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, HttpRequestMessage request) => instance.Signal(id, instance.Token, () => new EventData { Id = id, RequestMessage = request, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, HttpRequestMessage request, HttpResponseMessage response) => instance.Signal(id, instance.Token, () => new EventData { Id = id, RequestMessage = request, ResponseMessage = response, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, HttpResponseMessage response) => instance.Signal(id, instance.Token, () => new EventData { Id = id, RequestMessage = response.RequestMessage, ResponseMessage = response, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, EventData message) => instance.Signal(id, instance.Token, () => { message.Id = id; message.Cancel = instance.Cancel; return message; }); + + public static Task Signal(this IEventListener instance, string id, System.Uri uri) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Message = uri.ToString(), Cancel = instance.Cancel }); + + public static async Task AssertNotNull(this IEventListener instance, string parameterName, object value) + { + if (value == null) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ValidationWarning, Message = $"'{parameterName}' should not be null", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertMinimumLength(this IEventListener instance, string parameterName, string value, int length) + { + if (value != null && value.Length < length) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ValidationWarning, Message = $"Length of '{parameterName}' is less than {length}", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertMaximumLength(this IEventListener instance, string parameterName, string value, int length) + { + if (value != null && value.Length > length) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ValidationWarning, Message = $"Length of '{parameterName}' is greater than {length}", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + + public static async Task AssertRegEx(this IEventListener instance, string parameterName, string value, string regularExpression) + { + if (value != null && !System.Text.RegularExpressions.Regex.Match(value, regularExpression).Success) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ValidationWarning, Message = $"'{parameterName}' does not validate against pattern /{regularExpression}/", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertEnum(this IEventListener instance, string parameterName, string value, params string[] values) + { + if (!values.Any(each => each.Equals(value))) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ValidationWarning, Message = $"'{parameterName}' is not one of ({values.Aggregate((c, e) => $"'{e}',{c}")}", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertObjectIsValid(this IEventListener instance, string parameterName, object inst) + { + await (inst as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IValidates)?.Validate(instance); + } + + public static async Task AssertIsLessThan(this IEventListener instance, string parameterName, T? value, T max) where T : struct, System.IComparable + { + if (null != value && ((T)value).CompareTo(max) >= 0) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ValidationWarning, Message = $"Value of '{parameterName}' must be less than {max} (value is {value})", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertIsGreaterThan(this IEventListener instance, string parameterName, T? value, T max) where T : struct, System.IComparable + { + if (null != value && ((T)value).CompareTo(max) <= 0) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ValidationWarning, Message = $"Value of '{parameterName}' must be greater than {max} (value is {value})", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertIsLessThanOrEqual(this IEventListener instance, string parameterName, T? value, T max) where T : struct, System.IComparable + { + if (null != value && ((T)value).CompareTo(max) > 0) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ValidationWarning, Message = $"Value of '{parameterName}' must be less than or equal to {max} (value is {value})", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertIsGreaterThanOrEqual(this IEventListener instance, string parameterName, T? value, T max) where T : struct, System.IComparable + { + if (null != value && ((T)value).CompareTo(max) < 0) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ValidationWarning, Message = $"Value of '{parameterName}' must be greater than or equal to {max} (value is {value})", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertIsMultipleOf(this IEventListener instance, string parameterName, Int64? value, Int64 multiple) + { + if (null != value && value % multiple != 0) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ValidationWarning, Message = $"Value of '{parameterName}' must be multiple of {multiple} (value is {value})", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertIsMultipleOf(this IEventListener instance, string parameterName, double? value, double multiple) + { + if (null != value) + { + var i = (Int64)(value / multiple); + if (i != value / multiple) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ValidationWarning, Message = $"Value of '{parameterName}' must be multiple of {multiple} (value is {value})", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + } + public static async Task AssertIsMultipleOf(this IEventListener instance, string parameterName, decimal? value, decimal multiple) + { + if (null != value) + { + var i = (Int64)(value / multiple); + if (i != value / multiple) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Events.ValidationWarning, Message = $"Value of '{parameterName}' must be multiple of {multiple} (value is {value})", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + } + } + + /// + /// An Implementation of the IEventListener that supports subscribing to events and dispatching them + /// (used for manually using the lowlevel interface) + /// + public class EventListener : CancellationTokenSource, IEnumerable>, IEventListener + { + private Dictionary calls = new Dictionary(); + public IEnumerator> GetEnumerator() => calls.GetEnumerator(); + IEnumerator IEnumerable.GetEnumerator() => calls.GetEnumerator(); + public EventListener() + { + } + + public new Action Cancel => base.Cancel; + private Event tracer; + + public EventListener(params (string name, Event callback)[] initializer) + { + foreach (var each in initializer) + { + Add(each.name, each.callback); + } + } + + public void Add(string name, SynchEvent callback) + { + Add(name, (message) => { callback(message); return Task.CompletedTask; }); + } + + public void Add(string name, Event callback) + { + if (callback != null) + { + if (string.IsNullOrEmpty(name)) + { + if (calls.ContainsKey(name)) + { + tracer += callback; + } + else + { + tracer = callback; + } + } + else + { + if (calls.ContainsKey(name)) + { + calls[name ?? System.String.Empty] += callback; + } + else + { + calls[name ?? System.String.Empty] = callback; + } + } + } + } + + + public async Task Signal(string id, CancellationToken token, GetEventData createMessage) + { + using (NoSynchronizationContext) + { + if (!string.IsNullOrEmpty(id) && (calls.TryGetValue(id, out Event listener) || tracer != null)) + { + var message = createMessage(); + message.Id = id; + + await listener?.Invoke(message); + await tracer?.Invoke(message); + + if (token.IsCancellationRequested) + { + throw new OperationCanceledException($"Canceled by event {id} ", this.Token); + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Events.cs b/src/Security/Security.Autorest/generated/runtime/Events.cs new file mode 100644 index 000000000000..684da11a8039 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Events.cs @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime +{ + public static partial class Events + { + public const string Log = nameof(Log); + public const string Validation = nameof(Validation); + public const string ValidationWarning = nameof(ValidationWarning); + public const string AfterValidation = nameof(AfterValidation); + public const string RequestCreated = nameof(RequestCreated); + public const string ResponseCreated = nameof(ResponseCreated); + public const string URLCreated = nameof(URLCreated); + public const string Finally = nameof(Finally); + public const string HeaderParametersAdded = nameof(HeaderParametersAdded); + public const string BodyContentSet = nameof(BodyContentSet); + public const string BeforeCall = nameof(BeforeCall); + public const string BeforeResponseDispatch = nameof(BeforeResponseDispatch); + public const string FollowingNextLink = nameof(FollowingNextLink); + public const string DelayBeforePolling = nameof(DelayBeforePolling); + public const string Polling = nameof(Polling); + public const string Progress = nameof(Progress); + } +} diff --git a/src/Security/Security.Autorest/generated/runtime/EventsExtensions.cs b/src/Security/Security.Autorest/generated/runtime/EventsExtensions.cs new file mode 100644 index 000000000000..2bbac0b5bb0c --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/EventsExtensions.cs @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime +{ + public static partial class Events + { + public const string CmdletProcessRecordStart = nameof(CmdletProcessRecordStart); + public const string CmdletProcessRecordAsyncStart = nameof(CmdletProcessRecordAsyncStart); + public const string CmdletException = nameof(CmdletException); + public const string CmdletGetPipeline = nameof(CmdletGetPipeline); + public const string CmdletBeforeAPICall = nameof(CmdletBeforeAPICall); + public const string CmdletBeginProcessing = nameof(CmdletBeginProcessing); + public const string CmdletEndProcessing = nameof(CmdletEndProcessing); + public const string CmdletProcessRecordEnd = nameof(CmdletProcessRecordEnd); + public const string CmdletProcessRecordAsyncEnd = nameof(CmdletProcessRecordAsyncEnd); + public const string CmdletAfterAPICall = nameof(CmdletAfterAPICall); + + public const string Verbose = nameof(Verbose); + public const string Debug = nameof(Debug); + public const string Information = nameof(Information); + public const string Error = nameof(Error); + public const string Warning = nameof(Warning); + } + +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Extensions.cs b/src/Security/Security.Autorest/generated/runtime/Extensions.cs new file mode 100644 index 000000000000..34806519242b --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Extensions.cs @@ -0,0 +1,117 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime +{ + using System.Linq; + using System; + + internal static partial class Extensions + { + public static T[] SubArray(this T[] array, int offset, int length) + { + return new ArraySegment(array, offset, length) + .ToArray(); + } + + public static T ReadHeaders(this T instance, global::System.Net.Http.Headers.HttpResponseHeaders headers) where T : class + { + (instance as IHeaderSerializable)?.ReadHeaders(headers); + return instance; + } + + internal static bool If(T input, out T output) + { + if (null == input) + { + output = default(T); + return false; + } + output = input; + return true; + } + + internal static void AddIf(T value, System.Action addMethod) + { + // if value is present (and it's not just an empty JSON Object) + if (null != value && (value as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject)?.Keys.Count != 0) + { + addMethod(value); + } + } + + internal static void AddIf(T value, string serializedName, System.Action addMethod) + { + // if value is present (and it's not just an empty JSON Object) + if (null != value && (value as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject)?.Keys.Count != 0) + { + addMethod(serializedName, value); + } + } + + /// + /// Returns the first header value as a string from an HttpReponseMessage. + /// + /// the HttpResponseMessage to fetch a header from + /// the header name + /// the first header value as a string from an HttpReponseMessage. string.empty if there is no header value matching + internal static string GetFirstHeader(this System.Net.Http.HttpResponseMessage response, string headerName) => response.Headers.FirstOrDefault(each => string.Equals(headerName, each.Key, System.StringComparison.OrdinalIgnoreCase)).Value?.FirstOrDefault() ?? string.Empty; + + /// + /// Sets the Synchronization Context to null, and returns an IDisposable that when disposed, + /// will restore the synchonization context to the original value. + /// + /// This is used a less-invasive means to ensure that code in the library that doesn't + /// need to be continued in the original context doesn't have to have ConfigureAwait(false) + /// on every single await + /// + /// If the SynchronizationContext is null when this is used, the resulting IDisposable + /// will not do anything (this prevents excessive re-setting of the SynchronizationContext) + /// + /// Usage: + /// + /// using(NoSynchronizationContext) { + /// await SomeAsyncOperation(); + /// await SomeOtherOperation(); + /// } + /// + /// + /// + /// An IDisposable that will return the SynchronizationContext to original state + internal static System.IDisposable NoSynchronizationContext => System.Threading.SynchronizationContext.Current == null ? Dummy : new NoSyncContext(); + + /// + /// An instance of the Dummy IDispoable. + /// + /// + internal static System.IDisposable Dummy = new DummyDisposable(); + + /// + /// An IDisposable that does absolutely nothing. + /// + internal class DummyDisposable : System.IDisposable + { + public void Dispose() + { + } + } + /// + /// An IDisposable that saves the SynchronizationContext,sets it to null and + /// restores it to the original upon Dispose(). + /// + /// NOTE: This is designed to be less invasive than using .ConfigureAwait(false) + /// on every single await in library code (ie, places where we know we don't need + /// to continue in the same context as we went async) + /// + internal class NoSyncContext : System.IDisposable + { + private System.Threading.SynchronizationContext original = System.Threading.SynchronizationContext.Current; + internal NoSyncContext() + { + System.Threading.SynchronizationContext.SetSynchronizationContext(null); + } + public void Dispose() => System.Threading.SynchronizationContext.SetSynchronizationContext(original); + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Helpers/Extensions/StringBuilderExtensions.cs b/src/Security/Security.Autorest/generated/runtime/Helpers/Extensions/StringBuilderExtensions.cs new file mode 100644 index 000000000000..32ae55f1a9ba --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Helpers/Extensions/StringBuilderExtensions.cs @@ -0,0 +1,23 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.Text; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json +{ + internal static class StringBuilderExtensions + { + /// + /// Extracts the buffered value and resets the buffer + /// + internal static string Extract(this StringBuilder builder) + { + var text = builder.ToString(); + + builder.Clear(); + + return text; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Helpers/Extensions/TypeExtensions.cs b/src/Security/Security.Autorest/generated/runtime/Helpers/Extensions/TypeExtensions.cs new file mode 100644 index 000000000000..5178be8f2942 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Helpers/Extensions/TypeExtensions.cs @@ -0,0 +1,61 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json +{ + internal static class TypeExtensions + { + internal static bool IsNullable(this Type type) => + type.IsGenericType && type.GetGenericTypeDefinition().Equals(typeof(Nullable<>)); + + internal static Type GetOpenGenericInterface(this Type candidateType, Type openGenericInterfaceType) + { + + if (candidateType.IsGenericType && candidateType.GetGenericTypeDefinition() == openGenericInterfaceType) + { + return candidateType; + } + + // Check if it references it's own converter.... + + foreach (Type interfaceType in candidateType.GetInterfaces()) + { + if (interfaceType.IsGenericType + && interfaceType.GetGenericTypeDefinition().Equals(openGenericInterfaceType)) + { + return interfaceType; + } + } + + return null; + } + + // Author: Sebastian Good + // http://stackoverflow.com/questions/503263/how-to-determine-if-a-type-implements-a-specific-generic-interface-type + internal static bool ImplementsOpenGenericInterface(this Type candidateType, Type openGenericInterfaceType) + { + if (candidateType.Equals(openGenericInterfaceType)) + { + return true; + } + + if (candidateType.IsGenericType && candidateType.GetGenericTypeDefinition().Equals(openGenericInterfaceType)) + { + return true; + } + + foreach (Type i in candidateType.GetInterfaces()) + { + if (i.IsGenericType && i.ImplementsOpenGenericInterface(openGenericInterfaceType)) + { + return true; + } + } + + return false; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Helpers/Seperator.cs b/src/Security/Security.Autorest/generated/runtime/Helpers/Seperator.cs new file mode 100644 index 000000000000..072c1176fb90 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Helpers/Seperator.cs @@ -0,0 +1,11 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json +{ + internal static class Seperator + { + internal static readonly char[] Dash = { '-' }; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Helpers/TypeDetails.cs b/src/Security/Security.Autorest/generated/runtime/Helpers/TypeDetails.cs new file mode 100644 index 000000000000..5cf0b2439c25 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Helpers/TypeDetails.cs @@ -0,0 +1,116 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.Reflection; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json +{ + + + + internal class TypeDetails + { + private readonly Type info; + + internal TypeDetails(Type info) + { + this.info = info ?? throw new ArgumentNullException(nameof(info)); + } + + internal Type NonNullType { get; set; } + + internal object DefaultValue { get; set; } + + internal bool IsNullable { get; set; } + + internal bool IsList { get; set; } + + internal bool IsStringLike { get; set; } + + internal bool IsEnum => info.IsEnum; + + internal bool IsArray => info.IsArray; + + internal bool IsValueType => info.IsValueType; + + internal Type ElementType { get; set; } + + internal IJsonConverter JsonConverter { get; set; } + + #region Creation + + private static readonly ConcurrentDictionary cache = new ConcurrentDictionary(); + + internal static TypeDetails Get() => Get(typeof(T)); + + internal static TypeDetails Get(Type type) => cache.GetOrAdd(type, Create); + + private static TypeDetails Create(Type type) + { + var isGenericList = !type.IsPrimitive && type.ImplementsOpenGenericInterface(typeof(IList<>)); + var isList = !type.IsPrimitive && (isGenericList || typeof(IList).IsAssignableFrom(type)); + + var isNullable = type.IsNullable(); + + Type elementType; + + if (type.IsArray) + { + elementType = type.GetElementType(); + } + else if (isGenericList) + { + var iList = type.GetOpenGenericInterface(typeof(IList<>)); + + elementType = iList.GetGenericArguments()[0]; + } + else + { + elementType = null; + } + + var nonNullType = isNullable ? type.GetGenericArguments()[0] : type; + + var isStringLike = false; + + IJsonConverter converter; + + var jsonConverterAttribute = type.GetCustomAttribute(); + + if (jsonConverterAttribute != null) + { + converter = jsonConverterAttribute.Converter; + } + else if (nonNullType.IsEnum) + { + converter = new EnumConverter(nonNullType); + } + else if (JsonConverterFactory.Instances.TryGetValue(nonNullType, out converter)) + { + } + else if (StringLikeHelper.IsStringLike(nonNullType)) + { + isStringLike = true; + + converter = new StringLikeConverter(nonNullType); + } + + return new TypeDetails(nonNullType) { + NonNullType = nonNullType, + DefaultValue = type.IsValueType ? Activator.CreateInstance(type) : null, + IsNullable = isNullable, + IsList = isList, + IsStringLike = isStringLike, + ElementType = elementType, + JsonConverter = converter + }; + } + + #endregion + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Helpers/XHelper.cs b/src/Security/Security.Autorest/generated/runtime/Helpers/XHelper.cs new file mode 100644 index 000000000000..b5bb773d192f --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Helpers/XHelper.cs @@ -0,0 +1,75 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json +{ + internal static class XHelper + { + internal static JsonNode Create(JsonType type, TypeCode code, object value) + { + switch (type) + { + case JsonType.Binary : return new XBinary((byte[])value); + case JsonType.Boolean : return new JsonBoolean((bool)value); + case JsonType.Number : return new JsonNumber(value.ToString()); + case JsonType.String : return new JsonString((string)value); + } + + throw new Exception($"JsonType '{type}' does not have a fast conversion"); + } + + internal static bool TryGetElementType(TypeCode code, out JsonType type) + { + switch (code) + { + case TypeCode.Boolean : type = JsonType.Boolean; return true; + case TypeCode.Byte : type = JsonType.Number; return true; + case TypeCode.DateTime : type = JsonType.Date; return true; + case TypeCode.Decimal : type = JsonType.Number; return true; + case TypeCode.Double : type = JsonType.Number; return true; + case TypeCode.Empty : type = JsonType.Null; return true; + case TypeCode.Int16 : type = JsonType.Number; return true; + case TypeCode.Int32 : type = JsonType.Number; return true; + case TypeCode.Int64 : type = JsonType.Number; return true; + case TypeCode.SByte : type = JsonType.Number; return true; + case TypeCode.Single : type = JsonType.Number; return true; + case TypeCode.String : type = JsonType.String; return true; + case TypeCode.UInt16 : type = JsonType.Number; return true; + case TypeCode.UInt32 : type = JsonType.Number; return true; + case TypeCode.UInt64 : type = JsonType.Number; return true; + } + + type = default; + + return false; + } + + internal static JsonType GetElementType(TypeCode code) + { + switch (code) + { + case TypeCode.Boolean : return JsonType.Boolean; + case TypeCode.Byte : return JsonType.Number; + case TypeCode.DateTime : return JsonType.Date; + case TypeCode.Decimal : return JsonType.Number; + case TypeCode.Double : return JsonType.Number; + case TypeCode.Empty : return JsonType.Null; + case TypeCode.Int16 : return JsonType.Number; + case TypeCode.Int32 : return JsonType.Number; + case TypeCode.Int64 : return JsonType.Number; + case TypeCode.SByte : return JsonType.Number; + case TypeCode.Single : return JsonType.Number; + case TypeCode.String : return JsonType.String; + case TypeCode.UInt16 : return JsonType.Number; + case TypeCode.UInt32 : return JsonType.Number; + case TypeCode.UInt64 : return JsonType.Number; + default : return JsonType.Object; + } + + throw new Exception($"TypeCode '{code}' does not have a fast converter"); + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/HttpPipeline.cs b/src/Security/Security.Autorest/generated/runtime/HttpPipeline.cs new file mode 100644 index 000000000000..6a50d49d7354 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/HttpPipeline.cs @@ -0,0 +1,88 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime +{ + using System.Net.Http; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + using System.Collections; + using System.Linq; + + using GetEventData = System.Func; + using NextDelegate = System.Func, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>; + + using SignalDelegate = System.Func, System.Threading.Tasks.Task>; + using GetParameterDelegate = System.Func, string, object>; + using SendAsyncStepDelegate = System.Func, System.Threading.Tasks.Task>, System.Func, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>; + using PipelineChangeDelegate = System.Action, System.Threading.Tasks.Task>, System.Func, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>>; + using ModuleLoadPipelineDelegate = System.Action, System.Threading.Tasks.Task>, System.Func, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>>, System.Action, System.Threading.Tasks.Task>, System.Func, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>>>; + using NewRequestPipelineDelegate = System.Action, System.Action, System.Threading.Tasks.Task>, System.Func, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>>, System.Action, System.Threading.Tasks.Task>, System.Func, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>>>; + +/* + public class DelegateBasedEventListener : IEventListener + { + private EventListenerDelegate _listener; + public DelegateBasedEventListener(EventListenerDelegate listener) + { + _listener = listener; + } + public CancellationToken Token => CancellationToken.None; + public System.Action Cancel => () => { }; + + + public Task Signal(string id, CancellationToken token, GetEventData createMessage) + { + return _listener(id, token, () => createMessage()); + } + } +*/ + /// + /// This is a necessary extension to the SendAsyncFactory to support the 'generic' delegate format. + /// + public partial class SendAsyncFactory + { + /// + /// This translates a generic-defined delegate for a listener into one that fits our ISendAsync pattern. + /// (Provided to support out-of-module delegation for Azure Cmdlets) + /// + /// The Pipeline Step as a delegate + public SendAsyncFactory(SendAsyncStepDelegate step) => this.implementation = (request, listener, next) => + step( + request, + listener.Token, + listener.Cancel, + (id, token, getEventData) => listener.Signal(id, token, () => { + var data = EventDataConverter.ConvertFrom( getEventData() ) as EventData; + data.Id = id; + data.Cancel = listener.Cancel; + data.RequestMessage = request; + return data; + }), + (req, token, cancel, listenerDelegate) => next.SendAsync(req, listener)); + } + + public partial class HttpPipeline : ISendAsync + { + public HttpPipeline Append(SendAsyncStepDelegate item) + { + if (item != null) + { + Append(new SendAsyncFactory(item)); + } + return this; + } + + public HttpPipeline Prepend(SendAsyncStepDelegate item) + { + if (item != null) + { + Prepend(new SendAsyncFactory(item)); + } + return this; + } + } +} diff --git a/src/Security/Security.Autorest/generated/runtime/HttpPipelineMocking.ps1 b/src/Security/Security.Autorest/generated/runtime/HttpPipelineMocking.ps1 new file mode 100644 index 000000000000..cee95adf3c92 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/HttpPipelineMocking.ps1 @@ -0,0 +1,110 @@ +$ErrorActionPreference = "Stop" + +# get the recording path +if (-not $TestRecordingFile) { + $TestRecordingFile = Join-Path $PSScriptRoot 'recording.json' +} + +# create the Http Pipeline Recorder +$Mock = New-Object -Type Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PipelineMock $TestRecordingFile + +# set the recorder to the appropriate mode (default to 'live') +Write-Host -ForegroundColor Green "Running '$TestMode' mode..." +switch ($TestMode) { + 'record' { + Write-Host -ForegroundColor Green "Recording to $TestRecordingFile" + $Mock.SetRecord() + $null = erase -ea 0 $TestRecordingFile + } + 'playback' { + if (-not (Test-Path $TestRecordingFile)) { + Write-Host -fore:yellow "Recording file '$TestRecordingFile' is not present. Tests expecting recorded responses will fail" + } else { + Write-Host -ForegroundColor Green "Using recording $TestRecordingFile" + } + $Mock.SetPlayback() + $Mock.ForceResponseHeaders["Retry-After"] = "0"; + } + default: { + $Mock.SetLive() + } +} + +# overrides for Pester Describe/Context/It + +function Describe( + [Parameter(Mandatory = $true, Position = 0)] + [string] $Name, + + [Alias('Tags')] + [string[]] $Tag = @(), + + [Parameter(Position = 1)] + [ValidateNotNull()] + [ScriptBlock] $Fixture = $(Throw "No test script block is provided. (Have you put the open curly brace on the next line?)") +) { + $Mock.PushDescription($Name) + try { + return pester\Describe -Name $Name -Tag $Tag -Fixture $fixture + } + finally { + $Mock.PopDescription() + } +} + +function Context( + [Parameter(Mandatory = $true, Position = 0)] + [string] $Name, + + [Alias('Tags')] + [string[]] $Tag = @(), + + [Parameter(Position = 1)] + [ValidateNotNull()] + [ScriptBlock] $Fixture = $(Throw "No test script block is provided. (Have you put the open curly brace on the next line?)") +) { + $Mock.PushContext($Name) + try { + return pester\Context -Name $Name -Tag $Tag -Fixture $fixture + } + finally { + $Mock.PopContext() + } +} + +function It { + [CmdletBinding(DefaultParameterSetName = 'Normal')] + param( + [Parameter(Mandatory = $true, Position = 0)] + [string]$Name, + + [Parameter(Position = 1)] + [ScriptBlock] $Test = { }, + + [System.Collections.IDictionary[]] $TestCases, + + [Parameter(ParameterSetName = 'Pending')] + [Switch] $Pending, + + [Parameter(ParameterSetName = 'Skip')] + [Alias('Ignore')] + [Switch] $Skip + ) + $Mock.PushScenario($Name) + + try { + if ($skip) { + return pester\It -Name $Name -Test $Test -TestCases $TestCases -Skip + } + if ($pending) { + return pester\It -Name $Name -Test $Test -TestCases $TestCases -Pending + } + return pester\It -Name $Name -Test $Test -TestCases $TestCases + } + finally { + $null = $Mock.PopScenario() + } +} + +# set the HttpPipelineAppend for all the cmdlets +$PSDefaultParameterValues["*:HttpPipelinePrepend"] = $Mock diff --git a/src/Security/Security.Autorest/generated/runtime/IAssociativeArray.cs b/src/Security/Security.Autorest/generated/runtime/IAssociativeArray.cs new file mode 100644 index 000000000000..14b31d8d46b3 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/IAssociativeArray.cs @@ -0,0 +1,24 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +#define DICT_PROPERTIES +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime +{ + /// A subset of IDictionary that doesn't implement IEnumerable or IDictionary to work around PowerShell's aggressive formatter + public interface IAssociativeArray + { +#if DICT_PROPERTIES + System.Collections.Generic.IEnumerable Keys { get; } + System.Collections.Generic.IEnumerable Values { get; } + int Count { get; } +#endif + System.Collections.Generic.IDictionary AdditionalProperties { get; } + T this[string index] { get; set; } + void Add(string key, T value); + bool ContainsKey(string key); + bool Remove(string key); + bool TryGetValue(string key, out T value); + void Clear(); + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/IHeaderSerializable.cs b/src/Security/Security.Autorest/generated/runtime/IHeaderSerializable.cs new file mode 100644 index 000000000000..94aebe436979 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/IHeaderSerializable.cs @@ -0,0 +1,14 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime +{ + public interface IHeaderSerializable + { + void ReadHeaders(global::System.Net.Http.Headers.HttpResponseHeaders headers); + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/ISendAsync.cs b/src/Security/Security.Autorest/generated/runtime/ISendAsync.cs new file mode 100644 index 000000000000..dfb54d040092 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/ISendAsync.cs @@ -0,0 +1,413 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime +{ + using System.Net.Http; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + using System.Collections; + using System.Linq; + using System; + + + /// + /// The interface for sending an HTTP request across the wire. + /// + public interface ISendAsync + { + Task SendAsync(HttpRequestMessage request, IEventListener callback); + } + + public class SendAsyncTerminalFactory : ISendAsyncTerminalFactory, ISendAsync + { + SendAsync implementation; + + public SendAsyncTerminalFactory(SendAsync implementation) => this.implementation = implementation; + public SendAsyncTerminalFactory(ISendAsync implementation) => this.implementation = implementation.SendAsync; + public ISendAsync Create() => this; + public Task SendAsync(HttpRequestMessage request, IEventListener callback) => implementation(request, callback); + } + + public partial class SendAsyncFactory : ISendAsyncFactory + { + public class Sender : ISendAsync + { + internal ISendAsync next; + internal SendAsyncStep implementation; + + public Task SendAsync(HttpRequestMessage request, IEventListener callback) => implementation(request, callback, next); + } + SendAsyncStep implementation; + + public SendAsyncFactory(SendAsyncStep implementation) => this.implementation = implementation; + public ISendAsync Create(ISendAsync next) => new Sender { next = next, implementation = implementation }; + + } + + public class HttpClientFactory : ISendAsyncTerminalFactory, ISendAsync + { + HttpClient client; + public HttpClientFactory() : this(new HttpClient()) + { + } + public HttpClientFactory(HttpClient client) => this.client = client; + public ISendAsync Create() => this; + + public Task SendAsync(HttpRequestMessage request, IEventListener callback) => client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead, callback.Token); + } + + public interface ISendAsyncFactory + { + ISendAsync Create(ISendAsync next); + } + + public interface ISendAsyncTerminalFactory + { + ISendAsync Create(); + } + + public partial class HttpPipeline : ISendAsync + { + private const int DefaultMaxRetry = 3; + private ISendAsync pipeline; + private ISendAsyncTerminalFactory terminal; + private List steps = new List(); + + public HttpPipeline() : this(new HttpClientFactory()) + { + } + + public HttpPipeline(ISendAsyncTerminalFactory terminalStep) + { + if (terminalStep == null) + { + throw new System.ArgumentNullException(nameof(terminalStep), "Terminal Step Factory in HttpPipeline may not be null"); + } + TerminalFactory = terminalStep; + } + + /// + /// Returns an HttpPipeline with the current state of this pipeline. + /// + public HttpPipeline Clone() => new HttpPipeline(terminal) { steps = this.steps.ToList(), pipeline = this.pipeline }; + + private bool shouldRetry429(HttpResponseMessage response) + { + if (response.StatusCode == (System.Net.HttpStatusCode)429) + { + var retryAfter = response.Headers.RetryAfter; + if (retryAfter != null && retryAfter.Delta.HasValue) + { + return true; + } + } + return false; + } + /// + /// The step to handle 429 response with retry-after header. + /// + public async Task Retry429(HttpRequestMessage request, IEventListener callback, ISendAsync next) + { + int retryCount = int.MaxValue; + + try + { + try + { + retryCount = int.Parse(System.Environment.GetEnvironmentVariable("PS_HTTP_MAX_RETRIES_FOR_429")); + } + finally + { + retryCount = int.Parse(System.Environment.GetEnvironmentVariable("AZURE_PS_HTTP_MAX_RETRIES_FOR_429")); + } + } + catch (System.Exception) + { + //no action + } + var cloneRequest = await request.CloneWithContent(); + var response = await next.SendAsync(request, callback); + int count = 0; + while (shouldRetry429(response) && count++ < retryCount) + { + request = await cloneRequest.CloneWithContent(); + var retryAfter = response.Headers.RetryAfter; + await Task.Delay(retryAfter.Delta.Value, callback.Token); + await callback.Signal("Debug", $"Start to retry {count} time(s) on status code 429 after waiting {retryAfter.Delta.Value.TotalSeconds} seconds."); + response = await next.SendAsync(request, callback); + } + return response; + } + + private bool shouldRetryError(HttpResponseMessage response) + { + if (response.StatusCode >= System.Net.HttpStatusCode.InternalServerError) + { + if (response.StatusCode != System.Net.HttpStatusCode.NotImplemented && + response.StatusCode != System.Net.HttpStatusCode.HttpVersionNotSupported) + { + return true; + } + } + else if (response.StatusCode == System.Net.HttpStatusCode.RequestTimeout) + { + return true; + } + else if (response.StatusCode == (System.Net.HttpStatusCode)429 && response.Headers.RetryAfter == null) + { + return true; + } + return false; + } + + /// + /// Returns true if status code in HttpRequestExceptionWithStatus exception is greater + /// than or equal to 500 and not NotImplemented (501) or HttpVersionNotSupported (505). + /// Or it's 429 (TOO MANY REQUESTS) without Retry-After header. + /// + public async Task RetryError(HttpRequestMessage request, IEventListener callback, ISendAsync next) + { + int retryCount = DefaultMaxRetry; + + try + { + try + { + retryCount = int.Parse(System.Environment.GetEnvironmentVariable("PS_HTTP_MAX_RETRIES")); + } + finally + { + retryCount = int.Parse(System.Environment.GetEnvironmentVariable("AZURE_PS_HTTP_MAX_RETRIES")); + } + } + catch (System.Exception) + { + //no action + } + var cloneRequest = await request.CloneWithContent(); + var response = await next.SendAsync(request, callback); + int count = 0; + while (shouldRetryError(response) && count++ < retryCount) + { + await callback.Signal("Debug", $"Start to retry {count} time(s) on status code {response.StatusCode}"); + request = await cloneRequest.CloneWithContent(); + response = await next.SendAsync(request, callback); + } + return response; + } + + public ISendAsyncTerminalFactory TerminalFactory + { + get => terminal; + set + { + if (value == null) + { + throw new System.ArgumentNullException("TerminalFactory in HttpPipeline may not be null"); + } + terminal = value; + } + } + + public ISendAsync Pipeline + { + get + { + // if the pipeline has been created and not invalidated, return it. + if (this.pipeline != null) + { + return this.pipeline; + } + + // create the pipeline from scratch. + var next = terminal.Create(); + if (Convert.ToBoolean(@"true")) + { + next = (new SendAsyncFactory(Retry429)).Create(next) ?? next; + next = (new SendAsyncFactory(RetryError)).Create(next) ?? next; + } + foreach (var factory in steps) + { + // skip factories that return null. + next = factory.Create(next) ?? next; + } + return this.pipeline = next; + } + } + + public int Count => steps.Count; + + public HttpPipeline Prepend(ISendAsyncFactory item) + { + if (item != null) + { + steps.Add(item); + pipeline = null; + } + return this; + } + + public HttpPipeline Append(SendAsyncStep item) + { + if (item != null) + { + Append(new SendAsyncFactory(item)); + } + return this; + } + + public HttpPipeline Prepend(SendAsyncStep item) + { + if (item != null) + { + Prepend(new SendAsyncFactory(item)); + } + return this; + } + public HttpPipeline Append(IEnumerable items) + { + if (items != null) + { + foreach (var item in items) + { + Append(new SendAsyncFactory(item)); + } + } + return this; + } + + public HttpPipeline Prepend(IEnumerable items) + { + if (items != null) + { + foreach (var item in items) + { + Prepend(new SendAsyncFactory(item)); + } + } + return this; + } + + public HttpPipeline Append(ISendAsyncFactory item) + { + if (item != null) + { + steps.Insert(0, item); + pipeline = null; + } + return this; + } + public HttpPipeline Prepend(IEnumerable items) + { + if (items != null) + { + foreach (var item in items) + { + Prepend(item); + } + } + return this; + } + + public HttpPipeline Append(IEnumerable items) + { + if (items != null) + { + foreach (var item in items) + { + Append(item); + } + } + return this; + } + + // you can use this as the ISendAsync Implementation + public Task SendAsync(HttpRequestMessage request, IEventListener callback) => Pipeline.SendAsync(request, callback); + } + + internal static partial class Extensions + { + internal static HttpRequestMessage CloneAndDispose(this HttpRequestMessage original, System.Uri requestUri = null, System.Net.Http.HttpMethod method = null) + { + using (original) + { + return original.Clone(requestUri, method); + } + } + + internal static Task CloneWithContentAndDispose(this HttpRequestMessage original, System.Uri requestUri = null, System.Net.Http.HttpMethod method = null) + { + using (original) + { + return original.CloneWithContent(requestUri, method); + } + } + + /// + /// Clones an HttpRequestMessage (without the content) + /// + /// Original HttpRequestMessage (Will be diposed before returning) + /// + /// + /// A clone of the HttpRequestMessage + internal static HttpRequestMessage Clone(this HttpRequestMessage original, System.Uri requestUri = null, System.Net.Http.HttpMethod method = null) + { + var clone = new HttpRequestMessage + { + Method = method ?? original.Method, + RequestUri = requestUri ?? original.RequestUri, + Version = original.Version, + }; + + foreach (KeyValuePair prop in original.Properties) + { + clone.Properties.Add(prop); + } + + foreach (KeyValuePair> header in original.Headers) + { + /* + **temporarily skip cloning telemetry related headers** + clone.Headers.TryAddWithoutValidation(header.Key, header.Value); + */ + if (!"x-ms-unique-id".Equals(header.Key) && !"x-ms-client-request-id".Equals(header.Key) && !"CommandName".Equals(header.Key) && !"FullCommandName".Equals(header.Key) && !"ParameterSetName".Equals(header.Key) && !"User-Agent".Equals(header.Key)) + { + clone.Headers.TryAddWithoutValidation(header.Key, header.Value); + } + } + + return clone; + } + + /// + /// Clones an HttpRequestMessage (including the content stream and content headers) + /// + /// Original HttpRequestMessage (Will be diposed before returning) + /// + /// + /// A clone of the HttpRequestMessage + internal static async Task CloneWithContent(this HttpRequestMessage original, System.Uri requestUri = null, System.Net.Http.HttpMethod method = null) + { + var clone = original.Clone(requestUri, method); + var stream = new System.IO.MemoryStream(); + if (original.Content != null) + { + await original.Content.CopyToAsync(stream).ConfigureAwait(false); + stream.Position = 0; + clone.Content = new StreamContent(stream); + if (original.Content.Headers != null) + { + foreach (var h in original.Content.Headers) + { + clone.Content.Headers.Add(h.Key, h.Value); + } + } + } + return clone; + } + } +} diff --git a/src/Security/Security.Autorest/generated/runtime/InfoAttribute.cs b/src/Security/Security.Autorest/generated/runtime/InfoAttribute.cs new file mode 100644 index 000000000000..b3336547d4e2 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/InfoAttribute.cs @@ -0,0 +1,38 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime +{ + using System; + + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Class)] + public class InfoAttribute : Attribute + { + public bool Required { get; set; } = false; + public bool ReadOnly { get; set; } = false; + public bool Read { get; set; } = true; + public bool Create { get; set; } = true; + public bool Update { get; set; } = true; + public Type[] PossibleTypes { get; set; } = new Type[0]; + public string Description { get; set; } = ""; + public string SerializedName { get; set; } = ""; + } + + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)] + public class CompleterInfoAttribute : Attribute + { + public string Script { get; set; } = ""; + public string Name { get; set; } = ""; + public string Description { get; set; } = ""; + } + + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)] + public class DefaultInfoAttribute : Attribute + { + public string Script { get; set; } = ""; + public string Name { get; set; } = ""; + public string Description { get; set; } = ""; + public string SetCondition { get; set; } = ""; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/InputHandler.cs b/src/Security/Security.Autorest/generated/runtime/InputHandler.cs new file mode 100644 index 000000000000..d15ff7e54eb5 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/InputHandler.cs @@ -0,0 +1,22 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +using System; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Cmdlets +{ + public abstract class InputHandler + { + protected InputHandler NextHandler = null; + + public void SetNextHandler(InputHandler nextHandler) + { + this.NextHandler = nextHandler; + } + + public abstract void Process(Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.IContext context); + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Iso/IsoDate.cs b/src/Security/Security.Autorest/generated/runtime/Iso/IsoDate.cs new file mode 100644 index 000000000000..c51f975b729f --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Iso/IsoDate.cs @@ -0,0 +1,214 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Text; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json +{ + internal struct IsoDate + { + internal int Year { get; set; } // 0-3000 + + internal int Month { get; set; } // 1-12 + + internal int Day { get; set; } // 1-31 + + internal int Hour { get; set; } // 0-24 + + internal int Minute { get; set; } // 0-60 (60 is a special case) + + internal int Second { get; set; } // 0-60 (60 is used for leap seconds) + + internal double Millisecond { get; set; } // 0-999.9... + + internal TimeSpan Offset { get; set; } + + internal DateTimeKind Kind { get; set; } + + internal TimeSpan TimeOfDay => new TimeSpan(Hour, Minute, Second); + + internal DateTime ToDateTime() + { + if (Kind == DateTimeKind.Utc || Offset == TimeSpan.Zero) + { + return new DateTime(Year, Month, Day, Hour, Minute, Second, (int)Millisecond, DateTimeKind.Utc); + } + + return ToDateTimeOffset().DateTime; + } + + internal DateTimeOffset ToDateTimeOffset() + { + return new DateTimeOffset( + Year, + Month, + Day, + Hour, + Minute, + Second, + (int)Millisecond, + Offset + ); + } + + internal DateTime ToUtcDateTime() + { + return ToDateTimeOffset().UtcDateTime; + } + + public override string ToString() + { + var sb = new StringBuilder(); + + // yyyy-MM-dd + sb.Append($"{Year}-{Month:00}-{Day:00}"); + + if (TimeOfDay > new TimeSpan(0)) + { + sb.Append($"T{Hour:00}:{Minute:00}"); + + if (TimeOfDay.Seconds > 0) + { + sb.Append($":{Second:00}"); + } + } + + if (Offset.Ticks == 0) + { + sb.Append('Z'); // UTC + } + else + { + if (Offset.Ticks >= 0) + { + sb.Append('+'); + } + + sb.Append($"{Offset.Hours:00}:{Offset.Minutes:00}"); + } + + return sb.ToString(); + } + + internal static IsoDate FromDateTimeOffset(DateTimeOffset date) + { + return new IsoDate { + Year = date.Year, + Month = date.Month, + Day = date.Day, + Hour = date.Hour, + Minute = date.Minute, + Second = date.Second, + Offset = date.Offset, + Kind = date.Offset == TimeSpan.Zero ? DateTimeKind.Utc : DateTimeKind.Unspecified + }; + } + + private static readonly char[] timeSeperators = { ':', '.' }; + + internal static IsoDate Parse(string text) + { + var tzIndex = -1; + var timeIndex = text.IndexOf('T'); + + var builder = new IsoDate { Day = 1, Month = 1 }; + + // TODO: strip the time zone offset off the end + string dateTime = text; + string timeZone = null; + + if (dateTime.IndexOf('Z') > -1) + { + tzIndex = dateTime.LastIndexOf('Z'); + + builder.Kind = DateTimeKind.Utc; + } + else if (dateTime.LastIndexOf('+') > 10) + { + tzIndex = dateTime.LastIndexOf('+'); + } + else if (dateTime.LastIndexOf('-') > 10) + { + tzIndex = dateTime.LastIndexOf('-'); + } + + if (tzIndex > -1) + { + timeZone = dateTime.Substring(tzIndex); + dateTime = dateTime.Substring(0, tzIndex); + } + + string date = (timeIndex == -1) ? dateTime : dateTime.Substring(0, timeIndex); + + var dateParts = date.Split(Seperator.Dash); // '-' + + for (int i = 0; i < dateParts.Length; i++) + { + var part = dateParts[i]; + + switch (i) + { + case 0: builder.Year = int.Parse(part); break; + case 1: builder.Month = int.Parse(part); break; + case 2: builder.Day = int.Parse(part); break; + } + } + + if (timeIndex > -1) + { + string[] timeParts = dateTime.Substring(timeIndex + 1).Split(timeSeperators); + + for (int i = 0; i < timeParts.Length; i++) + { + var part = timeParts[i]; + + switch (i) + { + case 0: builder.Hour = int.Parse(part); break; + case 1: builder.Minute = int.Parse(part); break; + case 2: builder.Second = int.Parse(part); break; + case 3: builder.Millisecond = double.Parse("0." + part) * 1000; break; + } + } + } + + if (timeZone != null && timeZone != "Z") + { + var hours = int.Parse(timeZone.Substring(1, 2)); + var minutes = int.Parse(timeZone.Substring(4, 2)); + + if (timeZone[0] == '-') + { + hours = -hours; + minutes = -minutes; + } + + builder.Offset = new TimeSpan(hours, minutes, 0); + } + + return builder; + } + } + + /* + YYYY # eg 1997 + YYYY-MM # eg 1997-07 + YYYY-MM-DD # eg 1997-07-16 + YYYY-MM-DDThh:mmTZD # eg 1997-07-16T19:20+01:00 + YYYY-MM-DDThh:mm:ssTZD # eg 1997-07-16T19:20:30+01:00 + YYYY-MM-DDThh:mm:ss.sTZD # eg 1997-07-16T19:20:30.45+01:00 + + where: + + YYYY = four-digit year + MM = two-digit month (01=January, etc.) + DD = two-digit day of month (01 through 31) + hh = two digits of hour (00 through 23) (am/pm NOT allowed) + mm = two digits of minute (00 through 59) + ss = two digits of second (00 through 59) + s = one or more digits representing a decimal fraction of a second + TZD = time zone designator (Z or +hh:mm or -hh:mm) + */ +} diff --git a/src/Security/Security.Autorest/generated/runtime/JsonType.cs b/src/Security/Security.Autorest/generated/runtime/JsonType.cs new file mode 100644 index 000000000000..8c553478857f --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/JsonType.cs @@ -0,0 +1,18 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json +{ + internal enum JsonType + { + Null = 0, + Object = 1, + Array = 2, + Binary = 3, + Boolean = 4, + Date = 5, + Number = 6, + String = 7 + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/MessageAttribute.cs b/src/Security/Security.Autorest/generated/runtime/MessageAttribute.cs new file mode 100644 index 000000000000..6256f761c04a --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/MessageAttribute.cs @@ -0,0 +1,350 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.generated.runtime.Properties; + using System; + using System.Collections.Generic; + using System.Globalization; + using System.Linq; + using System.Management.Automation; + using System.Text; + + [AttributeUsage(AttributeTargets.All)] + public class GenericBreakingChangeAttribute : Attribute + { + private string _message; + //A dexcription of what the change is about, non mandatory + public string ChangeDescription { get; set; } = null; + + //The version the change is effective from, non mandatory + public string DeprecateByVersion { get; } + public string DeprecateByAzVersion { get; } + + //The date on which the change comes in effect + public DateTime ChangeInEfectByDate { get; } + public bool ChangeInEfectByDateSet { get; } = false; + + //Old way of calling the cmdlet + public string OldWay { get; set; } + //New way fo calling the cmdlet + public string NewWay { get; set; } + + public GenericBreakingChangeAttribute(string message, string deprecateByAzVersion, string deprecateByVersion) + { + _message = message; + this.DeprecateByAzVersion = deprecateByAzVersion; + this.DeprecateByVersion = deprecateByVersion; + } + + public GenericBreakingChangeAttribute(string message, string deprecateByAzVersion, string deprecateByVersion, string changeInEfectByDate) + { + _message = message; + this.DeprecateByVersion = deprecateByVersion; + this.DeprecateByAzVersion = deprecateByAzVersion; + + if (DateTime.TryParse(changeInEfectByDate, new CultureInfo("en-US"), DateTimeStyles.None, out DateTime result)) + { + this.ChangeInEfectByDate = result; + this.ChangeInEfectByDateSet = true; + } + } + + public DateTime getInEffectByDate() + { + return this.ChangeInEfectByDate.Date; + } + + + /** + * This function prints out the breaking change message for the attribute on the cmdline + * */ + public void PrintCustomAttributeInfo(Action writeOutput) + { + + if (!GetAttributeSpecificMessage().StartsWith(Environment.NewLine)) + { + writeOutput(Environment.NewLine); + } + writeOutput(string.Format(Resources.BreakingChangesAttributesDeclarationMessage, GetAttributeSpecificMessage())); + + + if (!string.IsNullOrWhiteSpace(ChangeDescription)) + { + writeOutput(string.Format(Resources.BreakingChangesAttributesChangeDescriptionMessage, this.ChangeDescription)); + } + + if (ChangeInEfectByDateSet) + { + writeOutput(string.Format(Resources.BreakingChangesAttributesInEffectByDateMessage, this.ChangeInEfectByDate.ToString("d"))); + } + + writeOutput(string.Format(Resources.BreakingChangesAttributesInEffectByAzVersion, this.DeprecateByAzVersion)); + writeOutput(string.Format(Resources.BreakingChangesAttributesInEffectByVersion, this.DeprecateByVersion)); + + if (OldWay != null && NewWay != null) + { + writeOutput(string.Format(Resources.BreakingChangesAttributesUsageChangeMessageConsole, OldWay, NewWay)); + } + } + + public virtual bool IsApplicableToInvocation(InvocationInfo invocation) + { + return true; + } + + protected virtual string GetAttributeSpecificMessage() + { + return _message; + } + } + + [AttributeUsage(AttributeTargets.All)] + public class CmdletBreakingChangeAttribute : GenericBreakingChangeAttribute + { + + public string ReplacementCmdletName { get; set; } + + public CmdletBreakingChangeAttribute(string deprecateByAzVersion, string deprecateByVersion) : + base(string.Empty, deprecateByAzVersion, deprecateByVersion) + { + } + + public CmdletBreakingChangeAttribute(string deprecateByAzVersion, string deprecateByVersion, string changeInEfectByDate) : + base(string.Empty, deprecateByAzVersion, deprecateByVersion, changeInEfectByDate) + { + } + + protected override string GetAttributeSpecificMessage() + { + if (string.IsNullOrWhiteSpace(ReplacementCmdletName)) + { + return Resources.BreakingChangesAttributesCmdLetDeprecationMessageNoReplacement; + } + else + { + return string.Format(Resources.BreakingChangesAttributesCmdLetDeprecationMessageWithReplacement, ReplacementCmdletName); + } + } + } + + [AttributeUsage(AttributeTargets.All)] + public class ParameterSetBreakingChangeAttribute : GenericBreakingChangeAttribute + { + public string[] ChangedParameterSet { set; get; } + + public ParameterSetBreakingChangeAttribute(string[] changedParameterSet, string deprecateByAzVersion, string deprecateByVersion) : + base(string.Empty, deprecateByAzVersion, deprecateByVersion) + { + ChangedParameterSet = changedParameterSet; + } + + public ParameterSetBreakingChangeAttribute(string[] changedParameterSet, string deprecateByAzVersion, string deprecateByVersion, string changeInEfectByDate) : + base(string.Empty, deprecateByAzVersion, deprecateByVersion, changeInEfectByDate) + { + ChangedParameterSet = changedParameterSet; + } + + protected override string GetAttributeSpecificMessage() + { + + return Resources.BreakingChangesAttributesParameterSetDeprecationMessageNoReplacement; + + } + + public bool IsApplicableToInvocation(InvocationInfo invocation, string parameterSetName) + { + if (ChangedParameterSet != null) + return ChangedParameterSet.Contains(parameterSetName); + return false; + } + + } + + [AttributeUsage(AttributeTargets.All)] + public class PreviewMessageAttribute : Attribute + { + public string _message; + + public DateTime EstimatedGaDate { get; } + + public bool IsEstimatedGaDateSet { get; } = false; + + + public PreviewMessageAttribute() + { + this._message = Resources.PreviewCmdletMessage; + } + + public PreviewMessageAttribute(string message) + { + this._message = string.IsNullOrEmpty(message) ? Resources.PreviewCmdletMessage : message; + } + + public PreviewMessageAttribute(string message, string estimatedDateOfGa) : this(message) + { + if (DateTime.TryParse(estimatedDateOfGa, new CultureInfo("en-US"), DateTimeStyles.None, out DateTime result)) + { + this.EstimatedGaDate = result; + this.IsEstimatedGaDateSet = true; + } + } + + public void PrintCustomAttributeInfo(Action writeOutput) + { + writeOutput(this._message); + + if (IsEstimatedGaDateSet) + { + writeOutput(string.Format(Resources.PreviewCmdletETAMessage, this.EstimatedGaDate.ToShortDateString())); + } + } + + public virtual bool IsApplicableToInvocation(InvocationInfo invocation) + { + return true; + } + } + + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)] + public class ParameterBreakingChangeAttribute : GenericBreakingChangeAttribute + { + public string NameOfParameterChanging { get; } + + public string ReplaceMentCmdletParameterName { get; set; } = null; + + public bool IsBecomingMandatory { get; set; } = false; + + public String OldParamaterType { get; set; } + + public String NewParameterType { get; set; } + + public ParameterBreakingChangeAttribute(string nameOfParameterChanging, string deprecateByAzVersion, string deprecateByVersion) : + base(string.Empty, deprecateByAzVersion, deprecateByVersion) + { + this.NameOfParameterChanging = nameOfParameterChanging; + } + + public ParameterBreakingChangeAttribute(string nameOfParameterChanging, string deprecateByAzVersion, string deprecateByVersion, string changeInEfectByDate) : + base(string.Empty, deprecateByAzVersion, deprecateByVersion, changeInEfectByDate) + { + this.NameOfParameterChanging = nameOfParameterChanging; + } + + protected override string GetAttributeSpecificMessage() + { + StringBuilder message = new StringBuilder(); + if (!string.IsNullOrWhiteSpace(ReplaceMentCmdletParameterName)) + { + if (IsBecomingMandatory) + { + message.Append(string.Format(Resources.BreakingChangeAttributeParameterReplacedMandatory, NameOfParameterChanging, ReplaceMentCmdletParameterName)); + } + else + { + message.Append(string.Format(Resources.BreakingChangeAttributeParameterReplaced, NameOfParameterChanging, ReplaceMentCmdletParameterName)); + } + } + else + { + if (IsBecomingMandatory) + { + message.Append(string.Format(Resources.BreakingChangeAttributeParameterMandatoryNow, NameOfParameterChanging)); + } + else + { + message.Append(string.Format(Resources.BreakingChangeAttributeParameterChanging, NameOfParameterChanging)); + } + } + + //See if the type of the param is changing + if (OldParamaterType != null && !string.IsNullOrWhiteSpace(NewParameterType)) + { + message.Append(string.Format(Resources.BreakingChangeAttributeParameterTypeChange, OldParamaterType, NewParameterType)); + } + return message.ToString(); + } + + /// + /// See if the bound parameters contain the current parameter, if they do + /// then the attribbute is applicable + /// If the invocationInfo is null we return true + /// + /// + /// bool + public override bool IsApplicableToInvocation(InvocationInfo invocationInfo) + { + bool? applicable = invocationInfo == null ? true : invocationInfo.BoundParameters?.Keys?.Contains(this.NameOfParameterChanging); + return applicable.HasValue ? applicable.Value : false; + } + } + + [AttributeUsage(AttributeTargets.All)] + public class OutputBreakingChangeAttribute : GenericBreakingChangeAttribute + { + public string DeprecatedCmdLetOutputType { get; } + + //This is still a String instead of a Type as this + //might be undefined at the time of adding the attribute + public string ReplacementCmdletOutputType { get; set; } + + public string[] DeprecatedOutputProperties { get; set; } + + public string[] NewOutputProperties { get; set; } + + public OutputBreakingChangeAttribute(string deprecatedCmdletOutputType, string deprecateByAzVersion, string deprecateByVersion) : + base(string.Empty, deprecateByAzVersion, deprecateByVersion) + { + this.DeprecatedCmdLetOutputType = deprecatedCmdletOutputType; + } + + public OutputBreakingChangeAttribute(string deprecatedCmdletOutputType, string deprecateByAzVersion, string deprecateByVersion, string changeInEfectByDate) : + base(string.Empty, deprecateByAzVersion, deprecateByVersion, changeInEfectByDate) + { + this.DeprecatedCmdLetOutputType = deprecatedCmdletOutputType; + } + + protected override string GetAttributeSpecificMessage() + { + StringBuilder message = new StringBuilder(); + + //check for the deprecation scenario + if (string.IsNullOrWhiteSpace(ReplacementCmdletOutputType) && NewOutputProperties == null && DeprecatedOutputProperties == null && string.IsNullOrWhiteSpace(ChangeDescription)) + { + message.Append(string.Format(Resources.BreakingChangesAttributesCmdLetOutputTypeDeprecated, DeprecatedCmdLetOutputType)); + } + else + { + if (!string.IsNullOrWhiteSpace(ReplacementCmdletOutputType)) + { + message.Append(string.Format(Resources.BreakingChangesAttributesCmdLetOutputChange1, DeprecatedCmdLetOutputType, ReplacementCmdletOutputType)); + } + else + { + message.Append(string.Format(Resources.BreakingChangesAttributesCmdLetOutputChange2, DeprecatedCmdLetOutputType)); + } + + if (DeprecatedOutputProperties != null && DeprecatedOutputProperties.Length > 0) + { + message.Append(Resources.BreakingChangesAttributesCmdLetOutputPropertiesRemoved); + foreach (string property in DeprecatedOutputProperties) + { + message.Append(" '" + property + "'"); + } + } + + if (NewOutputProperties != null && NewOutputProperties.Length > 0) + { + message.Append(Resources.BreakingChangesAttributesCmdLetOutputPropertiesAdded); + foreach (string property in NewOutputProperties) + { + message.Append(" '" + property + "'"); + } + } + } + return message.ToString(); + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/MessageAttributeHelper.cs b/src/Security/Security.Autorest/generated/runtime/MessageAttributeHelper.cs new file mode 100644 index 000000000000..a9b704b4c38c --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/MessageAttributeHelper.cs @@ -0,0 +1,184 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime +{ + using Microsoft.Azure.PowerShell.Cmdlets.Security.generated.runtime.Properties; + using System; + using System.Collections.Generic; + using System.Linq; + using System.Management.Automation; + using System.Reflection; + using System.Text; + using System.Threading.Tasks; + public class MessageAttributeHelper + { + private static readonly bool IsAzure = Convert.ToBoolean(@"true"); + public const string BREAKING_CHANGE_ATTRIBUTE_INFORMATION_LINK = "https://aka.ms/azps-changewarnings"; + public const string SUPPRESS_ERROR_OR_WARNING_MESSAGE_ENV_VARIABLE_NAME = "SuppressAzurePowerShellBreakingChangeWarnings"; + + /** + * This function takes in a CommandInfo (CmdletInfo or FunctionInfo) + * And reads all the deprecation attributes attached to it + * Prints a message on the cmdline For each of the attribute found + * + * the boundParameterNames is a list of parameters bound to the cmdlet at runtime, + * We only process the Parameter beaking change attributes attached only params listed in this list (if present) + * */ + public static void ProcessCustomAttributesAtRuntime(CommandInfo commandInfo, InvocationInfo invocationInfo, String parameterSet, System.Management.Automation.PSCmdlet psCmdlet, bool showPreviewMessage = true) + { + bool supressWarningOrError = false; + + try + { + supressWarningOrError = bool.Parse(System.Environment.GetEnvironmentVariable(SUPPRESS_ERROR_OR_WARNING_MESSAGE_ENV_VARIABLE_NAME)); + } + catch (Exception) + { + //no action + } + + if (supressWarningOrError) + { + //Do not process the attributes at runtime... The env variable to override the warning messages is set + return; + } + if (IsAzure && invocationInfo.BoundParameters.ContainsKey("DefaultProfile")) + { + psCmdlet.WriteWarning("The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription."); + } + + ProcessBreakingChangeAttributesAtRuntime(commandInfo, invocationInfo, parameterSet, psCmdlet); + + } + + private static void ProcessBreakingChangeAttributesAtRuntime(CommandInfo commandInfo, InvocationInfo invocationInfo, String parameterSet, System.Management.Automation.PSCmdlet psCmdlet) + { + List attributes = new List(GetAllBreakingChangeAttributesInType(commandInfo, invocationInfo, parameterSet)); + StringBuilder sb = new StringBuilder(); + Action appendAttributeMessage = (string s) => sb.Append(s); + + if (attributes != null && attributes.Count > 0) + { + appendAttributeMessage(string.Format(Resources.BreakingChangesAttributesHeaderMessage, commandInfo.Name.Split('_')[0])); + + foreach (GenericBreakingChangeAttribute attribute in attributes) + { + attribute.PrintCustomAttributeInfo(appendAttributeMessage); + } + + appendAttributeMessage(string.Format(Resources.BreakingChangesAttributesFooterMessage, BREAKING_CHANGE_ATTRIBUTE_INFORMATION_LINK)); + + psCmdlet.WriteWarning(sb.ToString()); + } + } + + + public static void ProcessPreviewMessageAttributesAtRuntime(CommandInfo commandInfo, InvocationInfo invocationInfo, String parameterSet, System.Management.Automation.PSCmdlet psCmdlet) + { + List previewAttributes = new List(GetAllPreviewAttributesInType(commandInfo, invocationInfo)); + StringBuilder sb = new StringBuilder(); + Action appendAttributeMessage = (string s) => sb.Append(s); + + if (previewAttributes != null && previewAttributes.Count > 0) + { + foreach (PreviewMessageAttribute attribute in previewAttributes) + { + attribute.PrintCustomAttributeInfo(appendAttributeMessage); + } + psCmdlet.WriteWarning(sb.ToString()); + } + } + + /** + * This function takes in a CommandInfo (CmdletInfo or FunctionInfo) + * And returns all the deprecation attributes attached to it + * + * the boundParameterNames is a list of parameters bound to the cmdlet at runtime, + * We only process the Parameter beaking change attributes attached only params listed in this list (if present) + **/ + private static IEnumerable GetAllBreakingChangeAttributesInType(CommandInfo commandInfo, InvocationInfo invocationInfo, String parameterSet) + { + List attributeList = new List(); + + if (commandInfo.GetType() == typeof(CmdletInfo)) + { + var type = ((CmdletInfo)commandInfo).ImplementingType; + attributeList.AddRange(type.GetCustomAttributes(typeof(GenericBreakingChangeAttribute), false).Cast()); + + foreach (MethodInfo m in type.GetRuntimeMethods()) + { + attributeList.AddRange((m.GetCustomAttributes(typeof(GenericBreakingChangeAttribute), false).Cast())); + } + + foreach (FieldInfo f in type.GetRuntimeFields()) + { + attributeList.AddRange(f.GetCustomAttributes(typeof(GenericBreakingChangeAttribute), false).Cast()); + } + + foreach (PropertyInfo p in type.GetRuntimeProperties()) + { + attributeList.AddRange(p.GetCustomAttributes(typeof(GenericBreakingChangeAttribute), false).Cast()); + } + } + else if (commandInfo.GetType() == typeof(FunctionInfo)) + { + attributeList.AddRange(((FunctionInfo)commandInfo).ScriptBlock.Attributes.Where(e => typeof(GenericBreakingChangeAttribute).IsAssignableFrom(e.GetType())).Cast()); + foreach (var parameter in ((FunctionInfo)commandInfo).Parameters) + { + attributeList.AddRange(parameter.Value.Attributes.Where(e => typeof(GenericBreakingChangeAttribute).IsAssignableFrom(e.GetType())).Cast()); + } + } + return invocationInfo == null ? attributeList : attributeList.Where(e => e.GetType() == typeof(ParameterSetBreakingChangeAttribute) ? ((ParameterSetBreakingChangeAttribute)e).IsApplicableToInvocation(invocationInfo, parameterSet) : e.IsApplicableToInvocation(invocationInfo)); + } + + public static bool ContainsPreviewAttribute(CommandInfo commandInfo, InvocationInfo invocationInfo) + { + return GetAllPreviewAttributesInType(commandInfo, invocationInfo)?.Count() > 0; + } + + private static IEnumerable GetAllPreviewAttributesInType(CommandInfo commandInfo, InvocationInfo invocationInfo) + { + List attributeList = new List(); + if (commandInfo.GetType() == typeof(CmdletInfo)) + { + var type = ((CmdletInfo)commandInfo).ImplementingType; + attributeList.AddRange(type.GetCustomAttributes(typeof(PreviewMessageAttribute), false).Cast()); + + foreach (MethodInfo m in type.GetRuntimeMethods()) + { + attributeList.AddRange((m.GetCustomAttributes(typeof(PreviewMessageAttribute), false).Cast())); + } + + foreach (FieldInfo f in type.GetRuntimeFields()) + { + attributeList.AddRange(f.GetCustomAttributes(typeof(PreviewMessageAttribute), false).Cast()); + } + + foreach (PropertyInfo p in type.GetRuntimeProperties()) + { + attributeList.AddRange(p.GetCustomAttributes(typeof(PreviewMessageAttribute), false).Cast()); + } + } + else if (commandInfo.GetType() == typeof(FunctionInfo)) + { + attributeList.AddRange(((FunctionInfo)commandInfo).ScriptBlock.Attributes.Where(e => typeof(PreviewMessageAttribute).IsAssignableFrom(e.GetType())).Cast()); + foreach (var parameter in ((FunctionInfo)commandInfo).Parameters) + { + attributeList.AddRange(parameter.Value.Attributes.Where(e => typeof(PreviewMessageAttribute).IsAssignableFrom(e.GetType())).Cast()); + } + } + return invocationInfo == null ? attributeList : attributeList.Where(e => e.IsApplicableToInvocation(invocationInfo)); + } + } +} diff --git a/src/Security/Security.Autorest/generated/runtime/Method.cs b/src/Security/Security.Autorest/generated/runtime/Method.cs new file mode 100644 index 000000000000..4552e2a871c0 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Method.cs @@ -0,0 +1,19 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime +{ + internal static class Method + { + internal static System.Net.Http.HttpMethod Get = System.Net.Http.HttpMethod.Get; + internal static System.Net.Http.HttpMethod Put = System.Net.Http.HttpMethod.Put; + internal static System.Net.Http.HttpMethod Head = System.Net.Http.HttpMethod.Head; + internal static System.Net.Http.HttpMethod Post = System.Net.Http.HttpMethod.Post; + internal static System.Net.Http.HttpMethod Delete = System.Net.Http.HttpMethod.Delete; + internal static System.Net.Http.HttpMethod Options = System.Net.Http.HttpMethod.Options; + internal static System.Net.Http.HttpMethod Trace = System.Net.Http.HttpMethod.Trace; + internal static System.Net.Http.HttpMethod Patch = new System.Net.Http.HttpMethod("PATCH"); + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Models/JsonMember.cs b/src/Security/Security.Autorest/generated/runtime/Models/JsonMember.cs new file mode 100644 index 000000000000..2003dbb5104d --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Models/JsonMember.cs @@ -0,0 +1,83 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Reflection; +using System.Runtime.Serialization; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json +{ + + + internal sealed class JsonMember + { + private readonly TypeDetails type; + + private readonly Func getter; + private readonly Action setter; + + internal JsonMember(PropertyInfo property, int defaultOrder) + { + getter = property.GetValue; + setter = property.SetValue; + + var dataMember = property.GetCustomAttribute(); + + Name = dataMember?.Name ?? property.Name; + Order = dataMember?.Order ?? defaultOrder; + EmitDefaultValue = dataMember?.EmitDefaultValue ?? true; + + this.type = TypeDetails.Get(property.PropertyType); + + CanRead = property.CanRead; + } + + internal JsonMember(FieldInfo field, int defaultOrder) + { + getter = field.GetValue; + setter = field.SetValue; + + var dataMember = field.GetCustomAttribute(); + + Name = dataMember?.Name ?? field.Name; + Order = dataMember?.Order ?? defaultOrder; + EmitDefaultValue = dataMember?.EmitDefaultValue ?? true; + + this.type = TypeDetails.Get(field.FieldType); + + CanRead = true; + } + + internal string Name { get; } + + internal int Order { get; } + + internal TypeDetails TypeDetails => type; + + internal Type Type => type.NonNullType; + + internal bool IsList => type.IsList; + + // Arrays, Sets, ... + internal Type ElementType => type.ElementType; + + internal IJsonConverter Converter => type.JsonConverter; + + internal bool EmitDefaultValue { get; } + + internal bool IsStringLike => type.IsStringLike; + + internal object DefaultValue => type.DefaultValue; + + internal bool CanRead { get; } + + #region Helpers + + internal object GetValue(object instance) => getter(instance); + + internal void SetValue(object instance, object value) => setter(instance, value); + + #endregion + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Models/JsonModel.cs b/src/Security/Security.Autorest/generated/runtime/Models/JsonModel.cs new file mode 100644 index 000000000000..3c8af64a2170 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Models/JsonModel.cs @@ -0,0 +1,89 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.Runtime.Serialization; +using System.Reflection; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json +{ + internal class JsonModel + { + private Dictionary map; + private readonly object _sync = new object(); + + private JsonModel(Type type, List members) + { + Type = type ?? throw new ArgumentNullException(nameof(type)); + Members = members ?? throw new ArgumentNullException(nameof(members)); + } + + internal string Name => Type.Name; + + internal Type Type { get; } + + internal List Members { get; } + + internal JsonMember this[string name] + { + get + { + if (map == null) + { + lock (_sync) + { + if (map == null) + { + map = new Dictionary(); + + foreach (JsonMember m in Members) + { + map[m.Name.ToLower()] = m; + } + } + } + } + + + map.TryGetValue(name.ToLower(), out JsonMember member); + + return member; + } + } + + internal static JsonModel FromType(Type type) + { + var members = new List(); + + int i = 0; + + // BindingFlags.Instance | BindingFlags.Public + + foreach (var member in type.GetFields()) + { + if (member.IsStatic) continue; + + if (member.IsDefined(typeof(IgnoreDataMemberAttribute))) continue; + + members.Add(new JsonMember(member, i)); + + i++; + } + + foreach (var member in type.GetProperties(BindingFlags.Public | BindingFlags.Instance)) + { + if (member.IsDefined(typeof(IgnoreDataMemberAttribute))) continue; + + members.Add(new JsonMember(member, i)); + + i++; + } + + members.Sort((a, b) => a.Order.CompareTo(b.Order)); // inline sort + + return new JsonModel(type, members); + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Models/JsonModelCache.cs b/src/Security/Security.Autorest/generated/runtime/Models/JsonModelCache.cs new file mode 100644 index 000000000000..38f3b062d2c5 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Models/JsonModelCache.cs @@ -0,0 +1,19 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Runtime.CompilerServices; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json +{ + internal static class JsonModelCache + { + private static readonly ConditionalWeakTable cache + = new ConditionalWeakTable(); + + internal static JsonModel Get(Type type) => cache.GetValue(type, Create); + + private static JsonModel Create(Type type) => JsonModel.FromType(type); + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Nodes/Collections/JsonArray.cs b/src/Security/Security.Autorest/generated/runtime/Nodes/Collections/JsonArray.cs new file mode 100644 index 000000000000..5cecef83e608 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Nodes/Collections/JsonArray.cs @@ -0,0 +1,65 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json +{ + public abstract partial class JsonArray : JsonNode, IEnumerable + { + internal override JsonType Type => JsonType.Array; + + internal abstract JsonType? ElementType { get; } + + public abstract int Count { get; } + + internal virtual bool IsSet => false; + + internal bool IsEmpty => Count == 0; + + #region IEnumerable + + IEnumerator IEnumerable.GetEnumerator() + { + throw new NotImplementedException(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + throw new NotImplementedException(); + } + + #endregion + + #region Static Helpers + + internal static JsonArray Create(short[] values) + => new XImmutableArray(values); + + internal static JsonArray Create(int[] values) + => new XImmutableArray(values); + + internal static JsonArray Create(long[] values) + => new XImmutableArray(values); + + internal static JsonArray Create(decimal[] values) + => new XImmutableArray(values); + + internal static JsonArray Create(float[] values) + => new XImmutableArray(values); + + internal static JsonArray Create(string[] values) + => new XImmutableArray(values); + + internal static JsonArray Create(XBinary[] values) + => new XImmutableArray(values); + + #endregion + + internal static new JsonArray Parse(string text) + => (JsonArray)JsonNode.Parse(text); + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Nodes/Collections/XImmutableArray.cs b/src/Security/Security.Autorest/generated/runtime/Nodes/Collections/XImmutableArray.cs new file mode 100644 index 000000000000..4f2357f07250 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Nodes/Collections/XImmutableArray.cs @@ -0,0 +1,62 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json +{ + internal sealed class XImmutableArray : JsonArray, IEnumerable + { + private readonly T[] values; + private readonly JsonType elementType; + private readonly TypeCode elementCode; + + internal XImmutableArray(T[] values) + { + this.values = values ?? throw new ArgumentNullException(nameof(values)); + this.elementCode = System.Type.GetTypeCode(typeof(T)); + this.elementType = XHelper.GetElementType(this.elementCode); + } + + public override JsonNode this[int index] => + XHelper.Create(elementType, elementCode, values[index]); + + internal override JsonType? ElementType => elementType; + + public override int Count => values.Length; + + public bool IsReadOnly => true; + + #region IEnumerable Members + + IEnumerator IEnumerable.GetEnumerator() + { + foreach (T value in values) + { + yield return XHelper.Create(elementType, elementCode, value); + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + foreach (T value in values) + { + yield return XHelper.Create(elementType, elementCode, value); + } + } + + #endregion + + #region Static Constructor + + internal XImmutableArray Create(T[] items) + { + return new XImmutableArray(items); + } + + #endregion + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Nodes/Collections/XList.cs b/src/Security/Security.Autorest/generated/runtime/Nodes/Collections/XList.cs new file mode 100644 index 000000000000..a4a9bb85c5c0 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Nodes/Collections/XList.cs @@ -0,0 +1,64 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json +{ + internal sealed class XList : JsonArray, IEnumerable + { + private readonly IList values; + private readonly JsonType elementType; + private readonly TypeCode elementCode; + + internal XList(IList values) + { + this.values = values ?? throw new ArgumentNullException(nameof(values)); + this.elementCode = System.Type.GetTypeCode(typeof(T)); + this.elementType = XHelper.GetElementType(this.elementCode); + } + + public override JsonNode this[int index] => + XHelper.Create(elementType, elementCode, values[index]); + + internal override JsonType? ElementType => elementType; + + public override int Count => values.Count; + + public bool IsReadOnly => values.IsReadOnly; + + #region IList + + public void Add(T value) + { + values.Add(value); + } + + public bool Contains(T value) => values.Contains(value); + + #endregion + + #region IEnumerable Members + + IEnumerator IEnumerable.GetEnumerator() + { + foreach (var value in values) + { + yield return XHelper.Create(elementType, elementCode, value); + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + foreach (var value in values) + { + yield return XHelper.Create(elementType, elementCode, value); + } + } + + #endregion + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Nodes/Collections/XNodeArray.cs b/src/Security/Security.Autorest/generated/runtime/Nodes/Collections/XNodeArray.cs new file mode 100644 index 000000000000..46bf07dc369d --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Nodes/Collections/XNodeArray.cs @@ -0,0 +1,73 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.Collections; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json +{ + public sealed partial class XNodeArray : JsonArray, ICollection + { + private readonly List items; + + internal XNodeArray() + { + items = new List(); + } + + internal XNodeArray(params JsonNode[] values) + { + items = new List(values); + } + + internal XNodeArray(System.Collections.Generic.List values) + { + items = new List(values); + } + + public override JsonNode this[int index] => items[index]; + + internal override JsonType? ElementType => null; + + public bool IsReadOnly => false; + + public override int Count => items.Count; + + #region ICollection Members + + public void Add(JsonNode item) + { + items.Add(item); + } + + void ICollection.Clear() + { + items.Clear(); + } + + public bool Contains(JsonNode item) => items.Contains(item); + + void ICollection.CopyTo(JsonNode[] array, int arrayIndex) + { + items.CopyTo(array, arrayIndex); + } + + public bool Remove(JsonNode item) + { + return items.Remove(item); + } + + #endregion + + #region IEnumerable Members + + IEnumerator IEnumerable.GetEnumerator() + => items.GetEnumerator(); + + IEnumerator IEnumerable.GetEnumerator() + => items.GetEnumerator(); + + #endregion + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Nodes/Collections/XSet.cs b/src/Security/Security.Autorest/generated/runtime/Nodes/Collections/XSet.cs new file mode 100644 index 000000000000..2bd14afefe2b --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Nodes/Collections/XSet.cs @@ -0,0 +1,60 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json +{ + internal sealed class XSet : JsonArray, IEnumerable + { + private readonly HashSet values; + private readonly JsonType elementType; + private readonly TypeCode elementCode; + + internal XSet(IEnumerable values) + : this(new HashSet(values)) + { } + + internal XSet(HashSet values) + { + this.values = values ?? throw new ArgumentNullException(nameof(values)); + this.elementCode = System.Type.GetTypeCode(typeof(T)); + this.elementType = XHelper.GetElementType(this.elementCode); + } + + internal override JsonType Type => JsonType.Array; + + internal override JsonType? ElementType => elementType; + + public bool IsReadOnly => true; + + public override int Count => values.Count; + + internal override bool IsSet => true; + + #region IEnumerable Members + + IEnumerator IEnumerable.GetEnumerator() + { + foreach (var value in values) + { + yield return XHelper.Create(elementType, elementCode, value); + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + foreach (var value in values) + { + yield return XHelper.Create(elementType, elementCode, value); + } + } + + #endregion + + internal HashSet AsHashSet() => values; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Nodes/JsonBoolean.cs b/src/Security/Security.Autorest/generated/runtime/Nodes/JsonBoolean.cs new file mode 100644 index 000000000000..a55f15f6aa1c --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Nodes/JsonBoolean.cs @@ -0,0 +1,42 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json +{ + internal sealed partial class JsonBoolean : JsonNode + { + internal static readonly JsonBoolean True = new JsonBoolean(true); + internal static readonly JsonBoolean False = new JsonBoolean(false); + + internal JsonBoolean(bool value) + { + Value = value; + } + + internal bool Value { get; } + + internal override JsonType Type => JsonType.Boolean; + + internal static new JsonBoolean Parse(string text) + { + switch (text) + { + case "false": return False; + case "true": return True; + + default: throw new ArgumentException($"Expected true or false. Was {text}."); + } + } + + #region Implicit Casts + + public static implicit operator bool(JsonBoolean data) => data.Value; + + public static implicit operator JsonBoolean(bool data) => new JsonBoolean(data); + + #endregion + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Nodes/JsonDate.cs b/src/Security/Security.Autorest/generated/runtime/Nodes/JsonDate.cs new file mode 100644 index 000000000000..6ef56f3515b0 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Nodes/JsonDate.cs @@ -0,0 +1,173 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json +{ + + + internal sealed partial class JsonDate : JsonNode, IEquatable, IComparable + { + internal static bool AssumeUtcWhenKindIsUnspecified = true; + + private readonly DateTimeOffset value; + + internal JsonDate(DateTime value) + { + if (value.Kind == DateTimeKind.Unspecified && AssumeUtcWhenKindIsUnspecified) + { + value = DateTime.SpecifyKind(value, DateTimeKind.Utc); + } + + this.value = value; + } + + internal JsonDate(DateTimeOffset value) + { + this.value = value; + } + + internal override JsonType Type => JsonType.Date; + + #region Helpers + + internal DateTimeOffset ToDateTimeOffset() + { + return value; + } + + internal DateTime ToDateTime() + { + if (value.Offset == TimeSpan.Zero) + { + return value.UtcDateTime; + } + + return value.DateTime; + } + + internal DateTime ToUtcDateTime() => value.UtcDateTime; + + internal int ToUnixTimeSeconds() + { + return (int)value.ToUnixTimeSeconds(); + } + + internal long ToUnixTimeMilliseconds() + { + return (int)value.ToUnixTimeMilliseconds(); + } + + internal string ToIsoString() + { + return IsoDate.FromDateTimeOffset(value).ToString(); + } + + #endregion + + public override string ToString() + { + return ToIsoString(); + } + + internal static new JsonDate Parse(string text) + { + if (text == null) throw new ArgumentNullException(nameof(text)); + + // TODO support: unixtimeseconds.partialseconds + + if (text.Length > 4 && _IsNumber(text)) // UnixTime + { + var date = DateTimeOffset.FromUnixTimeSeconds(long.Parse(text)); + + return new JsonDate(date); + } + else if (text.Length <= 4 || text[4] == '-') // ISO: 2012- + { + return new JsonDate(IsoDate.Parse(text).ToDateTimeOffset()); + } + else + { + // NOT ISO ENCODED + // "Thu, 5 Apr 2012 16:59:01 +0200", + return new JsonDate(DateTimeOffset.Parse(text)); + } + } + + private static bool _IsNumber(string text) + { + foreach (var c in text) + { + if (!char.IsDigit(c)) return false; + } + + return true; + } + + internal static JsonDate FromUnixTime(int seconds) + { + return new JsonDate(DateTimeOffset.FromUnixTimeSeconds(seconds)); + } + + internal static JsonDate FromUnixTime(double seconds) + { + var milliseconds = (long)(seconds * 1000d); + + return new JsonDate(DateTimeOffset.FromUnixTimeMilliseconds(milliseconds)); + } + + #region Implicit Casts + + public static implicit operator DateTimeOffset(JsonDate value) + => value.ToDateTimeOffset(); + + public static implicit operator DateTime(JsonDate value) + => value.ToDateTime(); + + // From Date + public static implicit operator JsonDate(DateTimeOffset value) + { + return new JsonDate(value); + } + + public static implicit operator JsonDate(DateTime value) + { + return new JsonDate(value); + } + + // From String + public static implicit operator JsonDate(string value) + { + return Parse(value); + } + + #endregion + + #region Equality + + public override bool Equals(object obj) + { + return obj is JsonDate date && date.value == this.value; + } + + public bool Equals(JsonDate other) + { + return this.value == other.value; + } + + public override int GetHashCode() => value.GetHashCode(); + + #endregion + + #region IComparable Members + + int IComparable.CompareTo(JsonDate other) + { + return value.CompareTo(other.value); + } + + #endregion + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Nodes/JsonNode.cs b/src/Security/Security.Autorest/generated/runtime/Nodes/JsonNode.cs new file mode 100644 index 000000000000..f4ec319f731d --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Nodes/JsonNode.cs @@ -0,0 +1,250 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.IO; +using System.Text; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json +{ + + + public abstract partial class JsonNode + { + internal abstract JsonType Type { get; } + + public virtual JsonNode this[int index] => throw new NotImplementedException(); + + public virtual JsonNode this[string name] + { + get => throw new NotImplementedException(); + set => throw new NotImplementedException(); + } + + #region Type Helpers + + internal bool IsArray => Type == JsonType.Array; + + internal bool IsDate => Type == JsonType.Date; + + internal bool IsObject => Type == JsonType.Object; + + internal bool IsNumber => Type == JsonType.Number; + + internal bool IsNull => Type == JsonType.Null; + + #endregion + + internal void WriteTo(TextWriter textWriter, bool pretty = true) + { + var writer = new JsonWriter(textWriter, pretty); + + writer.WriteNode(this); + } + + internal T As() + where T : new() + => new JsonSerializer().Deseralize((JsonObject)this); + + internal T[] ToArrayOf() + { + return (T[])new JsonSerializer().DeserializeArray(typeof(T[]), (JsonArray)this); + } + + #region ToString Overrides + + public override string ToString() => ToString(pretty: true); + + internal string ToString(bool pretty) + { + var sb = new StringBuilder(); + + using (var writer = new StringWriter(sb)) + { + WriteTo(writer, pretty); + + return sb.ToString(); + } + } + + #endregion + + #region Static Constructors + + internal static JsonNode Parse(string text) + { + return Parse(new SourceReader(new StringReader(text))); + } + + internal static JsonNode Parse(TextReader textReader) + => Parse(new SourceReader(textReader)); + + private static JsonNode Parse(SourceReader sourceReader) + { + using (var parser = new JsonParser(sourceReader)) + { + return parser.ReadNode(); + } + } + + internal static JsonNode FromObject(object instance) + => new JsonSerializer().Serialize(instance); + + #endregion + + #region Implict Casts + + public static implicit operator string(JsonNode node) => node.ToString(); + + #endregion + + #region Explict Casts + + public static explicit operator DateTime(JsonNode node) + { + switch (node.Type) + { + case JsonType.Date: + return ((JsonDate)node).ToDateTime(); + + case JsonType.String: + return JsonDate.Parse(node.ToString()).ToDateTime(); + + case JsonType.Number: + var num = (JsonNumber)node; + + if (num.IsInteger) + { + return DateTimeOffset.FromUnixTimeSeconds(num).UtcDateTime; + } + else + { + return DateTimeOffset.FromUnixTimeMilliseconds((long)((double)num * 1000)).UtcDateTime; + } + } + + throw new ConversionException(node, typeof(DateTime)); + } + + public static explicit operator DateTimeOffset(JsonNode node) + { + switch (node.Type) + { + case JsonType.Date : return ((JsonDate)node).ToDateTimeOffset(); + case JsonType.String : return JsonDate.Parse(node.ToString()).ToDateTimeOffset(); + + case JsonType.Number: + var num = (JsonNumber)node; + + if (num.IsInteger) + { + return DateTimeOffset.FromUnixTimeSeconds(num); + } + else + { + return DateTimeOffset.FromUnixTimeMilliseconds((long)((double)num * 1000)); + } + + } + + throw new ConversionException(node, typeof(DateTimeOffset)); + } + + public static explicit operator float(JsonNode node) + { + switch (node.Type) + { + case JsonType.Number : return (JsonNumber)node; + case JsonType.String : return float.Parse(node.ToString()); + } + + throw new ConversionException(node, typeof(float)); + } + + public static explicit operator double(JsonNode node) + { + switch (node.Type) + { + case JsonType.Number : return (JsonNumber)node; + case JsonType.String : return double.Parse(node.ToString()); + } + + throw new ConversionException(node, typeof(double)); + } + + public static explicit operator decimal(JsonNode node) + { + switch (node.Type) + { + case JsonType.Number: return (JsonNumber)node; + case JsonType.String: return decimal.Parse(node.ToString()); + } + + throw new ConversionException(node, typeof(decimal)); + } + + public static explicit operator Guid(JsonNode node) + => new Guid(node.ToString()); + + public static explicit operator short(JsonNode node) + { + switch (node.Type) + { + case JsonType.Number : return (JsonNumber)node; + case JsonType.String : return short.Parse(node.ToString()); + } + + throw new ConversionException(node, typeof(short)); + } + + public static explicit operator int(JsonNode node) + { + switch (node.Type) + { + case JsonType.Number : return (JsonNumber)node; + case JsonType.String : return int.Parse(node.ToString()); + } + + throw new ConversionException(node, typeof(int)); + } + + public static explicit operator long(JsonNode node) + { + switch (node.Type) + { + case JsonType.Number: return (JsonNumber)node; + case JsonType.String: return long.Parse(node.ToString()); + } + + throw new ConversionException(node, typeof(long)); + } + + public static explicit operator bool(JsonNode node) + => ((JsonBoolean)node).Value; + + public static explicit operator ushort(JsonNode node) + => (JsonNumber)node; + + public static explicit operator uint(JsonNode node) + => (JsonNumber)node; + + public static explicit operator ulong(JsonNode node) + => (JsonNumber)node; + + public static explicit operator TimeSpan(JsonNode node) + => TimeSpan.Parse(node.ToString()); + + public static explicit operator Uri(JsonNode node) + { + if (node.Type == JsonType.String) + { + return new Uri(node.ToString()); + } + + throw new ConversionException(node, typeof(Uri)); + } + + #endregion + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Nodes/JsonNumber.cs b/src/Security/Security.Autorest/generated/runtime/Nodes/JsonNumber.cs new file mode 100644 index 000000000000..14c0c4be9429 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Nodes/JsonNumber.cs @@ -0,0 +1,109 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json +{ + public sealed partial class JsonNumber : JsonNode + { + private readonly string value; + private readonly bool overflows = false; + + internal JsonNumber(string value) + { + this.value = value ?? throw new ArgumentNullException(nameof(value)); + } + + internal JsonNumber(int value) + { + this.value = value.ToString(); + } + + internal JsonNumber(long value) + { + this.value = value.ToString(); + + if (value > 9007199254740991) + { + overflows = true; + } + } + + internal JsonNumber(float value) + { + this.value = value.ToString(System.Globalization.CultureInfo.InvariantCulture); + } + + internal JsonNumber(double value) + { + this.value = value.ToString(System.Globalization.CultureInfo.InvariantCulture); + } + + internal override JsonType Type => JsonType.Number; + + internal string Value => value; + + #region Helpers + + internal bool Overflows => overflows; + + internal bool IsInteger => !value.Contains("."); + + internal bool IsFloat => value.Contains("."); + + #endregion + + #region Casting + + public static implicit operator byte(JsonNumber number) + => byte.Parse(number.Value); + + public static implicit operator short(JsonNumber number) + => short.Parse(number.Value); + + public static implicit operator int(JsonNumber number) + => int.Parse(number.Value); + + public static implicit operator long(JsonNumber number) + => long.Parse(number.value); + + public static implicit operator UInt16(JsonNumber number) + => ushort.Parse(number.Value); + + public static implicit operator UInt32(JsonNumber number) + => uint.Parse(number.Value); + + public static implicit operator UInt64(JsonNumber number) + => ulong.Parse(number.Value); + + public static implicit operator decimal(JsonNumber number) + => decimal.Parse(number.Value, System.Globalization.CultureInfo.InvariantCulture); + + public static implicit operator Double(JsonNumber number) + => double.Parse(number.value, System.Globalization.CultureInfo.InvariantCulture); + + public static implicit operator float(JsonNumber number) + => float.Parse(number.value, System.Globalization.CultureInfo.InvariantCulture); + + public static implicit operator JsonNumber(short data) + => new JsonNumber(data.ToString()); + + public static implicit operator JsonNumber(int data) + => new JsonNumber(data); + + public static implicit operator JsonNumber(long data) + => new JsonNumber(data); + + public static implicit operator JsonNumber(Single data) + => new JsonNumber(data.ToString()); + + public static implicit operator JsonNumber(double data) + => new JsonNumber(data.ToString()); + + #endregion + + public override string ToString() => value; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Nodes/JsonObject.cs b/src/Security/Security.Autorest/generated/runtime/Nodes/JsonObject.cs new file mode 100644 index 000000000000..aedc98e1ed8f --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Nodes/JsonObject.cs @@ -0,0 +1,172 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Generic; +using System.IO; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json +{ + public partial class JsonObject : JsonNode, IDictionary + { + private readonly Dictionary items; + + internal JsonObject() + { + items = new Dictionary(); + } + + internal JsonObject(IEnumerable> properties) + { + if (properties == null) throw new ArgumentNullException(nameof(properties)); + + items = new Dictionary(); + + foreach (var field in properties) + { + items.Add(field.Key, field.Value); + } + } + + #region IDictionary Constructors + + internal JsonObject(IDictionary dic) + { + items = new Dictionary(dic.Count); + + foreach (var pair in dic) + { + Add(pair.Key, pair.Value); + } + } + + #endregion + + internal override JsonType Type => JsonType.Object; + + #region Add Overloads + + public void Add(string name, JsonNode value) => + items.Add(name, value); + + public void Add(string name, byte[] value) => + items.Add(name, new XBinary(value)); + + public void Add(string name, DateTime value) => + items.Add(name, new JsonDate(value)); + + public void Add(string name, int value) => + items.Add(name, new JsonNumber(value.ToString())); + + public void Add(string name, long value) => + items.Add(name, new JsonNumber(value.ToString())); + + public void Add(string name, float value) => + items.Add(name, new JsonNumber(value.ToString())); + + public void Add(string name, double value) => + items.Add(name, new JsonNumber(value.ToString())); + + public void Add(string name, string value) => + items.Add(name, new JsonString(value)); + + public void Add(string name, bool value) => + items.Add(name, new JsonBoolean(value)); + + public void Add(string name, Uri url) => + items.Add(name, new JsonString(url.AbsoluteUri)); + + public void Add(string name, string[] values) => + items.Add(name, new XImmutableArray(values)); + + public void Add(string name, int[] values) => + items.Add(name, new XImmutableArray(values)); + + #endregion + + #region ICollection> Members + + void ICollection>.Add(KeyValuePair item) + { + items.Add(item.Key, item.Value); + } + + void ICollection>.Clear() + { + items.Clear(); + } + + bool ICollection>.Contains(KeyValuePair item) => + throw new NotImplementedException(); + + void ICollection>.CopyTo(KeyValuePair[] array, int arrayIndex) => + throw new NotImplementedException(); + + + int ICollection>.Count => items.Count; + + bool ICollection>.IsReadOnly => false; + + bool ICollection>.Remove(KeyValuePair item) => + throw new NotImplementedException(); + + #endregion + + #region IDictionary Members + + public bool ContainsKey(string key) => items.ContainsKey(key); + + public ICollection Keys => items.Keys; + + public bool Remove(string key) => items.Remove(key); + + public bool TryGetValue(string key, out JsonNode value) => + items.TryGetValue(key, out value); + + public ICollection Values => items.Values; + + public override JsonNode this[string key] + { + get => items[key]; + set => items[key] = value; + } + + #endregion + + #region IEnumerable + + IEnumerator> IEnumerable>.GetEnumerator() + => items.GetEnumerator(); + + IEnumerator IEnumerable.GetEnumerator() + => items.GetEnumerator(); + + #endregion + + #region Helpers + + internal static new JsonObject FromObject(object instance) => + (JsonObject)new JsonSerializer().Serialize(instance); + + #endregion + + #region Static Constructors + + internal static JsonObject FromStream(Stream stream) + { + using (var tr = new StreamReader(stream)) + { + return (JsonObject)Parse(tr); + } + } + + internal static new JsonObject Parse(string text) + { + return (JsonObject)JsonNode.Parse(text); + } + + #endregion + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Nodes/JsonString.cs b/src/Security/Security.Autorest/generated/runtime/Nodes/JsonString.cs new file mode 100644 index 000000000000..305eff6d495a --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Nodes/JsonString.cs @@ -0,0 +1,42 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json +{ + public sealed partial class JsonString : JsonNode, IEquatable + { + private readonly string value; + + internal JsonString(string value) + { + this.value = value ?? throw new ArgumentNullException(nameof(value)); + } + + internal override JsonType Type => JsonType.String; + + internal string Value => value; + + internal int Length => value.Length; + + #region #region Implicit Casts + + public static implicit operator string(JsonString data) => data.Value; + + public static implicit operator JsonString(string value) => new JsonString(value); + + #endregion + + public override int GetHashCode() => value.GetHashCode(); + + public override string ToString() => value; + + #region IEquatable + + bool IEquatable.Equals(JsonString other) => this.Value == other.Value; + + #endregion + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Nodes/XBinary.cs b/src/Security/Security.Autorest/generated/runtime/Nodes/XBinary.cs new file mode 100644 index 000000000000..31a0ee1fc3c1 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Nodes/XBinary.cs @@ -0,0 +1,40 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json +{ + internal sealed class XBinary : JsonNode + { + private readonly byte[] _value; + private readonly string _base64; + + internal XBinary(byte[] value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + internal XBinary(string base64EncodedString) + { + _base64 = base64EncodedString ?? throw new ArgumentNullException(nameof(base64EncodedString)); + } + + internal override JsonType Type => JsonType.Binary; + + internal byte[] Value => _value ?? Convert.FromBase64String(_base64); + + #region #region Implicit Casts + + public static implicit operator byte[] (XBinary data) => data.Value; + + public static implicit operator XBinary(byte[] data) => new XBinary(data); + + #endregion + + public override int GetHashCode() => Value.GetHashCode(); + + public override string ToString() => _base64 ?? Convert.ToBase64String(_value); + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Nodes/XNull.cs b/src/Security/Security.Autorest/generated/runtime/Nodes/XNull.cs new file mode 100644 index 000000000000..617dcb30f0d4 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Nodes/XNull.cs @@ -0,0 +1,15 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json +{ + internal sealed class XNull : JsonNode + { + internal static readonly XNull Instance = new XNull(); + + private XNull() { } + + internal override JsonType Type => JsonType.Null; + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Parser/Exceptions/ParseException.cs b/src/Security/Security.Autorest/generated/runtime/Parser/Exceptions/ParseException.cs new file mode 100644 index 000000000000..9e33bbb80481 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Parser/Exceptions/ParseException.cs @@ -0,0 +1,24 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json +{ + internal class ParserException : Exception + { + internal ParserException(string message) + : base(message) + { } + + internal ParserException(string message, SourceLocation location) + : base(message) + { + + Location = location; + } + + internal SourceLocation Location { get; } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Parser/JsonParser.cs b/src/Security/Security.Autorest/generated/runtime/Parser/JsonParser.cs new file mode 100644 index 000000000000..1b2464d4a7b1 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Parser/JsonParser.cs @@ -0,0 +1,180 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.IO; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json +{ + public class JsonParser : IDisposable + { + private readonly TokenReader reader; + + internal JsonParser(TextReader reader) + : this(new SourceReader(reader)) { } + + internal JsonParser(SourceReader sourceReader) + { + if (sourceReader == null) + throw new ArgumentNullException(nameof(sourceReader)); + + this.reader = new TokenReader(new JsonTokenizer(sourceReader)); + + this.reader.Next(); // Start with the first token + } + + internal IEnumerable ReadNodes() + { + JsonNode node; + + while ((node = ReadNode()) != null) yield return node; + } + + internal JsonNode ReadNode() + { + if (reader.Current.Kind == TokenKind.Eof || reader.Current.IsTerminator) + { + return null; + } + + switch (reader.Current.Kind) + { + case TokenKind.LeftBrace : return ReadObject(); // { + case TokenKind.LeftBracket : return ReadArray(); // [ + + default: throw new ParserException($"Expected '{{' or '['. Was {reader.Current}."); + } + } + + private JsonNode ReadFieldValue() + { + // Boolean, Date, Null, Number, String, Uri + if (reader.Current.IsLiteral) + { + return ReadLiteral(); + } + else + { + switch (reader.Current.Kind) + { + case TokenKind.LeftBracket: return ReadArray(); + case TokenKind.LeftBrace : return ReadObject(); + + default: throw new ParserException($"Unexpected token reading field value. Was {reader.Current}."); + } + } + } + + private JsonNode ReadLiteral() + { + var literal = reader.Current; + + reader.Next(); // Read the literal token + + switch (literal.Kind) + { + case TokenKind.Boolean : return JsonBoolean.Parse(literal.Value); + case TokenKind.Null : return XNull.Instance; + case TokenKind.Number : return new JsonNumber(literal.Value); + case TokenKind.String : return new JsonString(literal.Value); + + default: throw new ParserException($"Unexpected token reading literal. Was {literal}."); + } + } + + internal JsonObject ReadObject() + { + reader.Ensure(TokenKind.LeftBrace, "object"); + + reader.Next(); // Read '{' (Object start) + + var jsonObject = new JsonObject(); + + // Read the object's fields until we reach the end of the object ('}') + while (reader.Current.Kind != TokenKind.RightBrace) + { + if (reader.Current.Kind == TokenKind.Comma) + { + reader.Next(); // Read ',' (Seperator) + } + + // Ensure we have a field name + reader.Ensure(TokenKind.String, "Expected field name"); + + var field = ReadField(); + + jsonObject.Add(field.Key, field.Value); + } + + reader.Next(); // Read '}' (Object end) + + return jsonObject; + } + + + // TODO: Use ValueTuple in C#7 + private KeyValuePair ReadField() + { + var fieldName = reader.Current.Value; + + reader.Next(); // Read the field name + + reader.Ensure(TokenKind.Colon, "field"); + + reader.Next(); // Read ':' (Field value indicator) + + return new KeyValuePair(fieldName, ReadFieldValue()); + } + + + internal JsonArray ReadArray() + { + reader.Ensure(TokenKind.LeftBracket, "array"); + + var array = new XNodeArray(); + + reader.Next(); // Read the '[' (Array start) + + // Read the array's items + while (reader.Current.Kind != TokenKind.RightBracket) + { + if (reader.Current.Kind == TokenKind.Comma) + { + reader.Next(); // Read the ',' (Seperator) + } + + if (reader.Current.IsLiteral) + { + array.Add(ReadLiteral()); // Boolean, Date, Number, Null, String, Uri + } + else if (reader.Current.Kind == TokenKind.LeftBracket) + { + array.Add(ReadArray()); // Array + } + else if (reader.Current.Kind == TokenKind.LeftBrace) + { + array.Add(ReadObject()); // Object + } + else + { + throw new ParserException($"Expected comma, literal, or object. Was {reader.Current}."); + } + } + + reader.Next(); // Read the ']' (Array end) + + return array; + } + + #region IDisposable + + public void Dispose() + { + reader.Dispose(); + } + + #endregion + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Parser/JsonToken.cs b/src/Security/Security.Autorest/generated/runtime/Parser/JsonToken.cs new file mode 100644 index 000000000000..e7f947bcc58a --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Parser/JsonToken.cs @@ -0,0 +1,66 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json +{ + internal enum TokenKind + { + LeftBrace, // { Object start + RightBrace, // } Object end + + LeftBracket, // [ Array start + RightBracket, // ] Array end + + Comma, // , Comma + Colon, // : Value indicator + Dot, // . Access field indicator + Terminator, // \0 Stream terminator + + Boolean = 31, // true or false + Null = 33, // null + Number = 34, // i.e. -1.93, -1, 0, 1, 1.1 + String = 35, // i.e. "text" + + Eof = 50 + } + + internal /* readonly */ struct JsonToken + { + internal static readonly JsonToken BraceOpen = new JsonToken(TokenKind.LeftBrace, "{"); + internal static readonly JsonToken BraceClose = new JsonToken(TokenKind.RightBrace, "}"); + + internal static readonly JsonToken BracketOpen = new JsonToken(TokenKind.LeftBracket, "["); + internal static readonly JsonToken BracketClose = new JsonToken(TokenKind.RightBracket, "]"); + + internal static readonly JsonToken Colon = new JsonToken(TokenKind.Colon, ":"); + internal static readonly JsonToken Comma = new JsonToken(TokenKind.Comma, ","); + internal static readonly JsonToken Terminator = new JsonToken(TokenKind.Terminator, "\0"); + + internal static readonly JsonToken True = new JsonToken(TokenKind.Boolean, "true"); + internal static readonly JsonToken False = new JsonToken(TokenKind.Boolean, "false"); + internal static readonly JsonToken Null = new JsonToken(TokenKind.Null, "null"); + + internal static readonly JsonToken Eof = new JsonToken(TokenKind.Eof, null); + + internal JsonToken(TokenKind kind, string value) + { + Kind = kind; + Value = value; + } + + internal readonly TokenKind Kind; + + internal readonly string Value; + + public override string ToString() => Kind + ": " + Value; + + #region Helpers + + internal bool IsLiteral => (byte)Kind > 30 && (byte)Kind < 40; + + internal bool IsTerminator => Kind == TokenKind.Terminator; + + #endregion + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Parser/JsonTokenizer.cs b/src/Security/Security.Autorest/generated/runtime/Parser/JsonTokenizer.cs new file mode 100644 index 000000000000..464bc262e200 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Parser/JsonTokenizer.cs @@ -0,0 +1,177 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Text; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json +{ + using System.IO; + + + public class JsonTokenizer : IDisposable + { + private readonly StringBuilder sb = new StringBuilder(); + + private readonly SourceReader reader; + + internal JsonTokenizer(TextReader reader) + : this(new SourceReader(reader)) { } + + internal JsonTokenizer(SourceReader reader) + { + this.reader = reader; + + reader.Next(); // Start with the first char + } + + internal JsonToken ReadNext() + { + reader.SkipWhitespace(); + + if (reader.IsEof) return JsonToken.Eof; + + switch (reader.Current) + { + case '"': return ReadQuotedString(); + + // Symbols + case '[' : reader.Next(); return JsonToken.BracketOpen; // Array start + case ']' : reader.Next(); return JsonToken.BracketClose; // Array end + case ',' : reader.Next(); return JsonToken.Comma; // Value seperator + case ':' : reader.Next(); return JsonToken.Colon; // Field value indicator + case '{' : reader.Next(); return JsonToken.BraceOpen; // Object start + case '}' : reader.Next(); return JsonToken.BraceClose; // Object end + case '\0' : reader.Next(); return JsonToken.Terminator; // Stream terminiator + + default: return ReadLiteral(); + } + } + + private JsonToken ReadQuotedString() + { + Expect('"', "quoted string indicator"); + + reader.Next(); // Read '"' (Starting quote) + + // Read until we reach an unescaped quote char + while (reader.Current != '"') + { + EnsureNotEof("quoted string"); + + if (reader.Current == '\\') + { + char escapedCharacter = reader.ReadEscapeCode(); + + sb.Append(escapedCharacter); + + continue; + } + + StoreCurrentCharacterAndReadNext(); + } + + reader.Next(); // Read '"' (Ending quote) + + return new JsonToken(TokenKind.String, value: sb.Extract()); + } + + private JsonToken ReadLiteral() + { + if (char.IsDigit(reader.Current) || + reader.Current == '-' || + reader.Current == '+') + { + return ReadNumber(); + } + + return ReadIdentifer(); + } + + private JsonToken ReadNumber() + { + // Read until we hit a non-numeric character + // -6.247737e-06 + // E + + while (char.IsDigit(reader.Current) + || reader.Current == '.' + || reader.Current == 'e' + || reader.Current == 'E' + || reader.Current == '-' + || reader.Current == '+') + { + StoreCurrentCharacterAndReadNext(); + } + + return new JsonToken(TokenKind.Number, value: sb.Extract()); + } + + int count = 0; + + private JsonToken ReadIdentifer() + { + count++; + + if (!char.IsLetter(reader.Current)) + { + throw new ParserException( + message : $"Expected literal (number, boolean, or null). Was '{reader.Current}'.", + location : reader.Location + ); + } + + // Read letters, numbers, and underscores '_' + while (char.IsLetterOrDigit(reader.Current) || reader.Current == '_') + { + StoreCurrentCharacterAndReadNext(); + } + + string text = sb.Extract(); + + switch (text) + { + case "true": return JsonToken.True; + case "false": return JsonToken.False; + case "null": return JsonToken.Null; + + default: return new JsonToken(TokenKind.String, text); + } + } + + private void Expect(char character, string description) + { + if (reader.Current != character) + { + throw new ParserException( + message: $"Expected {description} ('{character}'). Was '{reader.Current}'.", + location: reader.Location + ); + } + } + + private void EnsureNotEof(string tokenType) + { + if (reader.IsEof) + { + throw new ParserException( + message: $"Unexpected EOF while reading {tokenType}.", + location: reader.Location + ); + } + } + + private void StoreCurrentCharacterAndReadNext() + { + sb.Append(reader.Current); + + reader.Next(); + } + + public void Dispose() + { + reader.Dispose(); + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Parser/Location.cs b/src/Security/Security.Autorest/generated/runtime/Parser/Location.cs new file mode 100644 index 000000000000..5a9f9081a4f2 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Parser/Location.cs @@ -0,0 +1,43 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json +{ + internal struct SourceLocation + { + private int line; + private int column; + private int position; + + internal SourceLocation(int line = 0, int column = 0, int position = 0) + { + this.line = line; + this.column = column; + this.position = position; + } + + internal int Line => line; + + internal int Column => column; + + internal int Position => position; + + internal void Advance() + { + this.column++; + this.position++; + } + + internal void MarkNewLine() + { + this.line++; + this.column = 0; + } + + internal SourceLocation Clone() + { + return new SourceLocation(line, column, position); + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Parser/Readers/SourceReader.cs b/src/Security/Security.Autorest/generated/runtime/Parser/Readers/SourceReader.cs new file mode 100644 index 000000000000..57b6c1949de8 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Parser/Readers/SourceReader.cs @@ -0,0 +1,130 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Globalization; +using System.IO; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json +{ + public sealed class SourceReader : IDisposable + { + private readonly TextReader source; + + private char current; + + private readonly SourceLocation location = new SourceLocation(); + + private bool isEof = false; + + internal SourceReader(TextReader textReader) + { + this.source = textReader ?? throw new ArgumentNullException(nameof(textReader)); + } + + /// + /// Advances to the next character + /// + internal void Next() + { + // Advance to the new line when we see a new line '\n'. + // A new line may be prefixed by a carriage return '\r'. + + if (current == '\n') + { + location.MarkNewLine(); + } + + int charCode = source.Read(); // -1 for end + + if (charCode >= 0) + { + current = (char)charCode; + } + else + { + // If we've already marked this as the EOF, throw an exception + if (isEof) + { + throw new EndOfStreamException("Cannot advance past end of stream."); + } + + isEof = true; + + current = '\0'; + } + + location.Advance(); + } + + internal void SkipWhitespace() + { + while (char.IsWhiteSpace(current)) + { + Next(); + } + } + + internal char ReadEscapeCode() + { + Next(); + + char escapedChar = current; + + Next(); // Consume escaped character + + switch (escapedChar) + { + // Special escape codes + case '"': return '"'; // " (Quotation mark) U+0022 + case '/': return '/'; // / (Solidus) U+002F + case '\\': return '\\'; // \ (Reverse solidus) U+005C + + // Control Characters + case '0': return '\0'; // Nul (0) U+0000 + case 'a': return '\a'; // Alert (7) + case 'b': return '\b'; // Backspace (8) U+0008 + case 'f': return '\f'; // Form feed (12) U+000C + case 'n': return '\n'; // Line feed (10) U+000A + case 'r': return '\r'; // Carriage return (13) U+000D + case 't': return '\t'; // Horizontal tab (9) U+0009 + case 'v': return '\v'; // Vertical tab + + // Unicode escape sequence + case 'u': return ReadUnicodeEscapeSequence(); // U+XXXX + + default: throw new Exception($"Unrecognized escape sequence '\\{escapedChar}'"); + } + } + + private readonly char[] hexCode = new char[4]; + + private char ReadUnicodeEscapeSequence() + { + hexCode[0] = current; Next(); + hexCode[1] = current; Next(); + hexCode[2] = current; Next(); + hexCode[3] = current; Next(); + + return Convert.ToChar(int.Parse( + s : new string(hexCode), + style : NumberStyles.HexNumber, + provider: NumberFormatInfo.InvariantInfo + )); + } + + internal char Current => current; + + internal bool IsEof => isEof; + + internal char Peek() => (char)source.Peek(); + + internal SourceLocation Location => location; + + public void Dispose() + { + source.Dispose(); + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Parser/TokenReader.cs b/src/Security/Security.Autorest/generated/runtime/Parser/TokenReader.cs new file mode 100644 index 000000000000..79a864e3925c --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Parser/TokenReader.cs @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json +{ + public class TokenReader : IDisposable + { + private readonly JsonTokenizer tokenizer; + private JsonToken current; + + internal TokenReader(JsonTokenizer tokenizer) + { + this.tokenizer = tokenizer ?? throw new ArgumentNullException(nameof(tokenizer)); + } + + internal void Next() + { + current = tokenizer.ReadNext(); + } + + internal JsonToken Current => current; + + internal void Ensure(TokenKind kind, string readerName) + { + if (current.Kind != kind) + { + throw new ParserException($"Expected {kind} while reading {readerName}). Was {current}."); + } + } + + public void Dispose() + { + tokenizer.Dispose(); + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/PipelineMocking.cs b/src/Security/Security.Autorest/generated/runtime/PipelineMocking.cs new file mode 100644 index 000000000000..dd64e24b1d87 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/PipelineMocking.cs @@ -0,0 +1,262 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime +{ + using System.Threading.Tasks; + using System.Collections.Generic; + using System.Net.Http; + using System.Linq; + using System.Net; + using Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json; + + public enum MockMode + { + Live, + Record, + Playback, + + } + + public class PipelineMock + { + + private System.Collections.Generic.Stack scenario = new System.Collections.Generic.Stack(); + private System.Collections.Generic.Stack context = new System.Collections.Generic.Stack(); + private System.Collections.Generic.Stack description = new System.Collections.Generic.Stack(); + + private readonly string recordingPath; + private int counter = 0; + + public static implicit operator Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.SendAsyncStep(PipelineMock instance) => instance.SendAsync; + + public MockMode Mode { get; set; } = MockMode.Live; + public PipelineMock(string recordingPath) + { + this.recordingPath = recordingPath; + } + + public void PushContext(string text) => context.Push(text); + + public void PushDescription(string text) => description.Push(text); + + + public void PushScenario(string it) + { + // reset counter too + counter = 0; + + scenario.Push(it); + } + + public void PopContext() => context.Pop(); + + public void PopDescription() => description.Pop(); + + public void PopScenario() => scenario.Pop(); + + public void SetRecord() => Mode = MockMode.Record; + + public void SetPlayback() => Mode = MockMode.Playback; + + public void SetLive() => Mode = MockMode.Live; + + public string Scenario => (scenario.Count > 0 ? scenario.Peek() : "[NoScenario]"); + public string Description => (description.Count > 0 ? description.Peek() : "[NoDescription]"); + public string Context => (context.Count > 0 ? context.Peek() : "[NoContext]"); + + /// + /// Headers that we substitute out blank values for in the recordings + /// Add additional headers as necessary + /// + public static HashSet Blacklist = new HashSet(System.StringComparer.CurrentCultureIgnoreCase) { + "Authorization", + }; + + public Dictionary ForceResponseHeaders = new Dictionary(); + + internal static XImmutableArray Removed = new XImmutableArray(new string[] { "[Filtered]" }); + + internal static IEnumerable> FilterHeaders(IEnumerable>> headers) => headers.Select(header => new KeyValuePair(header.Key, Blacklist.Contains(header.Key) ? Removed : new XImmutableArray(header.Value.ToArray()))); + + internal static JsonNode SerializeContent(HttpContent content, ref bool isBase64) => content == null ? XNull.Instance : SerializeContent(content.ReadAsByteArrayAsync().Result, ref isBase64); + + internal static JsonNode SerializeContent(byte[] content, ref bool isBase64) + { + if (null == content || content.Length == 0) + { + return XNull.Instance; + } + var first = content[0]; + var last = content[content.Length - 1]; + + // plaintext for JSON/SGML/XML/HTML/STRINGS/ARRAYS + if ((first == '{' && last == '}') || (first == '<' && last == '>') || (first == '[' && last == ']') || (first == '"' && last == '"')) + { + return new JsonString(System.Text.Encoding.UTF8.GetString(content)); + } + + // base64 for everyone else + return new JsonString(System.Convert.ToBase64String(content)); + } + + internal static byte[] DeserializeContent(string content, bool isBase64) + { + if (string.IsNullOrWhiteSpace(content)) + { + return new byte[0]; + } + + if (isBase64) + { + try + { + return System.Convert.FromBase64String(content); + } + catch + { + // hmm. didn't work, return it as a string I guess. + } + } + return System.Text.Encoding.UTF8.GetBytes(content); + } + + public void SaveMessage(string rqKey, HttpRequestMessage request, HttpResponseMessage response) + { + var messages = System.IO.File.Exists(this.recordingPath) ? Load() : new JsonObject() ?? new JsonObject(); + bool isBase64Request = false; + bool isBase64Response = false; + messages[rqKey] = new JsonObject { + { "Request",new JsonObject { + { "Method", request.Method.Method }, + { "RequestUri", request.RequestUri }, + { "Content", SerializeContent( request.Content, ref isBase64Request) }, + { "isContentBase64", isBase64Request }, + { "Headers", new JsonObject(FilterHeaders(request.Headers)) }, + { "ContentHeaders", request.Content == null ? new JsonObject() : new JsonObject(FilterHeaders(request.Content.Headers))} + } }, + {"Response", new JsonObject { + { "StatusCode", (int)response.StatusCode}, + { "Headers", new JsonObject(FilterHeaders(response.Headers))}, + { "ContentHeaders", new JsonObject(FilterHeaders(response.Content.Headers))}, + { "Content", SerializeContent(response.Content, ref isBase64Response) }, + { "isContentBase64", isBase64Response }, + }} + }; + System.IO.File.WriteAllText(this.recordingPath, messages.ToString()); + } + + private JsonObject Load() + { + if (System.IO.File.Exists(this.recordingPath)) + { + try + { + return JsonObject.FromStream(System.IO.File.OpenRead(this.recordingPath)); + } + catch + { + throw new System.Exception($"Invalid recording file: '{recordingPath}'"); + } + } + + throw new System.ArgumentException($"Missing recording file: '{recordingPath}'", nameof(recordingPath)); + } + + public HttpResponseMessage LoadMessage(string rqKey) + { + var responses = Load(); + var message = responses.Property(rqKey); + + if (null == message) + { + throw new System.ArgumentException($"Missing Request '{rqKey}' in recording file", nameof(rqKey)); + } + + var sc = 0; + var reqMessage = message.Property("Request"); + var respMessage = message.Property("Response"); + + // --------------------------- deserialize response ---------------------------------------------------------------- + bool isBase64Response = false; + respMessage.BooleanProperty("isContentBase64", ref isBase64Response); + var response = new HttpResponseMessage + { + StatusCode = (HttpStatusCode)respMessage.NumberProperty("StatusCode", ref sc), + Content = new System.Net.Http.ByteArrayContent(DeserializeContent(respMessage.StringProperty("Content"), isBase64Response)) + }; + + foreach (var each in respMessage.Property("Headers")) + { + response.Headers.TryAddWithoutValidation(each.Key, each.Value.ToArrayOf()); + } + + foreach (var frh in ForceResponseHeaders) + { + response.Headers.Remove(frh.Key); + response.Headers.TryAddWithoutValidation(frh.Key, frh.Value); + } + + foreach (var each in respMessage.Property("ContentHeaders")) + { + response.Content.Headers.TryAddWithoutValidation(each.Key, each.Value.ToArrayOf()); + } + + // --------------------------- deserialize request ---------------------------------------------------------------- + bool isBase64Request = false; + reqMessage.BooleanProperty("isContentBase64", ref isBase64Request); + response.RequestMessage = new HttpRequestMessage + { + Method = new HttpMethod(reqMessage.StringProperty("Method")), + RequestUri = new System.Uri(reqMessage.StringProperty("RequestUri")), + Content = new System.Net.Http.ByteArrayContent(DeserializeContent(reqMessage.StringProperty("Content"), isBase64Request)) + }; + + foreach (var each in reqMessage.Property("Headers")) + { + response.RequestMessage.Headers.TryAddWithoutValidation(each.Key, each.Value.ToArrayOf()); + } + foreach (var each in reqMessage.Property("ContentHeaders")) + { + response.RequestMessage.Content.Headers.TryAddWithoutValidation(each.Key, each.Value.ToArrayOf()); + } + + return response; + } + + public async Task SendAsync(HttpRequestMessage request, IEventListener callback, ISendAsync next) + { + counter++; + var rqkey = $"{Description}+{Context}+{Scenario}+${request.Method.Method}+{request.RequestUri}+{counter}"; + + switch (Mode) + { + case MockMode.Record: + //Add following code since the request.Content will be released after sendAsync + var requestClone = request; + if (requestClone.Content != null) + { + requestClone = await request.CloneWithContent(request.RequestUri, request.Method); + } + // make the call + var response = await next.SendAsync(request, callback); + + // save the message to the recording file + SaveMessage(rqkey, requestClone, response); + + // return the response. + return response; + + case MockMode.Playback: + // load and return the response. + return LoadMessage(rqkey); + + default: + // pass-thru, do nothing + return await next.SendAsync(request, callback); + } + } + } +} diff --git a/src/Security/Security.Autorest/generated/runtime/Properties/Resources.Designer.cs b/src/Security/Security.Autorest/generated/runtime/Properties/Resources.Designer.cs new file mode 100644 index 000000000000..31bb3fc5feeb --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Properties/Resources.Designer.cs @@ -0,0 +1,5655 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.generated.runtime.Properties +{ + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + public class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + public static global::System.Resources.ResourceManager ResourceManager + { + get + { + if (object.ReferenceEquals(resourceMan, null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.Azure.PowerShell.Cmdlets.Security.generated.runtime.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + public static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to The remote server returned an error: (401) Unauthorized.. + /// + public static string AccessDeniedExceptionMessage + { + get + { + return ResourceManager.GetString("AccessDeniedExceptionMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Account id doesn't match one in subscription.. + /// + public static string AccountIdDoesntMatchSubscription + { + get + { + return ResourceManager.GetString("AccountIdDoesntMatchSubscription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Account needs to be specified. + /// + public static string AccountNeedsToBeSpecified + { + get + { + return ResourceManager.GetString("AccountNeedsToBeSpecified", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Account "{0}" has been added.. + /// + public static string AddAccountAdded + { + get + { + return ResourceManager.GetString("AddAccountAdded", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to To switch to a different subscription, please use Select-AzureSubscription.. + /// + public static string AddAccountChangeSubscription + { + get + { + return ResourceManager.GetString("AddAccountChangeSubscription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Skipping external tenant {0}, because you are using a guest or a foreign principal object identity. In order to access this tenant, please run Add-AzureAccount without "-Credential".. + /// + public static string AddAccountNonInteractiveGuestOrFpo + { + get + { + return ResourceManager.GetString("AddAccountNonInteractiveGuestOrFpo", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Subscription "{0}" is selected as the default subscription.. + /// + public static string AddAccountShowDefaultSubscription + { + get + { + return ResourceManager.GetString("AddAccountShowDefaultSubscription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to To view all the subscriptions, please use Get-AzureSubscription.. + /// + public static string AddAccountViewSubscriptions + { + get + { + return ResourceManager.GetString("AddAccountViewSubscriptions", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Add-On {0} is created successfully.. + /// + public static string AddOnCreatedMessage + { + get + { + return ResourceManager.GetString("AddOnCreatedMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Add-on name {0} is already used.. + /// + public static string AddOnNameAlreadyUsed + { + get + { + return ResourceManager.GetString("AddOnNameAlreadyUsed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Add-On {0} not found.. + /// + public static string AddOnNotFound + { + get + { + return ResourceManager.GetString("AddOnNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Add-on {0} is removed successfully.. + /// + public static string AddOnRemovedMessage + { + get + { + return ResourceManager.GetString("AddOnRemovedMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Add-On {0} is updated successfully.. + /// + public static string AddOnUpdatedMessage + { + get + { + return ResourceManager.GetString("AddOnUpdatedMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Role has been created at {0}\{1}.. + /// + public static string AddRoleMessageCreate + { + get + { + return ResourceManager.GetString("AddRoleMessageCreate", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Role has been created at {0}\{1}. For easy access to Microsoft Azure services from your application code, install the Microsoft Azure client library for Node.js by running ‘npm install azure’.. + /// + public static string AddRoleMessageCreateNode + { + get + { + return ResourceManager.GetString("AddRoleMessageCreateNode", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Role has been created at {0}\{1}. For easy access to Microsoft Azure services from your application code, install the Microsoft Azure client library for PHP by running "pear WindowsAzure/WindowsAzure".. + /// + public static string AddRoleMessageCreatePHP + { + get + { + return ResourceManager.GetString("AddRoleMessageCreatePHP", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Unable to set role permissions. Please give the 'Network Service' user 'Read & execute' and 'Modify' permissions to the role folder, or run PowerShell as an Administrator. + /// + public static string AddRoleMessageInsufficientPermissions + { + get + { + return ResourceManager.GetString("AddRoleMessageInsufficientPermissions", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to A role name '{0}' already exists. + /// + public static string AddRoleMessageRoleExists + { + get + { + return ResourceManager.GetString("AddRoleMessageRoleExists", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Profile {0} already has an endpoint with name {1}. + /// + public static string AddTrafficManagerEndpointFailed + { + get + { + return ResourceManager.GetString("AddTrafficManagerEndpointFailed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Azure PowerShell collects usage data in order to improve your experience. + ///The data is anonymous and does not include commandline argument values. + ///The data is collected by Microsoft. + /// + ///Use the Disable-AzDataCollection cmdlet to turn the feature Off. The cmdlet can be found in the Az.Accounts module. To disable data collection: PS > Disable-AzDataCollection. + ///Use the Enable-AzDataCollection cmdlet to turn the feature On. The cmdlet can be found in the Az.Accounts module. To enable [rest of string was truncated]";. + /// + public static string ARMDataCollectionMessage + { + get + { + return ResourceManager.GetString("ARMDataCollectionMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [Common.Authentication]: Authenticating for account {0} with single tenant {1}.. + /// + public static string AuthenticatingForSingleTenant + { + get + { + return ResourceManager.GetString("AuthenticatingForSingleTenant", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Windows Azure Powershell\. + /// + public static string AzureDirectory + { + get + { + return ResourceManager.GetString("AzureDirectory", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to https://manage.windowsazure.com. + /// + public static string AzurePortalUrl + { + get + { + return ResourceManager.GetString("AzurePortalUrl", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to AZURE_PORTAL_URL. + /// + public static string AzurePortalUrlEnv + { + get + { + return ResourceManager.GetString("AzurePortalUrlEnv", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Selected profile must not be null.. + /// + public static string AzureProfileMustNotBeNull + { + get + { + return ResourceManager.GetString("AzureProfileMustNotBeNull", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Azure SDK\{0}\. + /// + public static string AzureSdkDirectory + { + get + { + return ResourceManager.GetString("AzureSdkDirectory", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to File '{0}' already exists. Use the -Force parameter to overwrite it.. + /// + public static string AzureVMDscArchiveAlreadyExists + { + get + { + return ResourceManager.GetString("AzureVMDscArchiveAlreadyExists", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot find configuration data file: {0}. + /// + public static string AzureVMDscCannotFindConfigurationDataFile + { + get + { + return ResourceManager.GetString("AzureVMDscCannotFindConfigurationDataFile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Create Archive. + /// + public static string AzureVMDscCreateArchiveAction + { + get + { + return ResourceManager.GetString("AzureVMDscCreateArchiveAction", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The configuration data must be a .psd1 file. + /// + public static string AzureVMDscInvalidConfigurationDataFile + { + get + { + return ResourceManager.GetString("AzureVMDscInvalidConfigurationDataFile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Parsing configuration script: {0}. + /// + public static string AzureVMDscParsingConfiguration + { + get + { + return ResourceManager.GetString("AzureVMDscParsingConfiguration", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Storage Blob '{0}' already exists. Use the -Force parameter to overwrite it.. + /// + public static string AzureVMDscStorageBlobAlreadyExists + { + get + { + return ResourceManager.GetString("AzureVMDscStorageBlobAlreadyExists", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Upload '{0}'. + /// + public static string AzureVMDscUploadToBlobStorageAction + { + get + { + return ResourceManager.GetString("AzureVMDscUploadToBlobStorageAction", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Execution failed because a background thread could not prompt the user.. + /// + public static string BaseShouldMethodFailureReason + { + get + { + return ResourceManager.GetString("BaseShouldMethodFailureReason", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Base Uri was empty.. + /// + public static string BaseUriEmpty + { + get + { + return ResourceManager.GetString("BaseUriEmpty", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} begin processing without ParameterSet.. + /// + public static string BeginProcessingWithoutParameterSetLog + { + get + { + return ResourceManager.GetString("BeginProcessingWithoutParameterSetLog", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} begin processing with ParameterSet '{1}'.. + /// + public static string BeginProcessingWithParameterSetLog + { + get + { + return ResourceManager.GetString("BeginProcessingWithParameterSetLog", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Blob with the name {0} already exists in the account.. + /// + public static string BlobAlreadyExistsInTheAccount + { + get + { + return ResourceManager.GetString("BlobAlreadyExistsInTheAccount", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to https://{0}.blob.core.windows.net/. + /// + public static string BlobEndpointUri + { + get + { + return ResourceManager.GetString("BlobEndpointUri", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to AZURE_BLOBSTORAGE_TEMPLATE. + /// + public static string BlobEndpointUriEnv + { + get + { + return ResourceManager.GetString("BlobEndpointUriEnv", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The parameter : '{0}' is changing.. + /// + public static string BreakingChangeAttributeParameterChanging + { + get + { + return ResourceManager.GetString("BreakingChangeAttributeParameterChanging", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The parameter : '{0}' is becoming mandatory.. + /// + public static string BreakingChangeAttributeParameterMandatoryNow + { + get + { + return ResourceManager.GetString("BreakingChangeAttributeParameterMandatoryNow", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The parameter : '{0}' is being replaced by parameter : '{1}'.. + /// + public static string BreakingChangeAttributeParameterReplaced + { + get + { + return ResourceManager.GetString("BreakingChangeAttributeParameterReplaced", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The parameter : '{0}' is being replaced by mandatory parameter : '{1}'.. + /// + public static string BreakingChangeAttributeParameterReplacedMandatory + { + get + { + return ResourceManager.GetString("BreakingChangeAttributeParameterReplacedMandatory", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The type of the parameter is changing from '{0}' to '{1}'.. + /// + public static string BreakingChangeAttributeParameterTypeChange + { + get + { + return ResourceManager.GetString("BreakingChangeAttributeParameterTypeChange", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Change description : {0} + ///. + /// + public static string BreakingChangesAttributesChangeDescriptionMessage + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesChangeDescriptionMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The cmdlet is being deprecated. There will be no replacement for it.. + /// + public static string BreakingChangesAttributesCmdLetDeprecationMessageNoReplacement + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesCmdLetDeprecationMessageNoReplacement", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The cmdlet is being deprecated. There will be no replacement for it.. + /// + public static string BreakingChangesAttributesParameterSetDeprecationMessageNoReplacement + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesParameterSetDeprecationMessageNoReplacement", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The cmdlet '{0}' is replacing this cmdlet.. + /// + public static string BreakingChangesAttributesCmdLetDeprecationMessageWithReplacement + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesCmdLetDeprecationMessageWithReplacement", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The output type is changing from the existing type :'{0}' to the new type :'{1}'. + /// + public static string BreakingChangesAttributesCmdLetOutputChange1 + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesCmdLetOutputChange1", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to "The output type '{0}' is changing". + /// + public static string BreakingChangesAttributesCmdLetOutputChange2 + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesCmdLetOutputChange2", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to + ///- The following properties are being added to the output type : + ///. + /// + public static string BreakingChangesAttributesCmdLetOutputPropertiesAdded + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesCmdLetOutputPropertiesAdded", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to + /// - The following properties in the output type are being deprecated : + ///. + /// + public static string BreakingChangesAttributesCmdLetOutputPropertiesRemoved + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesCmdLetOutputPropertiesRemoved", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The output type '{0}' is being deprecated without a replacement.. + /// + public static string BreakingChangesAttributesCmdLetOutputTypeDeprecated + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesCmdLetOutputTypeDeprecated", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to - {0} + /// + ///. + /// + public static string BreakingChangesAttributesDeclarationMessage + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesDeclarationMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to - Cmdlet : '{0}' + /// - {1} + ///. + /// + public static string BreakingChangesAttributesDeclarationMessageWithCmdletName + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesDeclarationMessageWithCmdletName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to NOTE : Go to {0} for steps to suppress (and other related information on) the breaking change messages.. + /// + public static string BreakingChangesAttributesFooterMessage + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesFooterMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Breaking changes in the cmdlet '{0}' :. + /// + public static string BreakingChangesAttributesHeaderMessage + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesHeaderMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Note : This change will take effect on '{0}' + ///. + /// + public static string BreakingChangesAttributesInEffectByDateMessage + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesInEffectByDateMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Note :The change is expected to take effect from version : '{0}' + /// + ///. + /// + public static string BreakingChangesAttributesInEffectByVersion + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesInEffectByVersion", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Note :The change is expected to take effect from az version : '{0}' + /// + ///. + /// + public static string BreakingChangesAttributesInEffectByAzVersion + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesInEffectByAzVersion", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ```powershell + ///# Old + ///{0} + /// + ///# New + ///{1} + ///``` + /// + ///. + /// + public static string BreakingChangesAttributesUsageChangeMessage + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesUsageChangeMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cmdlet invocation changes : + /// Old Way : {0} + /// New Way : {1}. + /// + public static string BreakingChangesAttributesUsageChangeMessageConsole + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesUsageChangeMessageConsole", resourceCulture); + } + } + + /// + /// The cmdlet is in experimental stage. The function may not be enabled in current subscription. + /// + public static string ExperimentalCmdletMessage + { + get + { + return ResourceManager.GetString("ExperimentalCmdletMessage", resourceCulture); + } + } + + + + /// + /// Looks up a localized string similar to CACHERUNTIMEURL. + /// + public static string CacheRuntimeUrl + { + get + { + return ResourceManager.GetString("CacheRuntimeUrl", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to cache. + /// + public static string CacheRuntimeValue + { + get + { + return ResourceManager.GetString("CacheRuntimeValue", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to CacheRuntimeVersion. + /// + public static string CacheRuntimeVersionKey + { + get + { + return ResourceManager.GetString("CacheRuntimeVersionKey", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Installing caching version {0} for Role '{1}' (the caching version locally installed is: {2}). + /// + public static string CacheVersionWarningText + { + get + { + return ResourceManager.GetString("CacheVersionWarningText", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot change built-in environment {0}.. + /// + public static string CannotChangeBuiltinEnvironment + { + get + { + return ResourceManager.GetString("CannotChangeBuiltinEnvironment", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot find {0} with name {1}.. + /// + public static string CannotFind + { + get + { + return ResourceManager.GetString("CannotFind", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Deployment for service {0} with {1} slot doesn't exist. + /// + public static string CannotFindDeployment + { + get + { + return ResourceManager.GetString("CannotFindDeployment", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Can't find valid Microsoft Azure role in current directory {0}. + /// + public static string CannotFindRole + { + get + { + return ResourceManager.GetString("CannotFindRole", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to service {0} configuration file (ServiceConfiguration.Cloud.cscfg) is either null or doesn't exist. + /// + public static string CannotFindServiceConfigurationFile + { + get + { + return ResourceManager.GetString("CannotFindServiceConfigurationFile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Invalid service path! Cannot locate ServiceDefinition.csdef in current folder or parent folders.. + /// + public static string CannotFindServiceRoot + { + get + { + return ResourceManager.GetString("CannotFindServiceRoot", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The subscription named {0} with id {1} is not currently imported. You must import this subscription before it can be updated.. + /// + public static string CannotUpdateUnknownSubscription + { + get + { + return ResourceManager.GetString("CannotUpdateUnknownSubscription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ManagementCertificate. + /// + public static string CertificateElementName + { + get + { + return ResourceManager.GetString("CertificateElementName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to certificate.pfx. + /// + public static string CertificateFileName + { + get + { + return ResourceManager.GetString("CertificateFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Certificate imported into CurrentUser\My\{0}. + /// + public static string CertificateImportedMessage + { + get + { + return ResourceManager.GetString("CertificateImportedMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No certificate was found in the certificate store with thumbprint {0}. + /// + public static string CertificateNotFoundInStore + { + get + { + return ResourceManager.GetString("CertificateNotFoundInStore", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Your account does not have access to the private key for certificate {0}. + /// + public static string CertificatePrivateKeyAccessError + { + get + { + return ResourceManager.GetString("CertificatePrivateKeyAccessError", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} {1} deployment for {2} service. + /// + public static string ChangeDeploymentStateWaitMessage + { + get + { + return ResourceManager.GetString("ChangeDeploymentStateWaitMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cloud service {0} is in {1} state.. + /// + public static string ChangeDeploymentStatusCompleteMessage + { + get + { + return ResourceManager.GetString("ChangeDeploymentStatusCompleteMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Changing/Removing public environment '{0}' is not allowed.. + /// + public static string ChangePublicEnvironmentMessage + { + get + { + return ResourceManager.GetString("ChangePublicEnvironmentMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Service {0} is set to value {1}. + /// + public static string ChangeSettingsElementMessage + { + get + { + return ResourceManager.GetString("ChangeSettingsElementMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Changing public environment is not supported.. + /// + public static string ChangingDefaultEnvironmentNotSupported + { + get + { + return ResourceManager.GetString("ChangingDefaultEnvironmentNotSupported", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Choose which publish settings file to use:. + /// + public static string ChoosePublishSettingsFile + { + get + { + return ResourceManager.GetString("ChoosePublishSettingsFile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Microsoft.WindowsAzure.Plugins.Caching.ClientDiagnosticLevel. + /// + public static string ClientDiagnosticLevelName + { + get + { + return ResourceManager.GetString("ClientDiagnosticLevelName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to 1. + /// + public static string ClientDiagnosticLevelValue + { + get + { + return ResourceManager.GetString("ClientDiagnosticLevelValue", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to cloud_package.cspkg. + /// + public static string CloudPackageFileName + { + get + { + return ResourceManager.GetString("CloudPackageFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ServiceConfiguration.Cloud.cscfg. + /// + public static string CloudServiceConfigurationFileName + { + get + { + return ResourceManager.GetString("CloudServiceConfigurationFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Add-ons for {0}. + /// + public static string CloudServiceDescription + { + get + { + return ResourceManager.GetString("CloudServiceDescription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Communication could not be established. This could be due to an invalid subscription ID. Note that subscription IDs are case sensitive.. + /// + public static string CommunicationCouldNotBeEstablished + { + get + { + return ResourceManager.GetString("CommunicationCouldNotBeEstablished", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Complete. + /// + public static string CompleteMessage + { + get + { + return ResourceManager.GetString("CompleteMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to OperationID : '{0}'. + /// + public static string ComputeCloudExceptionOperationIdMessage + { + get + { + return ResourceManager.GetString("ComputeCloudExceptionOperationIdMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to config.json. + /// + public static string ConfigurationFileName + { + get + { + return ResourceManager.GetString("ConfigurationFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to VirtualMachine creation failed.. + /// + public static string CreateFailedErrorMessage + { + get + { + return ResourceManager.GetString("CreateFailedErrorMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Creating the website failed. If this is the first website for this subscription, please create it using the management portal instead.. + /// + public static string CreateWebsiteFailed + { + get + { + return ResourceManager.GetString("CreateWebsiteFailed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Microsoft.ApplicationServer.Caching.DataCacheClientsSection, Microsoft.ApplicationServer.Caching.Core. + /// + public static string DataCacheClientsType + { + get + { + return ResourceManager.GetString("DataCacheClientsType", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to //blobcontainer[@datacenter='{0}']. + /// + public static string DatacenterBlobQuery + { + get + { + return ResourceManager.GetString("DatacenterBlobQuery", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Microsoft Azure PowerShell Data Collection Confirmation. + /// + public static string DataCollectionActivity + { + get + { + return ResourceManager.GetString("DataCollectionActivity", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to You choose not to participate in Microsoft Azure PowerShell data collection.. + /// + public static string DataCollectionConfirmNo + { + get + { + return ResourceManager.GetString("DataCollectionConfirmNo", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to This confirmation message will be dismissed in '{0}' second(s).... + /// + public static string DataCollectionConfirmTime + { + get + { + return ResourceManager.GetString("DataCollectionConfirmTime", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to You choose to participate in Microsoft Azure PowerShell data collection.. + /// + public static string DataCollectionConfirmYes + { + get + { + return ResourceManager.GetString("DataCollectionConfirmYes", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The setting profile has been saved to the following path '{0}'.. + /// + public static string DataCollectionSaveFileInformation + { + get + { + return ResourceManager.GetString("DataCollectionSaveFileInformation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Setting: {0} as the default and current subscription. To view other subscriptions use Get-AzureSubscription. + /// + public static string DefaultAndCurrentSubscription + { + get + { + return ResourceManager.GetString("DefaultAndCurrentSubscription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to none. + /// + public static string DefaultFileVersion + { + get + { + return ResourceManager.GetString("DefaultFileVersion", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to There are no hostnames which could be used for validation.. + /// + public static string DefaultHostnamesValidation + { + get + { + return ResourceManager.GetString("DefaultHostnamesValidation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to 8080. + /// + public static string DefaultPort + { + get + { + return ResourceManager.GetString("DefaultPort", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to 1000. + /// + public static string DefaultRoleCachingInMB + { + get + { + return ResourceManager.GetString("DefaultRoleCachingInMB", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Auto. + /// + public static string DefaultUpgradeMode + { + get + { + return ResourceManager.GetString("DefaultUpgradeMode", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to 80. + /// + public static string DefaultWebPort + { + get + { + return ResourceManager.GetString("DefaultWebPort", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Delete. + /// + public static string Delete + { + get + { + return ResourceManager.GetString("Delete", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The {0} slot for service {1} is already in {2} state. + /// + public static string DeploymentAlreadyInState + { + get + { + return ResourceManager.GetString("DeploymentAlreadyInState", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The deployment in {0} slot for service {1} is removed. + /// + public static string DeploymentRemovedMessage + { + get + { + return ResourceManager.GetString("DeploymentRemovedMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Microsoft.WindowsAzure.Plugins.Caching.DiagnosticLevel. + /// + public static string DiagnosticLevelName + { + get + { + return ResourceManager.GetString("DiagnosticLevelName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to 1. + /// + public static string DiagnosticLevelValue + { + get + { + return ResourceManager.GetString("DiagnosticLevelValue", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The key to add already exists in the dictionary.. + /// + public static string DictionaryAddAlreadyContainsKey + { + get + { + return ResourceManager.GetString("DictionaryAddAlreadyContainsKey", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The array index cannot be less than zero.. + /// + public static string DictionaryCopyToArrayIndexLessThanZero + { + get + { + return ResourceManager.GetString("DictionaryCopyToArrayIndexLessThanZero", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The supplied array does not have enough room to contain the copied elements.. + /// + public static string DictionaryCopyToArrayTooShort + { + get + { + return ResourceManager.GetString("DictionaryCopyToArrayTooShort", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The provided dns {0} doesn't exist. + /// + public static string DnsDoesNotExist + { + get + { + return ResourceManager.GetString("DnsDoesNotExist", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Microsoft Azure Certificate. + /// + public static string EnableRemoteDesktop_FriendlyCertificateName + { + get + { + return ResourceManager.GetString("EnableRemoteDesktop_FriendlyCertificateName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Endpoint can't be retrieved for storage account. + /// + public static string EndPointNotFoundForBlobStorage + { + get + { + return ResourceManager.GetString("EndPointNotFoundForBlobStorage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} end processing.. + /// + public static string EndProcessingLog + { + get + { + return ResourceManager.GetString("EndProcessingLog", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to To use Active Directory authentication, you must configure the ActiveDirectoryEndpoint, ActiveDirectoryTenantId, and ActiveDirectorServiceEndpointResourceId for environment of '{0}'. You can configure these properties for this environment using the Set-AzureEnvironment cmdlet.. + /// + public static string EnvironmentDoesNotSupportActiveDirectory + { + get + { + return ResourceManager.GetString("EnvironmentDoesNotSupportActiveDirectory", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The environment '{0}' already exists.. + /// + public static string EnvironmentExists + { + get + { + return ResourceManager.GetString("EnvironmentExists", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Environment name doesn't match one in subscription.. + /// + public static string EnvironmentNameDoesntMatchSubscription + { + get + { + return ResourceManager.GetString("EnvironmentNameDoesntMatchSubscription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Environment name needs to be specified.. + /// + public static string EnvironmentNameNeedsToBeSpecified + { + get + { + return ResourceManager.GetString("EnvironmentNameNeedsToBeSpecified", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Environment needs to be specified.. + /// + public static string EnvironmentNeedsToBeSpecified + { + get + { + return ResourceManager.GetString("EnvironmentNeedsToBeSpecified", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The environment name '{0}' is not found.. + /// + public static string EnvironmentNotFound + { + get + { + return ResourceManager.GetString("EnvironmentNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to environments.xml. + /// + public static string EnvironmentsFileName + { + get + { + return ResourceManager.GetString("EnvironmentsFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Error creating VirtualMachine. + /// + public static string ErrorCreatingVirtualMachine + { + get + { + return ResourceManager.GetString("ErrorCreatingVirtualMachine", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Unable to download available runtimes for location '{0}'. + /// + public static string ErrorRetrievingRuntimesForLocation + { + get + { + return ResourceManager.GetString("ErrorRetrievingRuntimesForLocation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Error updating VirtualMachine. + /// + public static string ErrorUpdatingVirtualMachine + { + get + { + return ResourceManager.GetString("ErrorUpdatingVirtualMachine", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Job Id {0} failed. Error: {1}, ExceptionDetails: {2}. + /// + public static string FailedJobErrorMessage + { + get + { + return ResourceManager.GetString("FailedJobErrorMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to File path is not valid.. + /// + public static string FilePathIsNotValid + { + get + { + return ResourceManager.GetString("FilePathIsNotValid", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The HTTP request was forbidden with client authentication scheme 'Anonymous'.. + /// + public static string FirstPurchaseErrorMessage + { + get + { + return ResourceManager.GetString("FirstPurchaseErrorMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to This add-on requires you to purchase the first instance through the Microsoft Azure Portal. Subsequent purchases can be performed through PowerShell.. + /// + public static string FirstPurchaseMessage + { + get + { + return ResourceManager.GetString("FirstPurchaseMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Operation Status:. + /// + public static string GatewayOperationStatus + { + get + { + return ResourceManager.GetString("GatewayOperationStatus", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Resources\Scaffolding\General. + /// + public static string GeneralScaffolding + { + get + { + return ResourceManager.GetString("GeneralScaffolding", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Getting all available Microsoft Azure Add-Ons, this may take few minutes.... + /// + public static string GetAllAddOnsWaitMessage + { + get + { + return ResourceManager.GetString("GetAllAddOnsWaitMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Name{0}Primary Key{0}Seconday Key. + /// + public static string GetStorageKeysHeader + { + get + { + return ResourceManager.GetString("GetStorageKeysHeader", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Git not found. Please install git and place it in your command line path.. + /// + public static string GitNotFound + { + get + { + return ResourceManager.GetString("GitNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Could not find publish settings. Please run Import-AzurePublishSettingsFile.. + /// + public static string GlobalSettingsManager_Load_PublishSettingsNotFound + { + get + { + return ResourceManager.GetString("GlobalSettingsManager_Load_PublishSettingsNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot find the WadCfg end element in the config.. + /// + public static string IaasDiagnosticsBadConfigNoEndWadCfg + { + get + { + return ResourceManager.GetString("IaasDiagnosticsBadConfigNoEndWadCfg", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to WadCfg start element in the config is not matching the end element.. + /// + public static string IaasDiagnosticsBadConfigNoMatchingWadCfg + { + get + { + return ResourceManager.GetString("IaasDiagnosticsBadConfigNoMatchingWadCfg", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot find the WadCfg element in the config.. + /// + public static string IaasDiagnosticsBadConfigNoWadCfg + { + get + { + return ResourceManager.GetString("IaasDiagnosticsBadConfigNoWadCfg", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to iisnode.dll. + /// + public static string IISNodeDll + { + get + { + return ResourceManager.GetString("IISNodeDll", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to iisnode. + /// + public static string IISNodeEngineKey + { + get + { + return ResourceManager.GetString("IISNodeEngineKey", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to iisnode-dev\\release\\x64. + /// + public static string IISNodePath + { + get + { + return ResourceManager.GetString("IISNodePath", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to iisnode. + /// + public static string IISNodeRuntimeValue + { + get + { + return ResourceManager.GetString("IISNodeRuntimeValue", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Installing IISNode version {0} in Azure for WebRole '{1}' (the version locally installed is: {2}). + /// + public static string IISNodeVersionWarningText + { + get + { + return ResourceManager.GetString("IISNodeVersionWarningText", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Illegal characters in path.. + /// + public static string IllegalPath + { + get + { + return ResourceManager.GetString("IllegalPath", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Internal Server Error. + /// + public static string InternalServerErrorMessage + { + get + { + return ResourceManager.GetString("InternalServerErrorMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot enable memcach protocol on a cache worker role {0}.. + /// + public static string InvalidCacheRoleName + { + get + { + return ResourceManager.GetString("InvalidCacheRoleName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Invalid certificate format. Publish settings may be corrupted. Use Get-AzurePublishSettingsFile to download updated settings. + /// + public static string InvalidCertificate + { + get + { + return ResourceManager.GetString("InvalidCertificate", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Invalid certificate format.. + /// + public static string InvalidCertificateSingle + { + get + { + return ResourceManager.GetString("InvalidCertificateSingle", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The provided configuration path is invalid or doesn't exist. + /// + public static string InvalidConfigPath + { + get + { + return ResourceManager.GetString("InvalidConfigPath", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The country name is invalid, please use a valid two character country code, as described in ISO 3166-1 alpha-2.. + /// + public static string InvalidCountryNameMessage + { + get + { + return ResourceManager.GetString("InvalidCountryNameMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No default subscription has been designated. Use Select-AzureSubscription -Default <subscriptionName> to set the default subscription.. + /// + public static string InvalidDefaultSubscription + { + get + { + return ResourceManager.GetString("InvalidDefaultSubscription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Deployment with {0} does not exist. + /// + public static string InvalidDeployment + { + get + { + return ResourceManager.GetString("InvalidDeployment", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The deployment slot name {0} is invalid. Slot name must be either "Staging" or "Production".. + /// + public static string InvalidDeploymentSlot + { + get + { + return ResourceManager.GetString("InvalidDeploymentSlot", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to "{0}" is an invalid DNS name for {1}. + /// + public static string InvalidDnsName + { + get + { + return ResourceManager.GetString("InvalidDnsName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Invalid service endpoint.. + /// + public static string InvalidEndpoint + { + get + { + return ResourceManager.GetString("InvalidEndpoint", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The provided file in {0} must be have {1} extension. + /// + public static string InvalidFileExtension + { + get + { + return ResourceManager.GetString("InvalidFileExtension", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to File {0} has invalid characters. + /// + public static string InvalidFileName + { + get + { + return ResourceManager.GetString("InvalidFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to You must create your git publishing credentials using the Microsoft Azure portal. + ///Please follow these steps in the portal: + ///1. On the left side open "Web Sites" + ///2. Click on any website + ///3. Choose "Setup Git Publishing" or "Reset deployment credentials" + ///4. Back in the PowerShell window, rerun this command by typing "New-AzureWebSite {site name} -Git -PublishingUsername {username}. + /// + public static string InvalidGitCredentials + { + get + { + return ResourceManager.GetString("InvalidGitCredentials", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The value {0} provided is not a valid GUID. Please provide a valid GUID.. + /// + public static string InvalidGuid + { + get + { + return ResourceManager.GetString("InvalidGuid", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The specified hostname does not exist. Please specify a valid hostname for the site.. + /// + public static string InvalidHostnameValidation + { + get + { + return ResourceManager.GetString("InvalidHostnameValidation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Role {0} instances must be greater than or equal 0 and less than or equal 20. + /// + public static string InvalidInstancesCount + { + get + { + return ResourceManager.GetString("InvalidInstancesCount", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to There was an error creating your webjob. Please make sure that the script is in the root folder of the zip file.. + /// + public static string InvalidJobFile + { + get + { + return ResourceManager.GetString("InvalidJobFile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Could not download a valid runtime manifest, Please check your internet connection and try again.. + /// + public static string InvalidManifestError + { + get + { + return ResourceManager.GetString("InvalidManifestError", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The account {0} was not found. Please specify a valid account name.. + /// + public static string InvalidMediaServicesAccount + { + get + { + return ResourceManager.GetString("InvalidMediaServicesAccount", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The provided name "{0}" does not match the service bus namespace naming rules.. + /// + public static string InvalidNamespaceName + { + get + { + return ResourceManager.GetString("InvalidNamespaceName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Path must specify a valid path to an Azure profile.. + /// + public static string InvalidNewProfilePath + { + get + { + return ResourceManager.GetString("InvalidNewProfilePath", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Value cannot be null. Parameter name: '{0}'. + /// + public static string InvalidNullArgument + { + get + { + return ResourceManager.GetString("InvalidNullArgument", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} is invalid or empty. + /// + public static string InvalidOrEmptyArgumentMessage + { + get + { + return ResourceManager.GetString("InvalidOrEmptyArgumentMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The provided package path is invalid or doesn't exist. + /// + public static string InvalidPackagePath + { + get + { + return ResourceManager.GetString("InvalidPackagePath", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to '{0}' is an invalid parameter set name.. + /// + public static string InvalidParameterSetName + { + get + { + return ResourceManager.GetString("InvalidParameterSetName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} doesn't exist in {1} or you've not passed valid value for it. + /// + public static string InvalidPath + { + get + { + return ResourceManager.GetString("InvalidPath", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Path {0} has invalid characters. + /// + public static string InvalidPathName + { + get + { + return ResourceManager.GetString("InvalidPathName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Property bag Hashtable must contain one of the following sets of properties: {SubscriptionId, Certificate}, {SubscriptionId, Username, Password}, {SubscriptionId, ServicePrincipal, Password, Tenant}, {SubscriptionId, AccountId, Token}. + /// + public static string InvalidProfileProperties + { + get + { + return ResourceManager.GetString("InvalidProfileProperties", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The provided publish settings file {0} has invalid content. Please get valid by running cmdlet Get-AzurePublishSettingsFile. + /// + public static string InvalidPublishSettingsSchema + { + get + { + return ResourceManager.GetString("InvalidPublishSettingsSchema", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The provided role name "{0}" has invalid characters. + /// + public static string InvalidRoleNameMessage + { + get + { + return ResourceManager.GetString("InvalidRoleNameMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to A valid name for the service root folder is required. + /// + public static string InvalidRootNameMessage + { + get + { + return ResourceManager.GetString("InvalidRootNameMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} is not a recognized runtime type. + /// + public static string InvalidRuntimeError + { + get + { + return ResourceManager.GetString("InvalidRuntimeError", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to A valid language is required. + /// + public static string InvalidScaffoldingLanguageArg + { + get + { + return ResourceManager.GetString("InvalidScaffoldingLanguageArg", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No subscription is currently selected. Use Select-Subscription to activate a subscription.. + /// + public static string InvalidSelectedSubscription + { + get + { + return ResourceManager.GetString("InvalidSelectedSubscription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The provided location "{0}" does not exist in the available locations use Get-AzureSBLocation for listing available locations.. + /// + public static string InvalidServiceBusLocation + { + get + { + return ResourceManager.GetString("InvalidServiceBusLocation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Please provide a service name or run this command from inside a service project directory.. + /// + public static string InvalidServiceName + { + get + { + return ResourceManager.GetString("InvalidServiceName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to You must provide valid value for {0}. + /// + public static string InvalidServiceSettingElement + { + get + { + return ResourceManager.GetString("InvalidServiceSettingElement", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to settings.json is invalid or doesn't exist. + /// + public static string InvalidServiceSettingMessage + { + get + { + return ResourceManager.GetString("InvalidServiceSettingMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The subscription named '{0}' cannot be found. Use Set-AzureSubscription to initialize the subscription data.. + /// + public static string InvalidSubscription + { + get + { + return ResourceManager.GetString("InvalidSubscription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The provided subscription id {0} is not valid. + /// + public static string InvalidSubscriptionId + { + get + { + return ResourceManager.GetString("InvalidSubscriptionId", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Must specify a non-null subscription name.. + /// + public static string InvalidSubscriptionName + { + get + { + return ResourceManager.GetString("InvalidSubscriptionName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to A valid subscription name is required. This can be provided using the -Subscription parameter or by setting the subscription via the Set-AzureSubscription cmdlet. + /// + public static string InvalidSubscriptionNameMessage + { + get + { + return ResourceManager.GetString("InvalidSubscriptionNameMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The provided subscriptions file {0} has invalid content.. + /// + public static string InvalidSubscriptionsDataSchema + { + get + { + return ResourceManager.GetString("InvalidSubscriptionsDataSchema", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Role {0} VM size should be ExtraSmall, Small, Medium, Large or ExtraLarge.. + /// + public static string InvalidVMSize + { + get + { + return ResourceManager.GetString("InvalidVMSize", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The web job file must have *.zip extension. + /// + public static string InvalidWebJobFile + { + get + { + return ResourceManager.GetString("InvalidWebJobFile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Singleton option works for continuous jobs only.. + /// + public static string InvalidWebJobSingleton + { + get + { + return ResourceManager.GetString("InvalidWebJobSingleton", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The website {0} was not found. Please specify a valid website name.. + /// + public static string InvalidWebsite + { + get + { + return ResourceManager.GetString("InvalidWebsite", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No job for id: {0} was found.. + /// + public static string JobNotFound + { + get + { + return ResourceManager.GetString("JobNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to engines. + /// + public static string JsonEnginesSectionName + { + get + { + return ResourceManager.GetString("JsonEnginesSectionName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Scaffolding for this language is not yet supported. + /// + public static string LanguageScaffoldingIsNotSupported + { + get + { + return ResourceManager.GetString("LanguageScaffoldingIsNotSupported", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Link already established. + /// + public static string LinkAlreadyEstablished + { + get + { + return ResourceManager.GetString("LinkAlreadyEstablished", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to local_package.csx. + /// + public static string LocalPackageFileName + { + get + { + return ResourceManager.GetString("LocalPackageFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ServiceConfiguration.Local.cscfg. + /// + public static string LocalServiceConfigurationFileName + { + get + { + return ResourceManager.GetString("LocalServiceConfigurationFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Looking for {0} deployment for {1} cloud service.... + /// + public static string LookingForDeploymentMessage + { + get + { + return ResourceManager.GetString("LookingForDeploymentMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Looking for cloud service {0}.... + /// + public static string LookingForServiceMessage + { + get + { + return ResourceManager.GetString("LookingForServiceMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Azure Long-Running Job. + /// + public static string LROJobName + { + get + { + return ResourceManager.GetString("LROJobName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The cmdlet failed in background execution. The returned error was '{0}'. Please execute the cmdlet again. You may need to execute this cmdlet synchronously, by omitting the '-AsJob' parameter.. + /// + public static string LROTaskExceptionMessage + { + get + { + return ResourceManager.GetString("LROTaskExceptionMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to managementCertificate.pem. + /// + public static string ManagementCertificateFileName + { + get + { + return ResourceManager.GetString("ManagementCertificateFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ?whr={0}. + /// + public static string ManagementPortalRealmFormat + { + get + { + return ResourceManager.GetString("ManagementPortalRealmFormat", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to //baseuri. + /// + public static string ManifestBaseUriQuery + { + get + { + return ResourceManager.GetString("ManifestBaseUriQuery", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to uri. + /// + public static string ManifestBlobUriKey + { + get + { + return ResourceManager.GetString("ManifestBlobUriKey", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to http://az413943.vo.msecnd.net/node/runtimemanifest_0.7.5.2.xml. + /// + public static string ManifestUri + { + get + { + return ResourceManager.GetString("ManifestUri", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Property bag Hashtable must contain a 'Certificate' of type 'X509Certificate2'.. + /// + public static string MissingCertificateInProfileProperties + { + get + { + return ResourceManager.GetString("MissingCertificateInProfileProperties", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Property bag Hashtable must contain a 'Password' with an associated 'Username' or 'ServicePrincipal'.. + /// + public static string MissingPasswordInProfileProperties + { + get + { + return ResourceManager.GetString("MissingPasswordInProfileProperties", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Property bag Hashtable must contain a 'SubscriptionId'.. + /// + public static string MissingSubscriptionInProfileProperties + { + get + { + return ResourceManager.GetString("MissingSubscriptionInProfileProperties", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Multiple Add-Ons found holding name {0}. + /// + public static string MultipleAddOnsFoundMessage + { + get + { + return ResourceManager.GetString("MultipleAddOnsFoundMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Multiple possible publishing users. Please go to the Portal and use the listed deployment user, or click 'set/reset deployment credentials' to set up a new user account, then reurn this cmdlet and specify PublishingUsername.. + /// + public static string MultiplePublishingUsernames + { + get + { + return ResourceManager.GetString("MultiplePublishingUsernames", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The first publish settings file "{0}" is used. If you want to use another file specify the file name.. + /// + public static string MultiplePublishSettingsFilesFoundMessage + { + get + { + return ResourceManager.GetString("MultiplePublishSettingsFilesFoundMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Microsoft.WindowsAzure.Plugins.Caching.NamedCaches. + /// + public static string NamedCacheSettingName + { + get + { + return ResourceManager.GetString("NamedCacheSettingName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {"caches":[{"name":"default","policy":{"eviction":{"type":0},"expiration":{"defaultTTL":10,"isExpirable":true,"type":1},"serverNotification":{"isEnabled":false}},"secondaries":0}]}. + /// + public static string NamedCacheSettingValue + { + get + { + return ResourceManager.GetString("NamedCacheSettingValue", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to A publishing username is required. Please specify one using the argument PublishingUsername.. + /// + public static string NeedPublishingUsernames + { + get + { + return ResourceManager.GetString("NeedPublishingUsernames", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to New Add-On Confirmation. + /// + public static string NewAddOnConformation + { + get + { + return ResourceManager.GetString("NewAddOnConformation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to By typing "Yes", I (a) authorize Microsoft to charge my current payment method on a monthly basis + ///for the amount indicated at {0} for {1} until my service is cancelled or terminated, and (b) + ///agree to the {2}'s terms of user and privacy statement at {0} and (c) agree to sharing my + ///contact information with {2}.. + /// + public static string NewMicrosoftAddOnMessage + { + get + { + return ResourceManager.GetString("NewMicrosoftAddOnMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Internal Server Error. This could happen because the namespace name is already used or due to an incorrect location name. Use Get-AzureSBLocation cmdlet to list valid names.. + /// + public static string NewNamespaceErrorMessage + { + get + { + return ResourceManager.GetString("NewNamespaceErrorMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to By typing "Yes", I (a) authorize Microsoft to charge my current payment method on a monthly basis + ///for the amount indicated at {0} for {1} until my service is cancelled or terminated, and (b) + ///acknowledge the offering is provided by {2}, not Microsoft, and agree to {2}'s terms of + ///use and privacy statement at {0} and (c) agree to sharing my contact information with {2}.. + /// + public static string NewNonMicrosoftAddOnMessage + { + get + { + return ResourceManager.GetString("NewNonMicrosoftAddOnMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Service has been created at {0}. + /// + public static string NewServiceCreatedMessage + { + get + { + return ResourceManager.GetString("NewServiceCreatedMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No. + /// + public static string No + { + get + { + return ResourceManager.GetString("No", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to There is no access token cached for subscription {0}, user id {1}. Use the Add-AzureAccount cmdlet to log in again and get a token for this subscription.. + /// + public static string NoCachedToken + { + get + { + return ResourceManager.GetString("NoCachedToken", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The service does not have any cache worker roles, add one first by running cmdlet Add-AzureCacheWorkerRole.. + /// + public static string NoCacheWorkerRoles + { + get + { + return ResourceManager.GetString("NoCacheWorkerRoles", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No clouds available. + /// + public static string NoCloudsAvailable + { + get + { + return ResourceManager.GetString("NoCloudsAvailable", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to "There is no current context, please log in using Connect-AzAccount.". + /// + public static string NoCurrentContextForDataCmdlet + { + get + { + return ResourceManager.GetString("NoCurrentContextForDataCmdlet", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to nodejs. + /// + public static string NodeDirectory + { + get + { + return ResourceManager.GetString("NodeDirectory", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to node. + /// + public static string NodeEngineKey + { + get + { + return ResourceManager.GetString("NodeEngineKey", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to node.exe. + /// + public static string NodeExe + { + get + { + return ResourceManager.GetString("NodeExe", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to There is no default subscription set, please set a default subscription by running Set-AzureSubscription -Default <subscription name>. + /// + public static string NoDefaultSubscriptionMessage + { + get + { + return ResourceManager.GetString("NoDefaultSubscriptionMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Microsoft SDKs\Azure\Nodejs\Nov2011. + /// + public static string NodeModulesPath + { + get + { + return ResourceManager.GetString("NodeModulesPath", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to nodejs. + /// + public static string NodeProgramFilesFolderName + { + get + { + return ResourceManager.GetString("NodeProgramFilesFolderName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to node. + /// + public static string NodeRuntimeValue + { + get + { + return ResourceManager.GetString("NodeRuntimeValue", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Resources\Scaffolding\Node. + /// + public static string NodeScaffolding + { + get + { + return ResourceManager.GetString("NodeScaffolding", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Microsoft.WindowsAzure.Commands.CloudService.ScaffoldingResources.Node. + /// + public static string NodeScaffoldingResources + { + get + { + return ResourceManager.GetString("NodeScaffoldingResources", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Installing Node version {0} in Azure for Role '{1}' (the Node version locally installed is: {2}). + /// + public static string NodeVersionWarningText + { + get + { + return ResourceManager.GetString("NodeVersionWarningText", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No, I do not agree. + /// + public static string NoHint + { + get + { + return ResourceManager.GetString("NoHint", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Please connect to internet before executing this cmdlet. + /// + public static string NoInternetConnection + { + get + { + return ResourceManager.GetString("NoInternetConnection", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to <NONE>. + /// + public static string None + { + get + { + return ResourceManager.GetString("None", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No publish settings files with extension *.publishsettings are found in the directory "{0}".. + /// + public static string NoPublishSettingsFilesFoundMessage + { + get + { + return ResourceManager.GetString("NoPublishSettingsFilesFoundMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to There is no subscription associated with account {0}.. + /// + public static string NoSubscriptionAddedMessage + { + get + { + return ResourceManager.GetString("NoSubscriptionAddedMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No subscriptions are associated with the logged in account in Azure Service Management (RDFE). This means that the logged in user is not an administrator or co-administrator for any account.\r\nDid you mean to execute Connect-AzAccount?. + /// + public static string NoSubscriptionFoundForTenant + { + get + { + return ResourceManager.GetString("NoSubscriptionFoundForTenant", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to '{0}' must be a cache worker role. Verify that it has proper cache worker role configuration.. + /// + public static string NotCacheWorkerRole + { + get + { + return ResourceManager.GetString("NotCacheWorkerRole", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Certificate can't be null.. + /// + public static string NullCertificateMessage + { + get + { + return ResourceManager.GetString("NullCertificateMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} could not be null or empty. + /// + public static string NullObjectMessage + { + get + { + return ResourceManager.GetString("NullObjectMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Unable to add a null RoleSettings to {0}. + /// + public static string NullRoleSettingsMessage + { + get + { + return ResourceManager.GetString("NullRoleSettingsMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Unable to add new role to null service definition. + /// + public static string NullServiceDefinitionMessage + { + get + { + return ResourceManager.GetString("NullServiceDefinitionMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The request offer '{0}' is not found.. + /// + public static string OfferNotFoundMessage + { + get + { + return ResourceManager.GetString("OfferNotFoundMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Operation "{0}" failed on VM with ID: {1}. + /// + public static string OperationFailedErrorMessage + { + get + { + return ResourceManager.GetString("OperationFailedErrorMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The REST operation failed with message '{0}' and error code '{1}'. + /// + public static string OperationFailedMessage + { + get + { + return ResourceManager.GetString("OperationFailedMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Job Id {0} did not complete within expected time or it is in Failed/Canceled/Invalid state.. + /// + public static string OperationTimedOutOrError + { + get + { + return ResourceManager.GetString("OperationTimedOutOrError", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to package. + /// + public static string Package + { + get + { + return ResourceManager.GetString("Package", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Package is created at service root path {0}.. + /// + public static string PackageCreated + { + get + { + return ResourceManager.GetString("PackageCreated", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {{ + /// "author": "", + /// + /// "name": "{0}", + /// "version": "0.0.0", + /// "dependencies":{{}}, + /// "devDependencies":{{}}, + /// "optionalDependencies": {{}}, + /// "engines": {{ + /// "node": "*", + /// "iisnode": "*" + /// }} + /// + ///}} + ///. + /// + public static string PackageJsonDefaultFile + { + get + { + return ResourceManager.GetString("PackageJsonDefaultFile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to package.json. + /// + public static string PackageJsonFileName + { + get + { + return ResourceManager.GetString("PackageJsonFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Path {0} doesn't exist.. + /// + public static string PathDoesNotExist + { + get + { + return ResourceManager.GetString("PathDoesNotExist", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Path for {0} doesn't exist in {1}.. + /// + public static string PathDoesNotExistForElement + { + get + { + return ResourceManager.GetString("PathDoesNotExistForElement", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to A value for the Peer Asn has to be provided.. + /// + public static string PeerAsnRequired + { + get + { + return ResourceManager.GetString("PeerAsnRequired", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to 5.4.0. + /// + public static string PHPDefaultRuntimeVersion + { + get + { + return ResourceManager.GetString("PHPDefaultRuntimeVersion", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to php. + /// + public static string PhpRuntimeValue + { + get + { + return ResourceManager.GetString("PhpRuntimeValue", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Resources\Scaffolding\PHP. + /// + public static string PHPScaffolding + { + get + { + return ResourceManager.GetString("PHPScaffolding", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Microsoft.WindowsAzure.Commands.CloudService.ScaffoldingResources.PHP. + /// + public static string PHPScaffoldingResources + { + get + { + return ResourceManager.GetString("PHPScaffoldingResources", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Installing PHP version {0} for Role '{1}' (the PHP version locally installed is: {2}). + /// + public static string PHPVersionWarningText + { + get + { + return ResourceManager.GetString("PHPVersionWarningText", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to You must create your first web site using the Microsoft Azure portal. + ///Please follow these steps in the portal: + ///1. At the bottom of the page, click on New > Web Site > Quick Create + ///2. Type {0} in the URL field + ///3. Click on "Create Web Site" + ///4. Once the site has been created, click on the site name + ///5. Click on "Set up Git publishing" or "Reset deployment credentials" and setup a publishing username and password. Use those credentials for all new websites you create.. + /// + public static string PortalInstructions + { + get + { + return ResourceManager.GetString("PortalInstructions", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to 6. Back in the console window, rerun this command by typing "New-AzureWebsite <site name> -Git". + /// + public static string PortalInstructionsGit + { + get + { + return ResourceManager.GetString("PortalInstructionsGit", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The estimated generally available date is '{0}'.. + /// + public static string PreviewCmdletETAMessage { + get { + return ResourceManager.GetString("PreviewCmdletETAMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to This cmdlet is in preview. Its behavior is subject to change based on customer feedback.. + /// + public static string PreviewCmdletMessage + { + get + { + return ResourceManager.GetString("PreviewCmdletMessage", resourceCulture); + } + } + + + /// + /// Looks up a localized string similar to A value for the Primary Peer Subnet has to be provided.. + /// + public static string PrimaryPeerSubnetRequired + { + get + { + return ResourceManager.GetString("PrimaryPeerSubnetRequired", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Promotion code can be used only when updating to a new plan.. + /// + public static string PromotionCodeWithCurrentPlanMessage + { + get + { + return ResourceManager.GetString("PromotionCodeWithCurrentPlanMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Service not published at user request.. + /// + public static string PublishAbortedAtUserRequest + { + get + { + return ResourceManager.GetString("PublishAbortedAtUserRequest", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Complete.. + /// + public static string PublishCompleteMessage + { + get + { + return ResourceManager.GetString("PublishCompleteMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Connecting.... + /// + public static string PublishConnectingMessage + { + get + { + return ResourceManager.GetString("PublishConnectingMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Created Deployment ID: {0}.. + /// + public static string PublishCreatedDeploymentMessage + { + get + { + return ResourceManager.GetString("PublishCreatedDeploymentMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Created hosted service '{0}'.. + /// + public static string PublishCreatedServiceMessage + { + get + { + return ResourceManager.GetString("PublishCreatedServiceMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Created Website URL: {0}.. + /// + public static string PublishCreatedWebsiteMessage + { + get + { + return ResourceManager.GetString("PublishCreatedWebsiteMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Creating.... + /// + public static string PublishCreatingServiceMessage + { + get + { + return ResourceManager.GetString("PublishCreatingServiceMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Initializing.... + /// + public static string PublishInitializingMessage + { + get + { + return ResourceManager.GetString("PublishInitializingMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to busy. + /// + public static string PublishInstanceStatusBusy + { + get + { + return ResourceManager.GetString("PublishInstanceStatusBusy", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to creating the virtual machine. + /// + public static string PublishInstanceStatusCreating + { + get + { + return ResourceManager.GetString("PublishInstanceStatusCreating", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Instance {0} of role {1} is {2}.. + /// + public static string PublishInstanceStatusMessage + { + get + { + return ResourceManager.GetString("PublishInstanceStatusMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ready. + /// + public static string PublishInstanceStatusReady + { + get + { + return ResourceManager.GetString("PublishInstanceStatusReady", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Preparing deployment for {0} with Subscription ID: {1}.... + /// + public static string PublishPreparingDeploymentMessage + { + get + { + return ResourceManager.GetString("PublishPreparingDeploymentMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Publishing {0} to Microsoft Azure. This may take several minutes.... + /// + public static string PublishServiceStartMessage + { + get + { + return ResourceManager.GetString("PublishServiceStartMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to publish settings. + /// + public static string PublishSettings + { + get + { + return ResourceManager.GetString("PublishSettings", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Azure. + /// + public static string PublishSettingsElementName + { + get + { + return ResourceManager.GetString("PublishSettingsElementName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to .PublishSettings. + /// + public static string PublishSettingsFileExtention + { + get + { + return ResourceManager.GetString("PublishSettingsFileExtention", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to publishSettings.xml. + /// + public static string PublishSettingsFileName + { + get + { + return ResourceManager.GetString("PublishSettingsFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to &whr={0}. + /// + public static string PublishSettingsFileRealmFormat + { + get + { + return ResourceManager.GetString("PublishSettingsFileRealmFormat", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Publish settings imported. + /// + public static string PublishSettingsSetSuccessfully + { + get + { + return ResourceManager.GetString("PublishSettingsSetSuccessfully", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to AZURE_PUBLISHINGPROFILE_URL. + /// + public static string PublishSettingsUrlEnv + { + get + { + return ResourceManager.GetString("PublishSettingsUrlEnv", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Starting.... + /// + public static string PublishStartingMessage + { + get + { + return ResourceManager.GetString("PublishStartingMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Upgrading.... + /// + public static string PublishUpgradingMessage + { + get + { + return ResourceManager.GetString("PublishUpgradingMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Uploading Package to storage service {0}.... + /// + public static string PublishUploadingPackageMessage + { + get + { + return ResourceManager.GetString("PublishUploadingPackageMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Verifying storage account '{0}'.... + /// + public static string PublishVerifyingStorageMessage + { + get + { + return ResourceManager.GetString("PublishVerifyingStorageMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Path '{0}' not found.. + /// + public static string PublishVMDscExtensionAdditionalContentPathNotExist + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionAdditionalContentPathNotExist", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Configuration published to {0}. + /// + public static string PublishVMDscExtensionArchiveUploadedMessage + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionArchiveUploadedMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Copy '{0}' to '{1}'.. + /// + public static string PublishVMDscExtensionCopyFileVerbose + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionCopyFileVerbose", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Copy the module '{0}' to '{1}'.. + /// + public static string PublishVMDscExtensionCopyModuleVerbose + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionCopyModuleVerbose", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Invalid configuration file: {0}. + ///The file needs to be a PowerShell script (.ps1 or .psm1).. + /// + public static string PublishVMDscExtensionCreateArchiveConfigFileInvalidExtension + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionCreateArchiveConfigFileInvalidExtension", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Deleted '{0}'. + /// + public static string PublishVMDscExtensionDeletedFileMessage + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionDeletedFileMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot delete '{0}': {1}. + /// + public static string PublishVMDscExtensionDeleteErrorMessage + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionDeleteErrorMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Path '{0}' not found.. + /// + public static string PublishVMDscExtensionDirectoryNotExist + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionDirectoryNotExist", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot get module for DscResource '{0}'. Possible solutions: + ///1) Specify -ModuleName for Import-DscResource in your configuration. + ///2) Unblock module that contains resource. + ///3) Move Import-DscResource inside Node block. + ///. + /// + public static string PublishVMDscExtensionGetDscResourceFailed + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionGetDscResourceFailed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to List of required modules: [{0}].. + /// + public static string PublishVMDscExtensionRequiredModulesVerbose + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionRequiredModulesVerbose", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Your current PowerShell version {1} is less then required by this cmdlet {0}. Consider download and install latest PowerShell version.. + /// + public static string PublishVMDscExtensionRequiredPsVersion + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionRequiredPsVersion", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Configuration script '{0}' contained parse errors: + ///{1}. + /// + public static string PublishVMDscExtensionStorageParserErrors + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionStorageParserErrors", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Temp folder '{0}' created.. + /// + public static string PublishVMDscExtensionTempFolderVerbose + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionTempFolderVerbose", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Invalid configuration file: {0}. + ///The file needs to be a PowerShell script (.ps1 or .psm1) or a ZIP archive (.zip).. + /// + public static string PublishVMDscExtensionUploadArchiveConfigFileInvalidExtension + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionUploadArchiveConfigFileInvalidExtension", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Configuration file '{0}' not found.. + /// + public static string PublishVMDscExtensionUploadArchiveConfigFileNotExist + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionUploadArchiveConfigFileNotExist", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Azure PowerShell collects usage data in order to improve your experience. + ///The data is anonymous and does not include commandline argument values. + ///The data is collected by Microsoft. + /// + ///Use the Disable-AzureDataCollection cmdlet to turn the feature Off. The cmdlet can be found in the Azure module. To disable data collection: PS > Disable-AzureDataCollection. + ///Use the Enable-AzureDataCollection cmdlet to turn the feature On. The cmdlet can be found in the Azure module. To enable data collection: PS > Enab [rest of string was truncated]";. + /// + public static string RDFEDataCollectionMessage + { + get + { + return ResourceManager.GetString("RDFEDataCollectionMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Replace current deployment with '{0}' Id ?. + /// + public static string RedeployCommit + { + get + { + return ResourceManager.GetString("RedeployCommit", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to regenerate key?. + /// + public static string RegenerateKeyWarning + { + get + { + return ResourceManager.GetString("RegenerateKeyWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Generate new key.. + /// + public static string RegenerateKeyWhatIfMessage + { + get + { + return ResourceManager.GetString("RegenerateKeyWhatIfMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to remove account '{0}'?. + /// + public static string RemoveAccountConfirmation + { + get + { + return ResourceManager.GetString("RemoveAccountConfirmation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing account. + /// + public static string RemoveAccountMessage + { + get + { + return ResourceManager.GetString("RemoveAccountMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Remove Add-On Confirmation. + /// + public static string RemoveAddOnConformation + { + get + { + return ResourceManager.GetString("RemoveAddOnConformation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to If you delete this add-on, your data may be deleted and the operation may not be undone. You may have to purchase it again from the Microsoft Azure Store to use it. The price of the add-on may not be refunded. Are you sure you want to delete this add-on? Enter “Yes” to confirm.. + /// + public static string RemoveAddOnMessage + { + get + { + return ResourceManager.GetString("RemoveAddOnMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Remove-AzureBGPPeering Operation failed.. + /// + public static string RemoveAzureBGPPeeringFailed + { + get + { + return ResourceManager.GetString("RemoveAzureBGPPeeringFailed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing Bgp Peering. + /// + public static string RemoveAzureBGPPeeringMessage + { + get + { + return ResourceManager.GetString("RemoveAzureBGPPeeringMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Successfully removed Azure Bgp Peering with Service Key {0}.. + /// + public static string RemoveAzureBGPPeeringSucceeded + { + get + { + return ResourceManager.GetString("RemoveAzureBGPPeeringSucceeded", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to remove the Bgp Peering with service key '{0}'?. + /// + public static string RemoveAzureBGPPeeringWarning + { + get + { + return ResourceManager.GetString("RemoveAzureBGPPeeringWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to remove the Dedicated Circuit with service key '{0}'?. + /// + public static string RemoveAzureDedicatdCircuitWarning + { + get + { + return ResourceManager.GetString("RemoveAzureDedicatdCircuitWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Remove-AzureDedicatedCircuit Operation failed.. + /// + public static string RemoveAzureDedicatedCircuitFailed + { + get + { + return ResourceManager.GetString("RemoveAzureDedicatedCircuitFailed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Remove-AzureDedicatedCircuitLink Operation failed.. + /// + public static string RemoveAzureDedicatedCircuitLinkFailed + { + get + { + return ResourceManager.GetString("RemoveAzureDedicatedCircuitLinkFailed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing Dedicated Circui Link. + /// + public static string RemoveAzureDedicatedCircuitLinkMessage + { + get + { + return ResourceManager.GetString("RemoveAzureDedicatedCircuitLinkMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Successfully removed Azure Dedicated Circuit Link with Service Key {0} and Vnet Name {1}. + /// + public static string RemoveAzureDedicatedCircuitLinkSucceeded + { + get + { + return ResourceManager.GetString("RemoveAzureDedicatedCircuitLinkSucceeded", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to remove the Dedicated Circuit Link with service key '{0}' and virtual network name '{1}'?. + /// + public static string RemoveAzureDedicatedCircuitLinkWarning + { + get + { + return ResourceManager.GetString("RemoveAzureDedicatedCircuitLinkWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing Dedicated Circuit. + /// + public static string RemoveAzureDedicatedCircuitMessage + { + get + { + return ResourceManager.GetString("RemoveAzureDedicatedCircuitMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Successfully removed Azure Dedicated Circuit with Service Key {0}.. + /// + public static string RemoveAzureDedicatedCircuitSucceeded + { + get + { + return ResourceManager.GetString("RemoveAzureDedicatedCircuitSucceeded", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing cloud service {0}.... + /// + public static string RemoveAzureServiceWaitMessage + { + get + { + return ResourceManager.GetString("RemoveAzureServiceWaitMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The default subscription is being removed. Use Select-AzureSubscription -Default <subscriptionName> to select a new default subscription.. + /// + public static string RemoveDefaultSubscription + { + get + { + return ResourceManager.GetString("RemoveDefaultSubscription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing {0} deployment for {1} service. + /// + public static string RemoveDeploymentWaitMessage + { + get + { + return ResourceManager.GetString("RemoveDeploymentWaitMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing an environment will remove all associated subscriptions and accounts. Are you sure you want to remove an environment '{0}'?. + /// + public static string RemoveEnvironmentConfirmation + { + get + { + return ResourceManager.GetString("RemoveEnvironmentConfirmation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing environment. + /// + public static string RemoveEnvironmentMessage + { + get + { + return ResourceManager.GetString("RemoveEnvironmentMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing job collection. + /// + public static string RemoveJobCollectionMessage + { + get + { + return ResourceManager.GetString("RemoveJobCollectionMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to remove the job collection "{0}". + /// + public static string RemoveJobCollectionWarning + { + get + { + return ResourceManager.GetString("RemoveJobCollectionWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing job. + /// + public static string RemoveJobMessage + { + get + { + return ResourceManager.GetString("RemoveJobMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to remove the job "{0}". + /// + public static string RemoveJobWarning + { + get + { + return ResourceManager.GetString("RemoveJobWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to remove the account?. + /// + public static string RemoveMediaAccountWarning + { + get + { + return ResourceManager.GetString("RemoveMediaAccountWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Account removed.. + /// + public static string RemoveMediaAccountWhatIfMessage + { + get + { + return ResourceManager.GetString("RemoveMediaAccountWhatIfMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Internal Server Error. This could happen because the namespace does not exist or it does not exist under your subscription.. + /// + public static string RemoveNamespaceErrorMessage + { + get + { + return ResourceManager.GetString("RemoveNamespaceErrorMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing old package {0}.... + /// + public static string RemovePackage + { + get + { + return ResourceManager.GetString("RemovePackage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing the Azure profile will remove all associated environments, subscriptions, and accounts. Are you sure you want to remove the Azure profile?. + /// + public static string RemoveProfileConfirmation + { + get + { + return ResourceManager.GetString("RemoveProfileConfirmation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing the Azure profile. + /// + public static string RemoveProfileMessage + { + get + { + return ResourceManager.GetString("RemoveProfileMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to delete the namespace '{0}'?. + /// + public static string RemoveServiceBusNamespaceConfirmation + { + get + { + return ResourceManager.GetString("RemoveServiceBusNamespaceConfirmation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to remove cloud service?. + /// + public static string RemoveServiceWarning + { + get + { + return ResourceManager.GetString("RemoveServiceWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Remove cloud service and all it's deployments. + /// + public static string RemoveServiceWhatIfMessage + { + get + { + return ResourceManager.GetString("RemoveServiceWhatIfMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to remove subscription '{0}'?. + /// + public static string RemoveSubscriptionConfirmation + { + get + { + return ResourceManager.GetString("RemoveSubscriptionConfirmation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing subscription. + /// + public static string RemoveSubscriptionMessage + { + get + { + return ResourceManager.GetString("RemoveSubscriptionMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The endpoint {0} cannot be removed from profile {1} because it's not in the profile.. + /// + public static string RemoveTrafficManagerEndpointMissing + { + get + { + return ResourceManager.GetString("RemoveTrafficManagerEndpointMissing", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Remove-AzureTrafficManagerProfile Operation failed.. + /// + public static string RemoveTrafficManagerProfileFailed + { + get + { + return ResourceManager.GetString("RemoveTrafficManagerProfileFailed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Successfully removed Traffic Manager profile with name {0}.. + /// + public static string RemoveTrafficManagerProfileSucceeded + { + get + { + return ResourceManager.GetString("RemoveTrafficManagerProfileSucceeded", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to remove the Traffic Manager profile "{0}"?. + /// + public static string RemoveTrafficManagerProfileWarning + { + get + { + return ResourceManager.GetString("RemoveTrafficManagerProfileWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to delete the VM '{0}'?. + /// + public static string RemoveVMConfirmationMessage + { + get + { + return ResourceManager.GetString("RemoveVMConfirmationMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Deleting VM.. + /// + public static string RemoveVMMessage + { + get + { + return ResourceManager.GetString("RemoveVMMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing WebJob.... + /// + public static string RemoveWebJobMessage + { + get + { + return ResourceManager.GetString("RemoveWebJobMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to remove job '{0}'?. + /// + public static string RemoveWebJobWarning + { + get + { + return ResourceManager.GetString("RemoveWebJobWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing website. + /// + public static string RemoveWebsiteMessage + { + get + { + return ResourceManager.GetString("RemoveWebsiteMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to remove the website "{0}". + /// + public static string RemoveWebsiteWarning + { + get + { + return ResourceManager.GetString("RemoveWebsiteWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing public environment is not supported.. + /// + public static string RemovingDefaultEnvironmentsNotSupported + { + get + { + return ResourceManager.GetString("RemovingDefaultEnvironmentsNotSupported", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Deleting namespace. + /// + public static string RemovingNamespaceMessage + { + get + { + return ResourceManager.GetString("RemovingNamespaceMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Repository is not setup. You need to pass a valid site name.. + /// + public static string RepositoryNotSetup + { + get + { + return ResourceManager.GetString("RepositoryNotSetup", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Reserved IP with the Name:'{0}' will no longer be in use after the deployment is deleted, and it is still reserved for later use.. + /// + public static string ReservedIPNameNoLongerInUseButStillBeingReserved + { + get + { + return ResourceManager.GetString("ReservedIPNameNoLongerInUseButStillBeingReserved", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Resource with ID : {0} does not exist.. + /// + public static string ResourceNotFound + { + get + { + return ResourceManager.GetString("ResourceNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Restart. + /// + public static string Restart + { + get + { + return ResourceManager.GetString("Restart", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Resume. + /// + public static string Resume + { + get + { + return ResourceManager.GetString("Resume", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to /role:{0};"{1}/{0}" . + /// + public static string RoleArgTemplate + { + get + { + return ResourceManager.GetString("RoleArgTemplate", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to bin. + /// + public static string RoleBinFolderName + { + get + { + return ResourceManager.GetString("RoleBinFolderName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Role {0} is {1}. + /// + public static string RoleInstanceWaitMsg + { + get + { + return ResourceManager.GetString("RoleInstanceWaitMsg", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to 20. + /// + public static string RoleMaxInstances + { + get + { + return ResourceManager.GetString("RoleMaxInstances", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to role name. + /// + public static string RoleName + { + get + { + return ResourceManager.GetString("RoleName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The provided role name {0} doesn't exist. + /// + public static string RoleNotFoundMessage + { + get + { + return ResourceManager.GetString("RoleNotFoundMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to RoleSettings.xml. + /// + public static string RoleSettingsTemplateFileName + { + get + { + return ResourceManager.GetString("RoleSettingsTemplateFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Role type {0} doesn't exist. + /// + public static string RoleTypeDoesNotExist + { + get + { + return ResourceManager.GetString("RoleTypeDoesNotExist", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to public static Dictionary<string, Location> ReverseLocations { get; private set; }. + /// + public static string RuntimeDeploymentLocationError + { + get + { + return ResourceManager.GetString("RuntimeDeploymentLocationError", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Preparing runtime deployment for service '{0}'. + /// + public static string RuntimeDeploymentStart + { + get + { + return ResourceManager.GetString("RuntimeDeploymentStart", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to WARNING Runtime Mismatch: Are you sure that you want to publish service '{0}' using an Azure runtime version that does not match your local runtime version?. + /// + public static string RuntimeMismatchWarning + { + get + { + return ResourceManager.GetString("RuntimeMismatchWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to RUNTIMEOVERRIDEURL. + /// + public static string RuntimeOverrideKey + { + get + { + return ResourceManager.GetString("RuntimeOverrideKey", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to /runtimemanifest/runtimes/runtime. + /// + public static string RuntimeQuery + { + get + { + return ResourceManager.GetString("RuntimeQuery", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to RUNTIMEID. + /// + public static string RuntimeTypeKey + { + get + { + return ResourceManager.GetString("RuntimeTypeKey", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to RUNTIMEURL. + /// + public static string RuntimeUrlKey + { + get + { + return ResourceManager.GetString("RuntimeUrlKey", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to RUNTIMEVERSIONPRIMARYKEY. + /// + public static string RuntimeVersionPrimaryKey + { + get + { + return ResourceManager.GetString("RuntimeVersionPrimaryKey", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to scaffold.xml. + /// + public static string ScaffoldXml + { + get + { + return ResourceManager.GetString("ScaffoldXml", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Invalid location entered. Pick one of the locations from Get-AzureSchedulerLocation. + /// + public static string SchedulerInvalidLocation + { + get + { + return ResourceManager.GetString("SchedulerInvalidLocation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to A value for the Secondary Peer Subnet has to be provided.. + /// + public static string SecondaryPeerSubnetRequired + { + get + { + return ResourceManager.GetString("SecondaryPeerSubnetRequired", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Service {0} already exists on disk in location {1}. + /// + public static string ServiceAlreadyExistsOnDisk + { + get + { + return ResourceManager.GetString("ServiceAlreadyExistsOnDisk", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No ServiceBus authorization rule with the given characteristics was found. + /// + public static string ServiceBusAuthorizationRuleNotFound + { + get + { + return ResourceManager.GetString("ServiceBusAuthorizationRuleNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The service bus entity '{0}' is not found.. + /// + public static string ServiceBusEntityTypeNotFound + { + get + { + return ResourceManager.GetString("ServiceBusEntityTypeNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Internal Server Error. This could happen due to an incorrect/missing namespace. + /// + public static string ServiceBusNamespaceMissingMessage + { + get + { + return ResourceManager.GetString("ServiceBusNamespaceMissingMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to service configuration. + /// + public static string ServiceConfiguration + { + get + { + return ResourceManager.GetString("ServiceConfiguration", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to service definition. + /// + public static string ServiceDefinition + { + get + { + return ResourceManager.GetString("ServiceDefinition", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ServiceDefinition.csdef. + /// + public static string ServiceDefinitionFileName + { + get + { + return ResourceManager.GetString("ServiceDefinitionFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0}Deploy. + /// + public static string ServiceDeploymentName + { + get + { + return ResourceManager.GetString("ServiceDeploymentName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The specified cloud service "{0}" does not exist.. + /// + public static string ServiceDoesNotExist + { + get + { + return ResourceManager.GetString("ServiceDoesNotExist", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} slot for service {1} is in {2} state, please wait until it finish and update it's status. + /// + public static string ServiceIsInTransitionState + { + get + { + return ResourceManager.GetString("ServiceIsInTransitionState", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to "An exception occurred when calling the ServiceManagement API. HTTP Status Code: {0}. Service Management Error Code: {1}. Message: {2}. Operation Tracking ID: {3}.". + /// + public static string ServiceManagementClientExceptionStringFormat + { + get + { + return ResourceManager.GetString("ServiceManagementClientExceptionStringFormat", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Begin Operation: {0}. + /// + public static string ServiceManagementExecuteClientActionBeginOperation + { + get + { + return ResourceManager.GetString("ServiceManagementExecuteClientActionBeginOperation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Completed Operation: {0}. + /// + public static string ServiceManagementExecuteClientActionCompletedOperation + { + get + { + return ResourceManager.GetString("ServiceManagementExecuteClientActionCompletedOperation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Begin Operation: {0}. + /// + public static string ServiceManagementExecuteClientActionInOCSBeginOperation + { + get + { + return ResourceManager.GetString("ServiceManagementExecuteClientActionInOCSBeginOperation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Completed Operation: {0}. + /// + public static string ServiceManagementExecuteClientActionInOCSCompletedOperation + { + get + { + return ResourceManager.GetString("ServiceManagementExecuteClientActionInOCSCompletedOperation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to service name. + /// + public static string ServiceName + { + get + { + return ResourceManager.GetString("ServiceName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The provided service name {0} already exists, please pick another name. + /// + public static string ServiceNameExists + { + get + { + return ResourceManager.GetString("ServiceNameExists", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Please provide name for the hosted service. + /// + public static string ServiceNameMissingMessage + { + get + { + return ResourceManager.GetString("ServiceNameMissingMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to service parent directory. + /// + public static string ServiceParentDirectory + { + get + { + return ResourceManager.GetString("ServiceParentDirectory", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Service {0} removed successfully. + /// + public static string ServiceRemovedMessage + { + get + { + return ResourceManager.GetString("ServiceRemovedMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to service directory. + /// + public static string ServiceRoot + { + get + { + return ResourceManager.GetString("ServiceRoot", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to service settings. + /// + public static string ServiceSettings + { + get + { + return ResourceManager.GetString("ServiceSettings", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The storage account name '{0}' is invalid. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only.. + /// + public static string ServiceSettings_ValidateStorageAccountName_InvalidName + { + get + { + return ResourceManager.GetString("ServiceSettings_ValidateStorageAccountName_InvalidName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The {0} slot for cloud service {1} doesn't exist.. + /// + public static string ServiceSlotDoesNotExist + { + get + { + return ResourceManager.GetString("ServiceSlotDoesNotExist", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} slot for service {1} is {2}. + /// + public static string ServiceStatusChanged + { + get + { + return ResourceManager.GetString("ServiceStatusChanged", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Set Add-On Confirmation. + /// + public static string SetAddOnConformation + { + get + { + return ResourceManager.GetString("SetAddOnConformation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Profile {0} does not contain endpoint {1}. Adding it.. + /// + public static string SetInexistentTrafficManagerEndpointMessage + { + get + { + return ResourceManager.GetString("SetInexistentTrafficManagerEndpointMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Note - You will be charged the amount for the new plan, without being refunded for time remaining + ///in the existing plan. + ///By typing "Yes", I (a) authorize Microsoft to charge my current payment method on a monthly basis + ///for the amount indicated at {0} for {1} until my service is cancelled or terminated, and (b) + ///agree to the {2}'s terms of user and privacy statement at {0} and (c) agree to sharing my + ///contact information with {2}.. + /// + public static string SetMicrosoftAddOnMessage + { + get + { + return ResourceManager.GetString("SetMicrosoftAddOnMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Note - You will be charged the amount for the new plan, without being refunded for time remaining + ///in the existing plan. + ///By typing "Yes", I (a) authorize Microsoft to charge my current payment method on a monthly basis + ///for the amount indicated at {0} for {1} until my service is cancelled or terminated, and (b) + ///acknowledge the offering is provided by {2}, not Microsoft, and agree to {2}'s terms of + ///use and privacy statement at <url> and (c) agree to sharing my contact information with {2}.. + /// + public static string SetNonMicrosoftAddOnMessage + { + get + { + return ResourceManager.GetString("SetNonMicrosoftAddOnMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Role {0} instances are set to {1}. + /// + public static string SetRoleInstancesMessage + { + get + { + return ResourceManager.GetString("SetRoleInstancesMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {"Slot":"","Location":"","Subscription":"","StorageAccountName":""}. + /// + public static string SettingsFileEmptyContent + { + get + { + return ResourceManager.GetString("SettingsFileEmptyContent", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to deploymentSettings.json. + /// + public static string SettingsFileName + { + get + { + return ResourceManager.GetString("SettingsFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Insufficient parameters passed to create a new endpoint.. + /// + public static string SetTrafficManagerEndpointNeedsParameters + { + get + { + return ResourceManager.GetString("SetTrafficManagerEndpointNeedsParameters", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Ambiguous operation: the profile name specified doesn't match the name of the profile object.. + /// + public static string SetTrafficManagerProfileAmbiguous + { + get + { + return ResourceManager.GetString("SetTrafficManagerProfileAmbiguous", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Please execute the cmdlet again and include the 'Force' parameter, if available, to avoid unnecessary prompts.. + /// + public static string ShouldContinueFail + { + get + { + return ResourceManager.GetString("ShouldContinueFail", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Confirm. + /// + public static string ShouldProcessCaption + { + get + { + return ResourceManager.GetString("ShouldProcessCaption", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Please execute the cmdlet again and omit the 'Confirm' parameter when using the 'AsJob' parameter.. + /// + public static string ShouldProcessFailConfirm + { + get + { + return ResourceManager.GetString("ShouldProcessFailConfirm", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Please increase the user $ConfirmPreference setting, or include turn off confirmation using '-Confirm:$false' when using the 'AsJob' parameter and execute the cmdet again.. + /// + public static string ShouldProcessFailImpact + { + get + { + return ResourceManager.GetString("ShouldProcessFailImpact", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Please execute the cmdlet again and omit the 'WhatIf' parameter when using the 'AsJob' parameter.. + /// + public static string ShouldProcessFailWhatIf + { + get + { + return ResourceManager.GetString("ShouldProcessFailWhatIf", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Shutdown. + /// + public static string Shutdown + { + get + { + return ResourceManager.GetString("Shutdown", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to /sites:{0};{1};"{2}/{0}" . + /// + public static string SitesArgTemplate + { + get + { + return ResourceManager.GetString("SitesArgTemplate", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to 1000. + /// + public static string StandardRetryDelayInMs + { + get + { + return ResourceManager.GetString("StandardRetryDelayInMs", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Start. + /// + public static string Start + { + get + { + return ResourceManager.GetString("Start", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Started. + /// + public static string StartedEmulator + { + get + { + return ResourceManager.GetString("StartedEmulator", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Starting Emulator.... + /// + public static string StartingEmulator + { + get + { + return ResourceManager.GetString("StartingEmulator", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to start. + /// + public static string StartStorageEmulatorCommandArgument + { + get + { + return ResourceManager.GetString("StartStorageEmulatorCommandArgument", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Stop. + /// + public static string Stop + { + get + { + return ResourceManager.GetString("Stop", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Stopping emulator.... + /// + public static string StopEmulatorMessage + { + get + { + return ResourceManager.GetString("StopEmulatorMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Stopped. + /// + public static string StoppedEmulatorMessage + { + get + { + return ResourceManager.GetString("StoppedEmulatorMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to stop. + /// + public static string StopStorageEmulatorCommandArgument + { + get + { + return ResourceManager.GetString("StopStorageEmulatorCommandArgument", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Account Name:. + /// + public static string StorageAccountName + { + get + { + return ResourceManager.GetString("StorageAccountName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot find storage account '{0}' please type the name of an existing storage account.. + /// + public static string StorageAccountNotFound + { + get + { + return ResourceManager.GetString("StorageAccountNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to AzureStorageEmulator.exe. + /// + public static string StorageEmulatorExe + { + get + { + return ResourceManager.GetString("StorageEmulatorExe", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to InstallPath. + /// + public static string StorageEmulatorInstallPathRegistryKeyValue + { + get + { + return ResourceManager.GetString("StorageEmulatorInstallPathRegistryKeyValue", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to SOFTWARE\Microsoft\Windows Azure Storage Emulator. + /// + public static string StorageEmulatorRegistryKey + { + get + { + return ResourceManager.GetString("StorageEmulatorRegistryKey", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Primary Key:. + /// + public static string StoragePrimaryKey + { + get + { + return ResourceManager.GetString("StoragePrimaryKey", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Secondary Key:. + /// + public static string StorageSecondaryKey + { + get + { + return ResourceManager.GetString("StorageSecondaryKey", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The subscription named {0} already exists.. + /// + public static string SubscriptionAlreadyExists + { + get + { + return ResourceManager.GetString("SubscriptionAlreadyExists", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The SubscriptionDataFile parameter is deprecated. This parameter will be removed in a future release. See https://github.com/Azure/azure-powershell/wiki/Proposed-Design-Stateless-Azure-Profile for a description of the upcoming mechanism for providing alternate sources of subscription information.. + /// + public static string SubscriptionDataFileDeprecated + { + get + { + return ResourceManager.GetString("SubscriptionDataFileDeprecated", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to DefaultSubscriptionData.xml. + /// + public static string SubscriptionDataFileName + { + get + { + return ResourceManager.GetString("SubscriptionDataFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The subscription data file {0} does not exist.. + /// + public static string SubscriptionDataFileNotFound + { + get + { + return ResourceManager.GetString("SubscriptionDataFileNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The subscription id {0} doesn't exist.. + /// + public static string SubscriptionIdNotFoundMessage + { + get + { + return ResourceManager.GetString("SubscriptionIdNotFoundMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Subscription must not be null. + /// + public static string SubscriptionMustNotBeNull + { + get + { + return ResourceManager.GetString("SubscriptionMustNotBeNull", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Subscription name needs to be specified.. + /// + public static string SubscriptionNameNeedsToBeSpecified + { + get + { + return ResourceManager.GetString("SubscriptionNameNeedsToBeSpecified", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The subscription name {0} doesn't exist.. + /// + public static string SubscriptionNameNotFoundMessage + { + get + { + return ResourceManager.GetString("SubscriptionNameNotFoundMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Subscription needs to be specified.. + /// + public static string SubscriptionNeedsToBeSpecified + { + get + { + return ResourceManager.GetString("SubscriptionNeedsToBeSpecified", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Suspend. + /// + public static string Suspend + { + get + { + return ResourceManager.GetString("Suspend", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Swapping website production slot .... + /// + public static string SwappingWebsite + { + get + { + return ResourceManager.GetString("SwappingWebsite", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to swap the website '{0}' production slot with slot '{1}'?. + /// + public static string SwapWebsiteSlotWarning + { + get + { + return ResourceManager.GetString("SwapWebsiteSlotWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The Switch-AzureMode cmdlet is deprecated and will be removed in a future release.. + /// + public static string SwitchAzureModeDeprecated + { + get + { + return ResourceManager.GetString("SwitchAzureModeDeprecated", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [AzureLongRunningJob]: Starting cmdlet execution, setting for cmdlet confirmation required: '{0}'. + /// + public static string TraceBeginLROJob + { + get + { + return ResourceManager.GetString("TraceBeginLROJob", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [AzureLongRunningJob]: Blocking job for ShouldMethod '{0}'. + /// + public static string TraceBlockLROThread + { + get + { + return ResourceManager.GetString("TraceBlockLROThread", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [AzureLongRunningJob]: Completing cmdlet execution in RunJob. + /// + public static string TraceEndLROJob + { + get + { + return ResourceManager.GetString("TraceEndLROJob", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [AzureLongRunningJob]: State change from '{0}' to '{1}' because '{2}'. + /// + public static string TraceHandleLROStateChange + { + get + { + return ResourceManager.GetString("TraceHandleLROStateChange", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [AzureLongRunningJob]: Unblocking job due to stoppage or failure. + /// + public static string TraceHandlerCancelJob + { + get + { + return ResourceManager.GetString("TraceHandlerCancelJob", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [AzureLongRunningJob]: Unblocking job that was previously blocked.. + /// + public static string TraceHandlerUnblockJob + { + get + { + return ResourceManager.GetString("TraceHandlerUnblockJob", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [AzureLongRunningJob]: Error in cmdlet execution. + /// + public static string TraceLROJobException + { + get + { + return ResourceManager.GetString("TraceLROJobException", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [AzureLongRunningJob]: Removing state changed event handler, exception '{0}'. + /// + public static string TraceRemoveLROEventHandler + { + get + { + return ResourceManager.GetString("TraceRemoveLROEventHandler", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [AzureLongRunningJob]: ShouldMethod '{0}' unblocked.. + /// + public static string TraceUnblockLROThread + { + get + { + return ResourceManager.GetString("TraceUnblockLROThread", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Unable to decode string from base 64. Please make sure the string is correctly encoded: {0}.. + /// + public static string UnableToDecodeBase64String + { + get + { + return ResourceManager.GetString("UnableToDecodeBase64String", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Unable to update mismatching Json structured: {0} {1}.. + /// + public static string UnableToPatchJson + { + get + { + return ResourceManager.GetString("UnableToPatchJson", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The provider {0} is unknown.. + /// + public static string UnknownProviderMessage + { + get + { + return ResourceManager.GetString("UnknownProviderMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Update. + /// + public static string Update + { + get + { + return ResourceManager.GetString("Update", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Updated settings for subscription '{0}'. Current subscription is '{1}'.. + /// + public static string UpdatedSettings + { + get + { + return ResourceManager.GetString("UpdatedSettings", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to User name is not valid.. + /// + public static string UserNameIsNotValid + { + get + { + return ResourceManager.GetString("UserNameIsNotValid", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to User name needs to be specified.. + /// + public static string UserNameNeedsToBeSpecified + { + get + { + return ResourceManager.GetString("UserNameNeedsToBeSpecified", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to A value for the VLan Id has to be provided.. + /// + public static string VlanIdRequired + { + get + { + return ResourceManager.GetString("VlanIdRequired", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Please wait.... + /// + public static string WaitMessage + { + get + { + return ResourceManager.GetString("WaitMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The azure storage emulator is not installed, skip launching.... + /// + public static string WarningWhenStorageEmulatorIsMissing + { + get + { + return ResourceManager.GetString("WarningWhenStorageEmulatorIsMissing", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Web.cloud.config. + /// + public static string WebCloudConfig + { + get + { + return ResourceManager.GetString("WebCloudConfig", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to web.config. + /// + public static string WebConfigTemplateFileName + { + get + { + return ResourceManager.GetString("WebConfigTemplateFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to MSDeploy. + /// + public static string WebDeployKeywordInWebSitePublishProfile + { + get + { + return ResourceManager.GetString("WebDeployKeywordInWebSitePublishProfile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot build the project successfully. Please see logs in {0}.. + /// + public static string WebProjectBuildFailTemplate + { + get + { + return ResourceManager.GetString("WebProjectBuildFailTemplate", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to WebRole. + /// + public static string WebRole + { + get + { + return ResourceManager.GetString("WebRole", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to setup_web.cmd > log.txt. + /// + public static string WebRoleStartupTaskCommandLine + { + get + { + return ResourceManager.GetString("WebRoleStartupTaskCommandLine", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to WebRole.xml. + /// + public static string WebRoleTemplateFileName + { + get + { + return ResourceManager.GetString("WebRoleTemplateFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to WebSite with given name {0} already exists in the specified Subscription and Webspace.. + /// + public static string WebsiteAlreadyExists + { + get + { + return ResourceManager.GetString("WebsiteAlreadyExists", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to WebSite with given name {0} already exists in the specified Subscription and Location.. + /// + public static string WebsiteAlreadyExistsReplacement + { + get + { + return ResourceManager.GetString("WebsiteAlreadyExistsReplacement", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Site {0} already has repository created for it.. + /// + public static string WebsiteRepositoryAlreadyExists + { + get + { + return ResourceManager.GetString("WebsiteRepositoryAlreadyExists", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Workspaces/WebsiteExtension/Website/{0}/dashboard/. + /// + public static string WebsiteSufixUrl + { + get + { + return ResourceManager.GetString("WebsiteSufixUrl", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to https://{0}/msdeploy.axd?site={1}. + /// + public static string WebSiteWebDeployUriTemplate + { + get + { + return ResourceManager.GetString("WebSiteWebDeployUriTemplate", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to WorkerRole. + /// + public static string WorkerRole + { + get + { + return ResourceManager.GetString("WorkerRole", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to setup_worker.cmd > log.txt. + /// + public static string WorkerRoleStartupTaskCommandLine + { + get + { + return ResourceManager.GetString("WorkerRoleStartupTaskCommandLine", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to WorkerRole.xml. + /// + public static string WorkerRoleTemplateFileName + { + get + { + return ResourceManager.GetString("WorkerRoleTemplateFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to (x86). + /// + public static string x86InProgramFiles + { + get + { + return ResourceManager.GetString("x86InProgramFiles", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Yes. + /// + public static string Yes + { + get + { + return ResourceManager.GetString("Yes", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Yes, I agree. + /// + public static string YesHint + { + get + { + return ResourceManager.GetString("YesHint", resourceCulture); + } + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Properties/Resources.resx b/src/Security/Security.Autorest/generated/runtime/Properties/Resources.resx new file mode 100644 index 000000000000..a08a2e50172b --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Properties/Resources.resx @@ -0,0 +1,1747 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + The remote server returned an error: (401) Unauthorized. + + + Account "{0}" has been added. + + + To switch to a different subscription, please use Select-AzureSubscription. + + + Subscription "{0}" is selected as the default subscription. + + + To view all the subscriptions, please use Get-AzureSubscription. + + + Add-On {0} is created successfully. + + + Add-on name {0} is already used. + + + Add-On {0} not found. + + + Add-on {0} is removed successfully. + + + Add-On {0} is updated successfully. + + + Role has been created at {0}\{1}. + + + Role has been created at {0}\{1}. For easy access to Microsoft Azure services from your application code, install the Microsoft Azure client library for Node.js by running ‘npm install azure’. + + + Role has been created at {0}\{1}. For easy access to Microsoft Azure services from your application code, install the Microsoft Azure client library for PHP by running "pear WindowsAzure/WindowsAzure". + + + Unable to set role permissions. Please give the 'Network Service' user 'Read & execute' and 'Modify' permissions to the role folder, or run PowerShell as an Administrator + + + A role name '{0}' already exists + + + Windows Azure Powershell\ + + + https://manage.windowsazure.com + + + AZURE_PORTAL_URL + + + Azure SDK\{0}\ + + + Base Uri was empty. + WAPackIaaS + + + {0} begin processing without ParameterSet. + + + {0} begin processing with ParameterSet '{1}'. + + + Blob with the name {0} already exists in the account. + + + https://{0}.blob.core.windows.net/ + + + AZURE_BLOBSTORAGE_TEMPLATE + + + CACHERUNTIMEURL + + + cache + + + CacheRuntimeVersion + + + Installing caching version {0} for Role '{1}' (the caching version locally installed is: {2}) + + + Cannot find {0} with name {1}. + + + Deployment for service {0} with {1} slot doesn't exist + + + Can't find valid Microsoft Azure role in current directory {0} + + + service {0} configuration file (ServiceConfiguration.Cloud.cscfg) is either null or doesn't exist + + + Invalid service path! Cannot locate ServiceDefinition.csdef in current folder or parent folders. + + + The subscription named {0} with id {1} is not currently imported. You must import this subscription before it can be updated. + + + ManagementCertificate + + + certificate.pfx + + + Certificate imported into CurrentUser\My\{0} + + + Your account does not have access to the private key for certificate {0} + + + {0} {1} deployment for {2} service + + + Cloud service {0} is in {1} state. + + + Changing/Removing public environment '{0}' is not allowed. + + + Service {0} is set to value {1} + + + Choose which publish settings file to use: + + + Microsoft.WindowsAzure.Plugins.Caching.ClientDiagnosticLevel + + + 1 + + + cloud_package.cspkg + + + ServiceConfiguration.Cloud.cscfg + + + Add-ons for {0} + + + Communication could not be established. This could be due to an invalid subscription ID. Note that subscription IDs are case sensitive. + + + Complete + + + config.json + + + VirtualMachine creation failed. + WAPackIaaS + + + Creating the website failed. If this is the first website for this subscription, please create it using the management portal instead. + + + Microsoft.ApplicationServer.Caching.DataCacheClientsSection, Microsoft.ApplicationServer.Caching.Core + + + //blobcontainer[@datacenter='{0}'] + + + Setting: {0} as the default and current subscription. To view other subscriptions use Get-AzureSubscription + + + none + + + There are no hostnames which could be used for validation. + + + 8080 + + + 1000 + + + Auto + + + 80 + + + Delete + WAPackIaaS + + + The {0} slot for service {1} is already in {2} state + + + The deployment in {0} slot for service {1} is removed + + + Microsoft.WindowsAzure.Plugins.Caching.DiagnosticLevel + + + 1 + + + The key to add already exists in the dictionary. + + + The array index cannot be less than zero. + + + The supplied array does not have enough room to contain the copied elements. + + + The provided dns {0} doesn't exist + + + Microsoft Azure Certificate + + + Endpoint can't be retrieved for storage account + + + {0} end processing. + + + To use Active Directory authentication, you must configure the ActiveDirectoryEndpoint, ActiveDirectoryTenantId, and ActiveDirectorServiceEndpointResourceId for environment of '{0}'. You can configure these properties for this environment using the Set-AzureEnvironment cmdlet. + + + The environment '{0}' already exists. + + + environments.xml + + + Error creating VirtualMachine + WAPackIaaS + + + Unable to download available runtimes for location '{0}' + + + Error updating VirtualMachine + WAPackIaaS + + + Job Id {0} failed. Error: {1}, ExceptionDetails: {2} + WAPackIaaS + + + The HTTP request was forbidden with client authentication scheme 'Anonymous'. + + + This add-on requires you to purchase the first instance through the Microsoft Azure Portal. Subsequent purchases can be performed through PowerShell. + + + Operation Status: + + + Resources\Scaffolding\General + + + Getting all available Microsoft Azure Add-Ons, this may take few minutes... + + + Name{0}Primary Key{0}Seconday Key + + + Git not found. Please install git and place it in your command line path. + + + Could not find publish settings. Please run Import-AzurePublishSettingsFile. + + + iisnode.dll + + + iisnode + + + iisnode-dev\\release\\x64 + + + iisnode + + + Installing IISNode version {0} in Azure for WebRole '{1}' (the version locally installed is: {2}) + + + Internal Server Error + + + Cannot enable memcach protocol on a cache worker role {0}. + + + Invalid certificate format. + + + The provided configuration path is invalid or doesn't exist + + + The country name is invalid, please use a valid two character country code, as described in ISO 3166-1 alpha-2. + + + Deployment with {0} does not exist + + + The deployment slot name {0} is invalid. Slot name must be either "Staging" or "Production". + + + Invalid service endpoint. + + + File {0} has invalid characters + + + You must create your git publishing credentials using the Microsoft Azure portal. +Please follow these steps in the portal: +1. On the left side open "Web Sites" +2. Click on any website +3. Choose "Setup Git Publishing" or "Reset deployment credentials" +4. Back in the PowerShell window, rerun this command by typing "New-AzureWebSite {site name} -Git -PublishingUsername {username} + + + The value {0} provided is not a valid GUID. Please provide a valid GUID. + + + The specified hostname does not exist. Please specify a valid hostname for the site. + + + Role {0} instances must be greater than or equal 0 and less than or equal 20 + + + There was an error creating your webjob. Please make sure that the script is in the root folder of the zip file. + + + Could not download a valid runtime manifest, Please check your internet connection and try again. + + + The account {0} was not found. Please specify a valid account name. + + + The provided name "{0}" does not match the service bus namespace naming rules. + + + Value cannot be null. Parameter name: '{0}' + + + The provided package path is invalid or doesn't exist + + + '{0}' is an invalid parameter set name. + + + {0} doesn't exist in {1} or you've not passed valid value for it + + + Path {0} has invalid characters + + + The provided publish settings file {0} has invalid content. Please get valid by running cmdlet Get-AzurePublishSettingsFile + + + The provided role name "{0}" has invalid characters + + + A valid name for the service root folder is required + + + {0} is not a recognized runtime type + + + A valid language is required + + + No subscription is currently selected. Use Select-Subscription to activate a subscription. + + + The provided location "{0}" does not exist in the available locations use Get-AzureSBLocation for listing available locations. + + + Please provide a service name or run this command from inside a service project directory. + + + You must provide valid value for {0} + + + settings.json is invalid or doesn't exist + + + The subscription named '{0}' cannot be found. Use Set-AzureSubscription to initialize the subscription data. + + + The provided subscription id {0} is not valid + + + A valid subscription name is required. This can be provided using the -Subscription parameter or by setting the subscription via the Set-AzureSubscription cmdlet + + + The provided subscriptions file {0} has invalid content. + + + Role {0} VM size should be ExtraSmall, Small, Medium, Large or ExtraLarge. + + + The web job file must have *.zip extension + + + Singleton option works for continuous jobs only. + + + The website {0} was not found. Please specify a valid website name. + + + No job for id: {0} was found. + WAPackIaaS + + + engines + + + Scaffolding for this language is not yet supported + + + Link already established + + + local_package.csx + + + ServiceConfiguration.Local.cscfg + + + Looking for {0} deployment for {1} cloud service... + + + Looking for cloud service {0}... + + + managementCertificate.pem + + + ?whr={0} + + + //baseuri + + + uri + + + http://az413943.vo.msecnd.net/node/runtimemanifest_0.7.5.2.xml + + + Multiple Add-Ons found holding name {0} + + + Multiple possible publishing users. Please go to the Portal and use the listed deployment user, or click 'set/reset deployment credentials' to set up a new user account, then reurn this cmdlet and specify PublishingUsername. + + + The first publish settings file "{0}" is used. If you want to use another file specify the file name. + + + Microsoft.WindowsAzure.Plugins.Caching.NamedCaches + + + {"caches":[{"name":"default","policy":{"eviction":{"type":0},"expiration":{"defaultTTL":10,"isExpirable":true,"type":1},"serverNotification":{"isEnabled":false}},"secondaries":0}]} + + + A publishing username is required. Please specify one using the argument PublishingUsername. + + + New Add-On Confirmation + + + By typing "Yes", I (a) authorize Microsoft to charge my current payment method on a monthly basis +for the amount indicated at {0} for {1} until my service is cancelled or terminated, and (b) +agree to the {2}'s terms of user and privacy statement at {0} and (c) agree to sharing my +contact information with {2}. + + + Internal Server Error. This could happen because the namespace name is already used or due to an incorrect location name. Use Get-AzureSBLocation cmdlet to list valid names. + + + By typing "Yes", I (a) authorize Microsoft to charge my current payment method on a monthly basis +for the amount indicated at {0} for {1} until my service is cancelled or terminated, and (b) +acknowledge the offering is provided by {2}, not Microsoft, and agree to {2}'s terms of +use and privacy statement at {0} and (c) agree to sharing my contact information with {2}. + + + Service has been created at {0} + + + No + + + There is no access token cached for subscription {0}, user id {1}. Use the Add-AzureAccount cmdlet to log in again and get a token for this subscription. + + + The service does not have any cache worker roles, add one first by running cmdlet Add-AzureCacheWorkerRole. + + + No clouds available + WAPackIaaS + + + nodejs + + + node + + + node.exe + + + There is no default subscription set, please set a default subscription by running Set-AzureSubscription -Default <subscription name> + + + Microsoft SDKs\Azure\Nodejs\Nov2011 + + + nodejs + + + node + + + Resources\Scaffolding\Node + + + Microsoft.WindowsAzure.Commands.CloudService.ScaffoldingResources.Node + + + Installing Node version {0} in Azure for Role '{1}' (the Node version locally installed is: {2}) + + + No, I do not agree + + + No publish settings files with extension *.publishsettings are found in the directory "{0}". + + + '{0}' must be a cache worker role. Verify that it has proper cache worker role configuration. + + + Certificate can't be null. + + + {0} could not be null or empty + + + Unable to add a null RoleSettings to {0} + + + Unable to add new role to null service definition + + + The request offer '{0}' is not found. + + + Operation "{0}" failed on VM with ID: {1} + WAPackIaaS + + + The REST operation failed with message '{0}' and error code '{1}' + + + Job Id {0} did not complete within expected time or it is in Failed/Canceled/Invalid state. + WAPackIaaS + + + package + + + Package is created at service root path {0}. + + + {{ + "author": "", + + "name": "{0}", + "version": "0.0.0", + "dependencies":{{}}, + "devDependencies":{{}}, + "optionalDependencies": {{}}, + "engines": {{ + "node": "*", + "iisnode": "*" + }} + +}} + + + + package.json + + + A value for the Peer Asn has to be provided. + + + 5.4.0 + + + php + + + Resources\Scaffolding\PHP + + + Microsoft.WindowsAzure.Commands.CloudService.ScaffoldingResources.PHP + + + Installing PHP version {0} for Role '{1}' (the PHP version locally installed is: {2}) + + + You must create your first web site using the Microsoft Azure portal. +Please follow these steps in the portal: +1. At the bottom of the page, click on New > Web Site > Quick Create +2. Type {0} in the URL field +3. Click on "Create Web Site" +4. Once the site has been created, click on the site name +5. Click on "Set up Git publishing" or "Reset deployment credentials" and setup a publishing username and password. Use those credentials for all new websites you create. + + + 6. Back in the console window, rerun this command by typing "New-AzureWebsite <site name> -Git" + + + A value for the Primary Peer Subnet has to be provided. + + + Promotion code can be used only when updating to a new plan. + + + Service not published at user request. + + + Complete. + + + Connecting... + + + Created Deployment ID: {0}. + + + Created hosted service '{0}'. + + + Created Website URL: {0}. + + + Creating... + + + Initializing... + + + busy + + + creating the virtual machine + + + Instance {0} of role {1} is {2}. + + + ready + + + Preparing deployment for {0} with Subscription ID: {1}... + + + Publishing {0} to Microsoft Azure. This may take several minutes... + + + publish settings + + + Azure + + + .PublishSettings + + + publishSettings.xml + + + Publish settings imported + + + AZURE_PUBLISHINGPROFILE_URL + + + Starting... + + + Upgrading... + + + Uploading Package to storage service {0}... + + + Verifying storage account '{0}'... + + + Replace current deployment with '{0}' Id ? + + + Are you sure you want to regenerate key? + + + Generate new key. + + + Are you sure you want to remove account '{0}'? + + + Removing account + + + Remove Add-On Confirmation + + + If you delete this add-on, your data may be deleted and the operation may not be undone. You may have to purchase it again from the Microsoft Azure Store to use it. The price of the add-on may not be refunded. Are you sure you want to delete this add-on? Enter “Yes” to confirm. + + + Remove-AzureBGPPeering Operation failed. + + + Removing Bgp Peering + + + Successfully removed Azure Bgp Peering with Service Key {0}. + + + Are you sure you want to remove the Bgp Peering with service key '{0}'? + + + Are you sure you want to remove the Dedicated Circuit with service key '{0}'? + + + Remove-AzureDedicatedCircuit Operation failed. + + + Remove-AzureDedicatedCircuitLink Operation failed. + + + Removing Dedicated Circui Link + + + Successfully removed Azure Dedicated Circuit Link with Service Key {0} and Vnet Name {1} + + + Are you sure you want to remove the Dedicated Circuit Link with service key '{0}' and virtual network name '{1}'? + + + Removing Dedicated Circuit + + + Successfully removed Azure Dedicated Circuit with Service Key {0}. + + + Removing cloud service {0}... + + + Removing {0} deployment for {1} service + + + Removing job collection + + + Are you sure you want to remove the job collection "{0}" + + + Removing job + + + Are you sure you want to remove the job "{0}" + + + Are you sure you want to remove the account? + + + Account removed. + + + Internal Server Error. This could happen because the namespace does not exist or it does not exist under your subscription. + + + Removing old package {0}... + + + Are you sure you want to delete the namespace '{0}'? + + + Are you sure you want to remove cloud service? + + + Remove cloud service and all it's deployments + + + Are you sure you want to remove subscription '{0}'? + + + Removing subscription + + + Are you sure you want to delete the VM '{0}'? + + + Deleting VM. + + + Removing WebJob... + + + Are you sure you want to remove job '{0}'? + + + Removing website + + + Are you sure you want to remove the website "{0}" + + + Deleting namespace + + + Repository is not setup. You need to pass a valid site name. + + + Reserved IP with the Name:'{0}' will no longer be in use after the deployment is deleted, and it is still reserved for later use. + + + Resource with ID : {0} does not exist. + WAPackIaaS + + + Restart + WAPackIaaS + + + Resume + WAPackIaaS + + + /role:{0};"{1}/{0}" + + + bin + + + Role {0} is {1} + + + 20 + + + role name + + + The provided role name {0} doesn't exist + + + RoleSettings.xml + + + Role type {0} doesn't exist + + + public static Dictionary<string, Location> ReverseLocations { get; private set; } + + + Preparing runtime deployment for service '{0}' + + + WARNING Runtime Mismatch: Are you sure that you want to publish service '{0}' using an Azure runtime version that does not match your local runtime version? + + + RUNTIMEOVERRIDEURL + + + /runtimemanifest/runtimes/runtime + + + RUNTIMEID + + + RUNTIMEURL + + + RUNTIMEVERSIONPRIMARYKEY + + + scaffold.xml + + + Invalid location entered. Pick one of the locations from Get-AzureSchedulerLocation + + + A value for the Secondary Peer Subnet has to be provided. + + + Service {0} already exists on disk in location {1} + + + No ServiceBus authorization rule with the given characteristics was found + + + The service bus entity '{0}' is not found. + + + Internal Server Error. This could happen due to an incorrect/missing namespace + + + service configuration + + + service definition + + + ServiceDefinition.csdef + + + {0}Deploy + + + The specified cloud service "{0}" does not exist. + + + {0} slot for service {1} is in {2} state, please wait until it finish and update it's status + + + Begin Operation: {0} + + + Completed Operation: {0} + + + Begin Operation: {0} + + + Completed Operation: {0} + + + service name + + + Please provide name for the hosted service + + + service parent directory + + + Service {0} removed successfully + + + service directory + + + service settings + + + The storage account name '{0}' is invalid. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + + + The {0} slot for cloud service {1} doesn't exist. + + + {0} slot for service {1} is {2} + + + Set Add-On Confirmation + + + Note - You will be charged the amount for the new plan, without being refunded for time remaining +in the existing plan. +By typing "Yes", I (a) authorize Microsoft to charge my current payment method on a monthly basis +for the amount indicated at {0} for {1} until my service is cancelled or terminated, and (b) +agree to the {2}'s terms of user and privacy statement at {0} and (c) agree to sharing my +contact information with {2}. + + + Note - You will be charged the amount for the new plan, without being refunded for time remaining +in the existing plan. +By typing "Yes", I (a) authorize Microsoft to charge my current payment method on a monthly basis +for the amount indicated at {0} for {1} until my service is cancelled or terminated, and (b) +acknowledge the offering is provided by {2}, not Microsoft, and agree to {2}'s terms of +use and privacy statement at <url> and (c) agree to sharing my contact information with {2}. + + + Role {0} instances are set to {1} + + + {"Slot":"","Location":"","Subscription":"","StorageAccountName":""} + + + deploymentSettings.json + + + Confirm + + + Shutdown + WAPackIaaS + + + /sites:{0};{1};"{2}/{0}" + + + 1000 + + + Start + WAPackIaaS + + + Started + + + Starting Emulator... + + + start + + + Stop + WAPackIaaS + + + Stopping emulator... + + + Stopped + + + stop + + + Account Name: + + + Cannot find storage account '{0}' please type the name of an existing storage account. + + + AzureStorageEmulator.exe + + + InstallPath + + + SOFTWARE\Microsoft\Windows Azure Storage Emulator + + + Primary Key: + + + Secondary Key: + + + The subscription named {0} already exists. + + + DefaultSubscriptionData.xml + + + The subscription data file {0} does not exist. + + + Subscription must not be null + WAPackIaaS + + + Suspend + WAPackIaaS + + + Swapping website production slot ... + + + Are you sure you want to swap the website '{0}' production slot with slot '{1}'? + + + The provider {0} is unknown. + + + Update + WAPackIaaS + + + Updated settings for subscription '{0}'. Current subscription is '{1}'. + + + A value for the VLan Id has to be provided. + + + Please wait... + + + The azure storage emulator is not installed, skip launching... + + + Web.cloud.config + + + web.config + + + MSDeploy + + + Cannot build the project successfully. Please see logs in {0}. + + + WebRole + + + setup_web.cmd > log.txt + + + WebRole.xml + + + WebSite with given name {0} already exists in the specified Subscription and Webspace. + + + WebSite with given name {0} already exists in the specified Subscription and Location. + + + Site {0} already has repository created for it. + + + Workspaces/WebsiteExtension/Website/{0}/dashboard/ + + + https://{0}/msdeploy.axd?site={1} + + + WorkerRole + + + setup_worker.cmd > log.txt + + + WorkerRole.xml + + + Yes + + + Yes, I agree + + + Remove-AzureTrafficManagerProfile Operation failed. + + + Successfully removed Traffic Manager profile with name {0}. + + + Are you sure you want to remove the Traffic Manager profile "{0}"? + + + Profile {0} already has an endpoint with name {1} + + + Profile {0} does not contain endpoint {1}. Adding it. + + + The endpoint {0} cannot be removed from profile {1} because it's not in the profile. + + + Insufficient parameters passed to create a new endpoint. + + + Ambiguous operation: the profile name specified doesn't match the name of the profile object. + + + <NONE> + + + "An exception occurred when calling the ServiceManagement API. HTTP Status Code: {0}. Service Management Error Code: {1}. Message: {2}. Operation Tracking ID: {3}." + {0} is the HTTP status code. {1} is the Service Management Error Code. {2} is the Service Management Error message. {3} is the operation tracking ID. + + + Unable to decode string from base 64. Please make sure the string is correctly encoded: {0}. + {0} is the string that is not in a valid base 64 format. + + + Skipping external tenant {0}, because you are using a guest or a foreign principal object identity. In order to access this tenant, please run Add-AzureAccount without "-Credential". + + + Removing an environment will remove all associated subscriptions and accounts. Are you sure you want to remove an environment '{0}'? + + + Removing environment + + + There is no subscription associated with account {0}. + + + Account id doesn't match one in subscription. + + + Environment name doesn't match one in subscription. + + + Removing the Azure profile will remove all associated environments, subscriptions, and accounts. Are you sure you want to remove the Azure profile? + + + Removing the Azure profile + + + The SubscriptionDataFile parameter is deprecated. This parameter will be removed in a future release. See https://github.com/Azure/azure-powershell/wiki/Proposed-Design-Stateless-Azure-Profile for a description of the upcoming mechanism for providing alternate sources of subscription information. + + + Account needs to be specified + + + No default subscription has been designated. Use Select-AzureSubscription -Default <subscriptionName> to set the default subscription. + + + Path must specify a valid path to an Azure profile. + + + Property bag Hashtable must contain one of the following sets of properties: {SubscriptionId, Certificate}, {SubscriptionId, Username, Password}, {SubscriptionId, ServicePrincipal, Password, Tenant}, {SubscriptionId, AccountId, Token} + + + Property bag Hashtable must contain a 'Certificate' of type 'X509Certificate2'. + + + Property bag Hashtable must contain a 'Password' with an associated 'Username' or 'ServicePrincipal'. + + + Property bag Hashtable must contain a 'SubscriptionId'. + + + Selected profile must not be null. + + + The Switch-AzureMode cmdlet is deprecated and will be removed in a future release. + + + OperationID : '{0}' + + + Cannot get module for DscResource '{0}'. Possible solutions: +1) Specify -ModuleName for Import-DscResource in your configuration. +2) Unblock module that contains resource. +3) Move Import-DscResource inside Node block. + + 0 = name of DscResource + + + Your current PowerShell version {1} is less then required by this cmdlet {0}. Consider download and install latest PowerShell version. + {0} = minimal required PS version, {1} = current PS version + + + Parsing configuration script: {0} + {0} is the path to a script file + + + Configuration script '{0}' contained parse errors: +{1} + 0 = path to the configuration script, 1 = parser errors + + + List of required modules: [{0}]. + {0} = list of modules + + + Temp folder '{0}' created. + {0} = temp folder path + + + Copy '{0}' to '{1}'. + {0} = source, {1} = destination + + + Copy the module '{0}' to '{1}'. + {0} = source, {1} = destination + + + File '{0}' already exists. Use the -Force parameter to overwrite it. + {0} is the path to a file + + + Configuration file '{0}' not found. + 0 = path to the configuration file + + + Path '{0}' not found. + 0 = path to the additional content file/directory + + + Path '{0}' not found. + 0 = path to the additional content file/directory + + + Invalid configuration file: {0}. +The file needs to be a PowerShell script (.ps1 or .psm1) or a ZIP archive (.zip). + 0 = path to the configuration file + + + Invalid configuration file: {0}. +The file needs to be a PowerShell script (.ps1 or .psm1). + 0 = path to the configuration file + + + Create Archive + + + Upload '{0}' + {0} is the name of an storage blob + + + Storage Blob '{0}' already exists. Use the -Force parameter to overwrite it. + {0} is the name of an storage blob + + + Configuration published to {0} + {0} is an URI + + + Deleted '{0}' + {0} is the path of a file + + + Cannot delete '{0}': {1} + {0} is the path of a file, {1} is an error message + + + Cannot find the WadCfg end element in the config. + + + WadCfg start element in the config is not matching the end element. + + + Cannot find the WadCfg element in the config. + + + Cannot find configuration data file: {0} + + + The configuration data must be a .psd1 file + + + Cannot change built-in environment {0}. + + + Azure PowerShell collects usage data in order to improve your experience. +The data is anonymous and does not include commandline argument values. +The data is collected by Microsoft. + +Use the Disable-AzDataCollection cmdlet to turn the feature Off. The cmdlet can be found in the Az.Accounts module. To disable data collection: PS > Disable-AzDataCollection. +Use the Enable-AzDataCollection cmdlet to turn the feature On. The cmdlet can be found in the Az.Accounts module. To enable data collection: PS > Enable-AzDataCollection. + + + Microsoft Azure PowerShell Data Collection Confirmation + + + You choose not to participate in Microsoft Azure PowerShell data collection. + + + This confirmation message will be dismissed in '{0}' second(s)... + + + You choose to participate in Microsoft Azure PowerShell data collection. + + + The setting profile has been saved to the following path '{0}'. + + + [Common.Authentication]: Authenticating for account {0} with single tenant {1}. + + + Changing public environment is not supported. + + + Environment name needs to be specified. + + + Environment needs to be specified. + + + The environment name '{0}' is not found. + + + File path is not valid. + + + Must specify a non-null subscription name. + + + The default subscription is being removed. Use Select-AzureSubscription -Default <subscriptionName> to select a new default subscription. + + + Removing public environment is not supported. + + + The subscription id {0} doesn't exist. + + + Subscription name needs to be specified. + + + The subscription name {0} doesn't exist. + + + Subscription needs to be specified. + + + User name is not valid. + + + User name needs to be specified. + + + "There is no current context, please log in using Connect-AzAccount." + + + No subscriptions are associated with the logged in account in Azure Service Management (RDFE). This means that the logged in user is not an administrator or co-administrator for any account.\r\nDid you mean to execute Connect-AzAccount? + + + No certificate was found in the certificate store with thumbprint {0} + + + Illegal characters in path. + + + Invalid certificate format. Publish settings may be corrupted. Use Get-AzurePublishSettingsFile to download updated settings + + + "{0}" is an invalid DNS name for {1} + + + The provided file in {0} must be have {1} extension + + + {0} is invalid or empty + + + Please connect to internet before executing this cmdlet + + + Path {0} doesn't exist. + + + Path for {0} doesn't exist in {1}. + + + &whr={0} + + + The provided service name {0} already exists, please pick another name + + + Unable to update mismatching Json structured: {0} {1}. + + + (x86) + + + Azure PowerShell collects usage data in order to improve your experience. +The data is anonymous and does not include commandline argument values. +The data is collected by Microsoft. + +Use the Disable-AzureDataCollection cmdlet to turn the feature Off. The cmdlet can be found in the Azure module. To disable data collection: PS > Disable-AzureDataCollection. +Use the Enable-AzureDataCollection cmdlet to turn the feature On. The cmdlet can be found in the Azure module. To enable data collection: PS > Enable-AzureDataCollection. + + + Execution failed because a background thread could not prompt the user. + + + Azure Long-Running Job + + + The cmdlet failed in background execution. The returned error was '{0}'. Please execute the cmdlet again. You may need to execute this cmdlet synchronously, by omitting the '-AsJob' parameter. + 0(string): exception message in background task + + + Please execute the cmdlet again and include the 'Force' parameter, if available, to avoid unnecessary prompts. + + + Please execute the cmdlet again and omit the 'Confirm' parameter when using the 'AsJob' parameter. + + + Please increase the user $ConfirmPreference setting, or include turn off confirmation using '-Confirm:$false' when using the 'AsJob' parameter and execute the cmdet again. + + + Please execute the cmdlet again and omit the 'WhatIf' parameter when using the 'AsJob' parameter. + + + [AzureLongRunningJob]: Starting cmdlet execution, setting for cmdlet confirmation required: '{0}' + 0(bool): whether cmdlet confirmation is required + + + [AzureLongRunningJob]: Blocking job for ShouldMethod '{0}' + 0(string): method type + + + [AzureLongRunningJob]: Completing cmdlet execution in RunJob + + + [AzureLongRunningJob]: State change from '{0}' to '{1}' because '{2}' + 0(string): last state, 1(string): new state, 2(string): state change reason + + + [AzureLongRunningJob]: Unblocking job due to stoppage or failure + + + [AzureLongRunningJob]: Unblocking job that was previously blocked. + + + [AzureLongRunningJob]: Error in cmdlet execution + + + [AzureLongRunningJob]: Removing state changed event handler, exception '{0}' + 0(string): exception message + + + [AzureLongRunningJob]: ShouldMethod '{0}' unblocked. + 0(string): methodType + + + +- The parameter : '{0}' is changing. + + + +- The parameter : '{0}' is becoming mandatory. + + + +- The parameter : '{0}' is being replaced by parameter : '{1}'. + + + +- The parameter : '{0}' is being replaced by mandatory parameter : '{1}'. + + + +- Change description : {0} + + + The cmdlet is being deprecated. There will be no replacement for it. + + + The cmdlet parameter set is being deprecated. There will be no replacement for it. + + + The cmdlet '{0}' is replacing this cmdlet. + + + +- The output type is changing from the existing type :'{0}' to the new type :'{1}' + + + +- The output type '{0}' is changing + + + +- The following properties are being added to the output type : + + + +- The following properties in the output type are being deprecated : + + + {0} + + + +- Cmdlet : '{0}' + - {1} + + + Upcoming breaking changes in the cmdlet '{0}' : + + + +- This change will take effect on '{0}' + + + +- The change is expected to take effect from version : '{0}' + + + ```powershell +# Old +{0} + +# New +{1} +``` + + + + +Cmdlet invocation changes : + Old Way : {0} + New Way : {1} + + + +The output type '{0}' is being deprecated without a replacement. + + + +The type of the parameter is changing from '{0}' to '{1}'. + + + +Note : Go to {0} for steps to suppress this breaking change warning, and other information on breaking changes in Azure PowerShell. + + + This cmdlet is in preview. Its behavior is subject to change based on customer feedback. + + + The estimated generally available date is '{0}'. + + + - The change is expected to take effect from Az version : '{0}' + + \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Response.cs b/src/Security/Security.Autorest/generated/runtime/Response.cs new file mode 100644 index 000000000000..6e49113c8424 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Response.cs @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime +{ + using System; + using System.Threading.Tasks; + public class Response : EventData + { + public Response() : base() + { + } + } + + public class Response : Response + { + private Func> _resultDelegate; + private Task _resultValue; + + public Response(T value) : base() => _resultValue = Task.FromResult(value); + public Response(Func value) : base() => _resultDelegate = () => Task.FromResult(value()); + public Response(Func> value) : base() => _resultDelegate = value; + public Task Result => _resultValue ?? (_resultValue = this._resultDelegate()); + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Serialization/JsonSerializer.cs b/src/Security/Security.Autorest/generated/runtime/Serialization/JsonSerializer.cs new file mode 100644 index 000000000000..14018f49b274 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Serialization/JsonSerializer.cs @@ -0,0 +1,350 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json +{ + internal class JsonSerializer + { + private int depth = 0; + + private SerializationOptions options = new SerializationOptions(); + + #region Deserialization + + internal T Deseralize(JsonObject json) + where T : new() + { + var contract = JsonModelCache.Get(typeof(T)); + + return (T)DeserializeObject(contract, json); + } + + internal object DeserializeObject(JsonModel contract, JsonObject json) + { + var instance = Activator.CreateInstance(contract.Type); + + depth++; + + // Ensure we don't recurse forever + if (depth > 5) throw new Exception("Depth greater than 5"); + + foreach (var field in json) + { + var member = contract[field.Key]; + + if (member != null) + { + var value = DeserializeValue(member, field.Value); + + member.SetValue(instance, value); + } + } + + depth--; + + return instance; + } + + private object DeserializeValue(JsonMember member, JsonNode value) + { + if (value.Type == JsonType.Null) return null; + + var type = member.Type; + + if (member.IsStringLike && value.Type != JsonType.String) + { + // Take the long path... + return DeserializeObject(JsonModelCache.Get(type), (JsonObject)value); + } + else if (member.Converter != null) + { + return member.Converter.FromJson(value); + } + else if (type.IsArray) + { + return DeserializeArray(type, (JsonArray)value); + } + else if (member.IsList) + { + return DeserializeList(type, (JsonArray)value); + } + else + { + var contract = JsonModelCache.Get(type); + + return DeserializeObject(contract, (JsonObject)value); + } + } + + private object DeserializeValue(Type type, JsonNode value) + { + if (type == null) throw new ArgumentNullException(nameof(type)); + + if (value.Type == JsonType.Null) return null; + + var typeDetails = TypeDetails.Get(type); + + if (typeDetails.JsonConverter != null) + { + return typeDetails.JsonConverter.FromJson(value); + } + else if (typeDetails.IsEnum) + { + return Enum.Parse(type, value.ToString(), ignoreCase: true); + } + else if (type.IsArray) + { + return DeserializeArray(type, (JsonArray)value); + } + else if (typeDetails.IsList) + { + return DeserializeList(type, (JsonArray)value); + } + else + { + var contract = JsonModelCache.Get(type); + + return DeserializeObject(contract, (JsonObject)value); + } + } + + internal Array DeserializeArray(Type type, JsonArray elements) + { + var elementType = type.GetElementType(); + + var elementTypeDetails = TypeDetails.Get(elementType); + + var array = Array.CreateInstance(elementType, elements.Count); + + int i = 0; + + if (elementTypeDetails.JsonConverter != null) + { + foreach (var value in elements) + { + array.SetValue(elementTypeDetails.JsonConverter.FromJson(value), i); + + i++; + } + } + else + { + foreach (var value in elements) + { + array.SetValue(DeserializeValue(elementType, value), i); + + i++; + } + } + + return array; + } + + internal IList DeserializeList(Type type, JsonArray jsonArray) + { + // TODO: Handle non-generic types + if (!type.IsGenericType) + throw new ArgumentException("Must be a generic type", nameof(type)); + + var elementType = type.GetGenericArguments()[0]; + + IList list; + + if (type.IsInterface) + { + // Create a concrete generic list + list = (IList)Activator.CreateInstance(typeof(List<>).MakeGenericType(elementType)); + } + else + { + list = (IList)Activator.CreateInstance(type); + } + + foreach (var value in jsonArray) + { + list.Add(DeserializeValue(elementType, value)); + } + + return list; + } + + #endregion + + #region Serialization + + internal JsonNode Serialize(object instance) => + Serialize(instance, SerializationOptions.Default); + + internal JsonNode Serialize(object instance, string[] include) => + Serialize(instance, new SerializationOptions { Include = include }); + + internal JsonNode Serialize(object instance, SerializationOptions options) + { + this.options = options; + + if (instance == null) + { + return XNull.Instance; + } + + return ReadValue(instance.GetType(), instance); + } + + #region Readers + + internal JsonArray ReadArray(IEnumerable collection) + { + var array = new XNodeArray(); + + foreach (var item in collection) + { + array.Add(ReadValue(item.GetType(), item)); + } + + return array; + } + + internal IEnumerable> ReadProperties(object instance) + { + var contract = JsonModelCache.Get(instance.GetType()); + + foreach (var member in contract.Members) + { + string name = member.Name; + + if (options.PropertyNameTransformer != null) + { + name = options.PropertyNameTransformer.Invoke(name); + } + + // Skip the field if it's not included + if ((depth == 1 && !options.IsIncluded(name))) + { + continue; + } + + var value = member.GetValue(instance); + + if (!member.EmitDefaultValue && (value == null || (member.IsList && ((IList)value).Count == 0) || value.Equals(member.DefaultValue))) + { + continue; + } + else if (options.IgnoreNullValues && value == null) // Ignore null values + { + continue; + } + + // Transform the value if there is one + if (options.Transformations != null) + { + var transform = options.GetTransformation(name); + + if (transform != null) + { + value = transform.Transformer(value); + } + } + + yield return new KeyValuePair(name, ReadValue(member.TypeDetails, value)); + } + } + + private JsonObject ReadObject(object instance) + { + depth++; + + // TODO: Guard against a self referencing graph + if (depth > options.MaxDepth) + { + depth--; + + return new JsonObject(); + } + + var node = new JsonObject(ReadProperties(instance)); + + depth--; + + return node; + } + + private JsonNode ReadValue(Type type, object value) + { + if (value == null) + { + return XNull.Instance; + } + + var member = TypeDetails.Get(type); + + return ReadValue(member, value); + } + + private JsonNode ReadValue(TypeDetails type, object value) + { + if (value == null) + { + return XNull.Instance; + } + + if (type.JsonConverter != null) + { + return type.JsonConverter.ToJson(value); + } + else if (type.IsArray) + { + switch (Type.GetTypeCode(type.ElementType)) + { + case TypeCode.String: return CreateArray((string[])value); + case TypeCode.UInt16: return CreateArray((ushort[])value); + case TypeCode.UInt32: return CreateArray((uint[])value); + case TypeCode.UInt64: return CreateArray((ulong[])value); + case TypeCode.Int16: return CreateArray((short[])value); + case TypeCode.Int32: return CreateArray((int[])value); + case TypeCode.Int64: return CreateArray((long[])value); + case TypeCode.Single: return CreateArray((float[])value); + case TypeCode.Double: return CreateArray((double[])value); + default: return ReadArray((IEnumerable)value); + } + } + else if (value is IEnumerable) + { + if (type.IsList && type.ElementType != null) + { + switch (Type.GetTypeCode(type.ElementType)) + { + case TypeCode.String: return CreateList(value); + case TypeCode.UInt16: return CreateList(value); + case TypeCode.UInt32: return CreateList(value); + case TypeCode.UInt64: return CreateList(value); + case TypeCode.Int16: return CreateList(value); + case TypeCode.Int32: return CreateList(value); + case TypeCode.Int64: return CreateList(value); + case TypeCode.Single: return CreateList(value); + case TypeCode.Double: return CreateList(value); + } + } + + return ReadArray((IEnumerable)value); + } + else + { + // Complex object + return ReadObject(value); + } + } + + private XList CreateList(object value) => new XList((IList)value); + + private XImmutableArray CreateArray(T[] array) => new XImmutableArray(array); + + #endregion + + #endregion + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Serialization/PropertyTransformation.cs b/src/Security/Security.Autorest/generated/runtime/Serialization/PropertyTransformation.cs new file mode 100644 index 000000000000..e36886dd7724 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Serialization/PropertyTransformation.cs @@ -0,0 +1,21 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json +{ + internal class PropertyTransformation + { + internal PropertyTransformation(string name, Func transformer) + { + Name = name ?? throw new ArgumentNullException(nameof(name)); + Transformer = transformer ?? throw new ArgumentNullException(nameof(transformer)); + } + + internal string Name { get; } + + internal Func Transformer { get; } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Serialization/SerializationOptions.cs b/src/Security/Security.Autorest/generated/runtime/Serialization/SerializationOptions.cs new file mode 100644 index 000000000000..6a651ff2a86b --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Serialization/SerializationOptions.cs @@ -0,0 +1,65 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Linq; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json +{ + internal class SerializationOptions + { + internal static readonly SerializationOptions Default = new SerializationOptions(); + + internal SerializationOptions() { } + + internal SerializationOptions( + string[] include = null, + bool ingoreNullValues = false) + { + Include = include; + IgnoreNullValues = ingoreNullValues; + } + + internal string[] Include { get; set; } + + internal string[] Exclude { get; set; } + + internal bool IgnoreNullValues { get; set; } + + internal PropertyTransformation[] Transformations { get; set; } + + internal Func PropertyNameTransformer { get; set; } + + internal int MaxDepth { get; set; } = 5; + + internal bool IsIncluded(string name) + { + if (Exclude != null) + { + return !Exclude.Any(exclude => exclude.Equals(name, StringComparison.OrdinalIgnoreCase)); + } + else if (Include != null) + { + return Include.Any(exclude => exclude.Equals(name, StringComparison.OrdinalIgnoreCase)); + } + + return true; + } + + internal PropertyTransformation GetTransformation(string propertyName) + { + if (Transformations == null) return null; + + foreach (var t in Transformations) + { + if (t.Name.Equals(propertyName, StringComparison.OrdinalIgnoreCase)) + { + return t; + } + } + + return null; + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/SerializationMode.cs b/src/Security/Security.Autorest/generated/runtime/SerializationMode.cs new file mode 100644 index 000000000000..f9402a636cb5 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/SerializationMode.cs @@ -0,0 +1,18 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime +{ + [System.Flags] + public enum SerializationMode + { + None = 0, + IncludeHeaders = 1 << 0, + IncludeRead = 1 << 1, + IncludeCreate = 1 << 2, + IncludeUpdate = 1 << 3, + IncludeAll = IncludeHeaders | IncludeRead | IncludeCreate | IncludeUpdate, + IncludeCreateOrUpdate = IncludeCreate | IncludeUpdate + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/TypeConverterExtensions.cs b/src/Security/Security.Autorest/generated/runtime/TypeConverterExtensions.cs new file mode 100644 index 000000000000..9fb32b8b92ed --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/TypeConverterExtensions.cs @@ -0,0 +1,261 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.IO; +using System.Linq; +using System.Xml; +using System.Xml.Serialization; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.PowerShell +{ + internal static class TypeConverterExtensions + { + internal static T[] SelectToArray(object source, System.Func converter) + { + // null begets null + if (source == null) + { + return null; + } + + // single values and strings are just encapsulated in the array. + if (source is string || !(source is System.Collections.IEnumerable)) + { + try + { + return new T[] { (T)converter(source) }; + } +#if DEBUG + catch (System.Exception E) + { + System.Console.Error.WriteLine($"{E.GetType().Name}/{E.Message}/{E.StackTrace}"); + } +#else + catch + { + // silent conversion fail + } +#endif + return new T[0]; // empty result if couldn't convert. + } + + var result = new System.Collections.Generic.List(); + foreach (var each in (System.Collections.IEnumerable)source) + { + try + { + result.Add((T)converter(each)); + } +#if DEBUG + catch (System.Exception E) + { + System.Console.Error.WriteLine($"{E.GetType().Name}/{E.Message}/{E.StackTrace}"); + } +#else + catch + { + // silent conversion fail + } +#endif + } + return result.ToArray(); + } + + internal static System.Collections.Generic.List SelectToList(object source, System.Func converter) + { + // null begets null + if (source == null) + { + return null; + } + + // single values and strings are just encapsulated in the array. + if (source is string || !(source is System.Collections.IEnumerable)) + { + try + { + return new T[] { (T)converter(source) }.ToList(); + } +#if DEBUG + catch (System.Exception E) + { + System.Console.Error.WriteLine($"{E.GetType().Name}/{E.Message}/{E.StackTrace}"); + } +#else + catch + { + // silent conversion fail + } +#endif + return new T[0].ToList(); // empty result if couldn't convert. + } + + var result = new System.Collections.Generic.List(); + foreach (var each in (System.Collections.IEnumerable)source) + { + try + { + result.Add((T)converter(each)); + } +#if DEBUG + catch (System.Exception E) + { + System.Console.Error.WriteLine($"{E.GetType().Name}/{E.Message}/{E.StackTrace}"); + } +#else + catch + { + // silent conversion fail + } +#endif + } + return result; + } + internal static System.Collections.Generic.IEnumerable GetPropertyKeys(this System.Collections.Generic.IDictionary dictionary) + { + if (null != dictionary) + { + foreach (var each in dictionary.Keys) + { + yield return each; + } + } + } + internal static System.Collections.Generic.IEnumerable GetPropertyKeys(this System.Collections.IDictionary dictionary) + { + if (null != dictionary) + { + foreach (var each in dictionary.Keys) + { + yield return each; + } + } + } + internal static System.Collections.Generic.IEnumerable GetPropertyKeys(this System.Management.Automation.PSObject instance) + { + if (null != instance) + { + foreach (var each in instance.Properties) + { + yield return each; + } + } + } + + internal static System.Collections.Generic.IEnumerable> GetFilteredProperties(this System.Collections.Generic.IDictionary instance, global::System.Collections.Generic.HashSet exclusions = null, global::System.Collections.Generic.HashSet inclusions = null) + { + return (null == instance || instance.Count == 0) ? + Enumerable.Empty>() : + instance.Keys + .Where(key => + !(true == exclusions?.Contains(key?.ToString())) + && (false != inclusions?.Contains(key?.ToString()))) + .Select(key => new System.Collections.Generic.KeyValuePair(key, instance[key])); + } + + internal static System.Collections.Generic.IEnumerable> GetFilteredProperties(this System.Collections.IDictionary instance, global::System.Collections.Generic.HashSet exclusions = null, global::System.Collections.Generic.HashSet inclusions = null) + { + return (null == instance || instance.Count == 0) ? + Enumerable.Empty>() : + instance.Keys.OfType() + .Where(key => + !(true == exclusions?.Contains(key?.ToString())) + && (false != inclusions?.Contains(key?.ToString()))) + .Select(key => new System.Collections.Generic.KeyValuePair(key, instance[key])); + } + + internal static System.Collections.Generic.IEnumerable> GetFilteredProperties(this System.Management.Automation.PSObject instance, global::System.Collections.Generic.HashSet exclusions = null, global::System.Collections.Generic.HashSet inclusions = null) + { + // new global::System.Collections.Generic.HashSet(System.StringComparer.InvariantCultureIgnoreCase) + return (null == instance || !instance.Properties.Any()) ? + Enumerable.Empty>() : + instance.Properties + .Where(property => + !(true == exclusions?.Contains(property.Name)) + && (false != inclusions?.Contains(property.Name))) + .Select(property => new System.Collections.Generic.KeyValuePair(property.Name, property.Value)); + } + + + internal static T GetValueForProperty(this System.Collections.Generic.IDictionary dictionary, string propertyName, T defaultValue, System.Func converter) + { + try + { + var key = System.Linq.Enumerable.FirstOrDefault(dictionary.Keys, each => System.String.Equals(each.ToString(), propertyName, System.StringComparison.CurrentCultureIgnoreCase)); + return key == null ? defaultValue : (T)converter(dictionary[key]); + } +#if DEBUG + catch (System.Exception E) + { + System.Console.Error.WriteLine($"{E.GetType().Name}/{E.Message}/{E.StackTrace}"); + } +#else + catch + { + } +#endif + return defaultValue; + } + internal static T GetValueForProperty(this System.Collections.IDictionary dictionary, string propertyName, T defaultValue, System.Func converter) + { + try + { + var key = System.Linq.Enumerable.FirstOrDefault(dictionary.Keys.OfType(), each => System.String.Equals(each.ToString(), propertyName, System.StringComparison.CurrentCultureIgnoreCase)); + return key == null ? defaultValue : (T)converter(dictionary[key]); + } +#if DEBUG + catch (System.Exception E) + { + System.Console.Error.WriteLine($"{E.GetType().Name}/{E.Message}/{E.StackTrace}"); + } +#else + catch + { + } +#endif + return defaultValue; + } + + internal static T GetValueForProperty(this System.Management.Automation.PSObject psObject, string propertyName, T defaultValue, System.Func converter) + { + try + { + var property = System.Linq.Enumerable.FirstOrDefault(psObject.Properties, each => System.String.Equals(each.Name.ToString(), propertyName, System.StringComparison.CurrentCultureIgnoreCase)); + return property == null ? defaultValue : (T)converter(property.Value); + } +#if DEBUG + catch (System.Exception E) + { + System.Console.Error.WriteLine($"{E.GetType().Name}/{E.Message}/{E.StackTrace}"); + } +#else + catch + { + } +#endif + return defaultValue; + } + + internal static bool Contains(this System.Management.Automation.PSObject psObject, string propertyName) + { + bool result = false; + try + { + var property = System.Linq.Enumerable.FirstOrDefault(psObject.Properties, each => System.String.Equals(each.Name.ToString(), propertyName, System.StringComparison.CurrentCultureIgnoreCase)); + result = property == null ? false : true; + } +#if DEBUG + catch (System.Exception E) + { + System.Console.Error.WriteLine($"{E.GetType().Name}/{E.Message}/{E.StackTrace}"); + } +#else + catch + { + } +#endif + return result; + } + } +} diff --git a/src/Security/Security.Autorest/generated/runtime/UndeclaredResponseException.cs b/src/Security/Security.Autorest/generated/runtime/UndeclaredResponseException.cs new file mode 100644 index 000000000000..69e2220a1764 --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/UndeclaredResponseException.cs @@ -0,0 +1,112 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime +{ + using System; + using System.Net.Http; + using System.Net.Http.Headers; + using static Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Extensions; + + public class RestException : Exception, IDisposable + { + public System.Net.HttpStatusCode StatusCode { get; set; } + public string Code { get; protected set; } + protected string message; + public HttpRequestMessage RequestMessage { get; protected set; } + public HttpResponseHeaders ResponseHeaders { get; protected set; } + + public string ResponseBody { get; protected set; } + public string ClientRequestId { get; protected set; } + public string RequestId { get; protected set; } + + public override string Message => message; + public string Action { get; protected set; } + + public RestException(System.Net.Http.HttpResponseMessage response) + { + StatusCode = response.StatusCode; + //CloneWithContent will not work here since the content is disposed after sendAsync + //Besides, it seems there is no need for the request content cloned here. + RequestMessage = response.RequestMessage.Clone(); + ResponseBody = response.Content.ReadAsStringAsync().Result; + ResponseHeaders = response.Headers; + + RequestId = response.GetFirstHeader("x-ms-request-id"); + ClientRequestId = response.GetFirstHeader("x-ms-client-request-id"); + + try + { + // try to parse the body as JSON, and see if a code and message are in there. + var json = Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonNode.Parse(ResponseBody) as Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json.JsonObject; + + // error message could be in properties.statusMessage + { message = If(json?.Property("properties"), out var p) + && If(p?.PropertyT("statusMessage"), out var sm) + ? (string)sm : (string)Message; } + + // see if there is an error block in the body + json = json?.Property("error") ?? json; + + { Code = If(json?.PropertyT("code"), out var c) ? (string)c : (string)StatusCode.ToString(); } + { message = If(json?.PropertyT("message"), out var m) ? (string)m : (string)Message; } + { Action = If(json?.PropertyT("action"), out var a) ? (string)a : (string)Action; } + } +#if DEBUG + catch (System.Exception E) + { + System.Console.Error.WriteLine($"{E.GetType().Name}/{E.Message}/{E.StackTrace}"); + } +#else + catch + { + // couldn't get the code/message from the body response. + // In this case, we will assume the response is the expected error message + if(!string.IsNullOrEmpty(ResponseBody)) { + message = ResponseBody; + } + } +#endif + if (string.IsNullOrEmpty(message)) + { + if (StatusCode >= System.Net.HttpStatusCode.BadRequest && StatusCode < System.Net.HttpStatusCode.InternalServerError) + { + message = $"The server responded with a Request Error, Status: {StatusCode}"; + } + else if (StatusCode >= System.Net.HttpStatusCode.InternalServerError) + { + message = $"The server responded with a Server Error, Status: {StatusCode}"; + } + else + { + message = $"The server responded with an unrecognized response, Status: {StatusCode}"; + } + } + } + + public void Dispose() + { + ((IDisposable)RequestMessage).Dispose(); + } + } + + public class RestException : RestException + { + public T Error { get; protected set; } + public RestException(System.Net.Http.HttpResponseMessage response, T error) : base(response) + { + Error = error; + } + } + + + public class UndeclaredResponseException : RestException + { + public UndeclaredResponseException(System.Net.Http.HttpResponseMessage response) : base(response) + { + + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/generated/runtime/Writers/JsonWriter.cs b/src/Security/Security.Autorest/generated/runtime/Writers/JsonWriter.cs new file mode 100644 index 000000000000..97d3a7aabf7e --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/Writers/JsonWriter.cs @@ -0,0 +1,223 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.IO; +using System.Web; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime.Json +{ + internal class JsonWriter + { + const string indentation = " "; // 2 spaces + + private readonly bool pretty; + private readonly TextWriter writer; + + protected int currentLevel = 0; + + internal JsonWriter(TextWriter writer, bool pretty = true) + { + this.writer = writer ?? throw new ArgumentNullException(nameof(writer)); + this.pretty = pretty; + } + + internal void WriteNode(JsonNode node) + { + switch (node.Type) + { + case JsonType.Array: WriteArray((IEnumerable)node); break; + case JsonType.Object: WriteObject((JsonObject)node); break; + + // Primitives + case JsonType.Binary: WriteBinary((XBinary)node); break; + case JsonType.Boolean: WriteBoolean((bool)node); break; + case JsonType.Date: WriteDate((JsonDate)node); break; + case JsonType.Null: WriteNull(); break; + case JsonType.Number: WriteNumber((JsonNumber)node); break; + case JsonType.String: WriteString(node); break; + } + } + + internal void WriteArray(IEnumerable array) + { + currentLevel++; + + writer.Write('['); + + bool doIndentation = false; + + if (pretty) + { + foreach (var node in array) + { + if (node.Type == JsonType.Object || node.Type == JsonType.Array) + { + doIndentation = true; + + break; + } + } + } + + bool isFirst = true; + + foreach (JsonNode node in array) + { + if (!isFirst) writer.Write(','); + + if (doIndentation) + { + WriteIndent(); + } + else if (pretty) + { + writer.Write(' '); + } + + WriteNode(node); + + isFirst = false; + } + + currentLevel--; + + if (doIndentation) + { + WriteIndent(); + } + else if (pretty) + { + writer.Write(' '); + } + + writer.Write(']'); + } + + internal void WriteIndent() + { + if (pretty) + { + writer.Write(Environment.NewLine); + + for (int level = 0; level < currentLevel; level++) + { + writer.Write(indentation); + } + } + } + + internal void WriteObject(JsonObject obj) + { + currentLevel++; + + writer.Write('{'); + + bool isFirst = true; + + foreach (var field in obj) + { + if (!isFirst) writer.Write(','); + + WriteIndent(); + + WriteFieldName(field.Key); + + writer.Write(':'); + + if (pretty) + { + writer.Write(' '); + } + + // Write the field value + WriteNode(field.Value); + + isFirst = false; + } + + currentLevel--; + + WriteIndent(); + + writer.Write('}'); + } + + internal void WriteFieldName(string fieldName) + { + writer.Write('"'); + writer.Write(HttpUtility.JavaScriptStringEncode(fieldName)); + writer.Write('"'); + } + + #region Primitives + + internal void WriteBinary(XBinary value) + { + writer.Write('"'); + writer.Write(value.ToString()); + writer.Write('"'); + } + + internal void WriteBoolean(bool value) + { + writer.Write(value ? "true" : "false"); + } + + internal void WriteDate(JsonDate date) + { + if (date.ToDateTime().Year == 1) + { + WriteNull(); + } + else + { + writer.Write('"'); + writer.Write(date.ToIsoString()); + writer.Write('"'); + } + } + + internal void WriteNull() + { + writer.Write("null"); + } + + internal void WriteNumber(JsonNumber number) + { + if (number.Overflows) + { + writer.Write('"'); + writer.Write(number.Value); + writer.Write('"'); + } + else + { + writer.Write(number.Value); + } + } + + internal void WriteString(string text) + { + if (text == null) + { + WriteNull(); + } + else + { + writer.Write('"'); + + writer.Write(HttpUtility.JavaScriptStringEncode(text)); + + writer.Write('"'); + } + } + + #endregion + } +} + + +// TODO: Replace with System.Text.Json when available diff --git a/src/Security/Security.Autorest/generated/runtime/delegates.cs b/src/Security/Security.Autorest/generated/runtime/delegates.cs new file mode 100644 index 000000000000..85fb9caa167d --- /dev/null +++ b/src/Security/Security.Autorest/generated/runtime/delegates.cs @@ -0,0 +1,23 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.Security.Runtime +{ + using System; + using System.Collections; + using System.Collections.Generic; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + using GetEventData=System.Func; + + public delegate Task SendAsync(HttpRequestMessage request, IEventListener callback); + public delegate Task SendAsyncStep(HttpRequestMessage request, IEventListener callback, ISendAsync next); + public delegate Task SignalEvent(string id, CancellationToken token, GetEventData getEventData); + public delegate Task Event(EventData message); + public delegate void SynchEvent(EventData message); + public delegate Task OnResponse(Response message); + public delegate Task OnResponse(Response message); +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/help/Az.Security.md b/src/Security/Security.Autorest/help/Az.Security.md new file mode 100644 index 000000000000..af4d03d52727 --- /dev/null +++ b/src/Security/Security.Autorest/help/Az.Security.md @@ -0,0 +1,164 @@ +--- +Module Name: Az.Security +Module Guid: 6f1c0dfd-dfcd-4e5b-b77c-a64a9d355ebf +Download Help Link: https://learn.microsoft.com/powershell/module/az.security +Help Version: 1.0.0.0 +Locale: en-US +--- + +# Az.Security Module +## Description +Microsoft Azure PowerShell: Security cmdlets + +## Az.Security Cmdlets +### [Get-AzSecurityApiCollection](Get-AzSecurityApiCollection.md) +Gets an Azure API Management API if it has been onboarded to Microsoft Defender for APIs. +If an Azure API Management API is onboarded to Microsoft Defender for APIs, the system will monitor the operations within the Azure API Management API for intrusive behaviors and provide alerts for attacks that have been detected. + +### [Get-AzSecurityConnector](Get-AzSecurityConnector.md) +Retrieves details of a specific security connector + +### [Get-AzSecurityConnectorAzureDevOpsOrg](Get-AzSecurityConnectorAzureDevOpsOrg.md) +Returns a monitored Azure DevOps organization resource. + +### [Get-AzSecurityConnectorAzureDevOpsOrgAvailable](Get-AzSecurityConnectorAzureDevOpsOrgAvailable.md) +Returns a list of all Azure DevOps organizations accessible by the user token consumed by the connector. + +### [Get-AzSecurityConnectorAzureDevOpsProject](Get-AzSecurityConnectorAzureDevOpsProject.md) +Returns a monitored Azure DevOps project resource. + +### [Get-AzSecurityConnectorAzureDevOpsRepo](Get-AzSecurityConnectorAzureDevOpsRepo.md) +Returns a monitored Azure DevOps repository resource. + +### [Get-AzSecurityConnectorDevOpsConfiguration](Get-AzSecurityConnectorDevOpsConfiguration.md) +Gets a DevOps Configuration. + +### [Get-AzSecurityConnectorGitHubOwner](Get-AzSecurityConnectorGitHubOwner.md) +Returns a monitored GitHub owner. + +### [Get-AzSecurityConnectorGitHubOwnerAvailable](Get-AzSecurityConnectorGitHubOwnerAvailable.md) +Returns a list of all GitHub owners accessible by the user token consumed by the connector. + +### [Get-AzSecurityConnectorGitHubRepo](Get-AzSecurityConnectorGitHubRepo.md) +Returns a monitored GitHub repository. + +### [Get-AzSecurityConnectorGitLabGroup](Get-AzSecurityConnectorGitLabGroup.md) +Returns a monitored GitLab Group resource for a given fully-qualified name. + +### [Get-AzSecurityConnectorGitLabGroupAvailable](Get-AzSecurityConnectorGitLabGroupAvailable.md) +Returns a list of all GitLab groups accessible by the user token consumed by the connector. + +### [Get-AzSecurityConnectorGitLabProject](Get-AzSecurityConnectorGitLabProject.md) +Returns a monitored GitLab Project resource for a given fully-qualified group name and project name. + +### [Get-AzSecurityConnectorGitLabSubgroup](Get-AzSecurityConnectorGitLabSubgroup.md) +Gets nested subgroups of given GitLab Group which are onboarded to the connector. + +### [Invoke-AzSecurityApiCollectionApimOffboard](Invoke-AzSecurityApiCollectionApimOffboard.md) +Offboard an Azure API Management API from Microsoft Defender for APIs. +The system will stop monitoring the operations within the Azure API Management API for intrusive behaviors. + +### [Invoke-AzSecurityApiCollectionApimOnboard](Invoke-AzSecurityApiCollectionApimOnboard.md) +Onboard an Azure API Management API to Microsoft Defender for APIs. +The system will start monitoring the operations within the Azure Management API for intrusive behaviors and provide alerts for attacks that have been detected. + +### [New-AzSecurityAwsEnvironmentObject](New-AzSecurityAwsEnvironmentObject.md) +Create an in-memory object for AwsEnvironment. + +### [New-AzSecurityAwsOrganizationalDataMasterObject](New-AzSecurityAwsOrganizationalDataMasterObject.md) +Create an in-memory object for AwsOrganizationalDataMaster. + +### [New-AzSecurityAwsOrganizationalDataMemberObject](New-AzSecurityAwsOrganizationalDataMemberObject.md) +Create an in-memory object for AwsOrganizationalDataMember. + +### [New-AzSecurityAzureDevOpsScopeEnvironmentObject](New-AzSecurityAzureDevOpsScopeEnvironmentObject.md) +Create an in-memory object for AzureDevOpsScopeEnvironment. + +### [New-AzSecurityConnector](New-AzSecurityConnector.md) +Create a security connector. +If a security connector is already created and a subsequent request is issued for the same security connector id, then it will be updated. + +### [New-AzSecurityConnectorActionableRemediationObject](New-AzSecurityConnectorActionableRemediationObject.md) +Create an in-memory object for ActionableRemediation. + +### [New-AzSecurityConnectorDevOpsConfiguration](New-AzSecurityConnectorDevOpsConfiguration.md) +Create a DevOps Configuration. + +### [New-AzSecurityCspmMonitorAwsOfferingObject](New-AzSecurityCspmMonitorAwsOfferingObject.md) +Create an in-memory object for CspmMonitorAwsOffering. + +### [New-AzSecurityCspmMonitorAzureDevOpsOfferingObject](New-AzSecurityCspmMonitorAzureDevOpsOfferingObject.md) +Create an in-memory object for CspmMonitorAzureDevOpsOffering. + +### [New-AzSecurityCspmMonitorGcpOfferingObject](New-AzSecurityCspmMonitorGcpOfferingObject.md) +Create an in-memory object for CspmMonitorGcpOffering. + +### [New-AzSecurityCspmMonitorGithubOfferingObject](New-AzSecurityCspmMonitorGithubOfferingObject.md) +Create an in-memory object for CspmMonitorGithubOffering. + +### [New-AzSecurityCspmMonitorGitLabOfferingObject](New-AzSecurityCspmMonitorGitLabOfferingObject.md) +Create an in-memory object for CspmMonitorGitLabOffering. + +### [New-AzSecurityDefenderCspmAwsOfferingObject](New-AzSecurityDefenderCspmAwsOfferingObject.md) +Create an in-memory object for DefenderCspmAwsOffering. + +### [New-AzSecurityDefenderCspmGcpOfferingObject](New-AzSecurityDefenderCspmGcpOfferingObject.md) +Create an in-memory object for DefenderCspmGcpOffering. + +### [New-AzSecurityDefenderForContainersAwsOfferingObject](New-AzSecurityDefenderForContainersAwsOfferingObject.md) +Create an in-memory object for DefenderForContainersAwsOffering. + +### [New-AzSecurityDefenderForContainersGcpOfferingObject](New-AzSecurityDefenderForContainersGcpOfferingObject.md) +Create an in-memory object for DefenderForContainersGcpOffering. + +### [New-AzSecurityDefenderForDatabasesAwsOfferingObject](New-AzSecurityDefenderForDatabasesAwsOfferingObject.md) +Create an in-memory object for DefenderForDatabasesAwsOffering. + +### [New-AzSecurityDefenderForDatabasesGcpOfferingObject](New-AzSecurityDefenderForDatabasesGcpOfferingObject.md) +Create an in-memory object for DefenderForDatabasesGcpOffering. + +### [New-AzSecurityDefenderForServersAwsOfferingObject](New-AzSecurityDefenderForServersAwsOfferingObject.md) +Create an in-memory object for DefenderForServersAwsOffering. + +### [New-AzSecurityDefenderForServersGcpOfferingObject](New-AzSecurityDefenderForServersGcpOfferingObject.md) +Create an in-memory object for DefenderForServersGcpOffering. + +### [New-AzSecurityGcpOrganizationalDataMemberObject](New-AzSecurityGcpOrganizationalDataMemberObject.md) +Create an in-memory object for GcpOrganizationalDataMember. + +### [New-AzSecurityGcpOrganizationalDataOrganizationObject](New-AzSecurityGcpOrganizationalDataOrganizationObject.md) +Create an in-memory object for GcpOrganizationalDataOrganization. + +### [New-AzSecurityGcpProjectEnvironmentObject](New-AzSecurityGcpProjectEnvironmentObject.md) +Create an in-memory object for GcpProjectEnvironment. + +### [New-AzSecurityGitHubScopeEnvironmentObject](New-AzSecurityGitHubScopeEnvironmentObject.md) +Create an in-memory object for GitHubScopeEnvironment. + +### [New-AzSecurityGitLabScopeEnvironmentObject](New-AzSecurityGitLabScopeEnvironmentObject.md) +Create an in-memory object for GitLabScopeEnvironment. + +### [New-AzSecurityInformationProtectionAwsOfferingObject](New-AzSecurityInformationProtectionAwsOfferingObject.md) +Create an in-memory object for InformationProtectionAwsOffering. + +### [Remove-AzSecurityConnector](Remove-AzSecurityConnector.md) +Deletes a security connector. + +### [Remove-AzSecurityConnectorDevOpsConfiguration](Remove-AzSecurityConnectorDevOpsConfiguration.md) +Deletes a DevOps Connector. + +### [Update-AzSecurityConnector](Update-AzSecurityConnector.md) +Updates a security connector + +### [Update-AzSecurityConnectorAzureDevOpsOrg](Update-AzSecurityConnectorAzureDevOpsOrg.md) +Updates monitored Azure DevOps organization details. + +### [Update-AzSecurityConnectorAzureDevOpsProject](Update-AzSecurityConnectorAzureDevOpsProject.md) +Updates a monitored Azure DevOps project resource. + +### [Update-AzSecurityConnectorAzureDevOpsRepo](Update-AzSecurityConnectorAzureDevOpsRepo.md) +Updates a monitored Azure DevOps repository resource. + +### [Update-AzSecurityConnectorDevOpsConfiguration](Update-AzSecurityConnectorDevOpsConfiguration.md) +Updates a DevOps Configuration. + diff --git a/src/Security/Security.Autorest/help/Get-AzSecurityApiCollection.md b/src/Security/Security.Autorest/help/Get-AzSecurityApiCollection.md new file mode 100644 index 000000000000..d69ef1ed92a0 --- /dev/null +++ b/src/Security/Security.Autorest/help/Get-AzSecurityApiCollection.md @@ -0,0 +1,215 @@ +--- +external help file: +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/az.security/get-azsecurityapicollection +schema: 2.0.0 +--- + +# Get-AzSecurityApiCollection + +## SYNOPSIS +Gets an Azure API Management API if it has been onboarded to Microsoft Defender for APIs. +If an Azure API Management API is onboarded to Microsoft Defender for APIs, the system will monitor the operations within the Azure API Management API for intrusive behaviors and provide alerts for attacks that have been detected. + +## SYNTAX + +### List (Default) +``` +Get-AzSecurityApiCollection [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzSecurityApiCollection -ApiId -ResourceGroupName -ServiceName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### GetViaIdentity +``` +Get-AzSecurityApiCollection -InputObject [-DefaultProfile ] [] +``` + +### List1 +``` +Get-AzSecurityApiCollection -ResourceGroupName [-SubscriptionId ] + [-DefaultProfile ] [] +``` + +### List2 +``` +Get-AzSecurityApiCollection -ResourceGroupName -ServiceName [-SubscriptionId ] + [-DefaultProfile ] [] +``` + +## DESCRIPTION +Gets an Azure API Management API if it has been onboarded to Microsoft Defender for APIs. +If an Azure API Management API is onboarded to Microsoft Defender for APIs, the system will monitor the operations within the Azure API Management API for intrusive behaviors and provide alerts for attacks that have been detected. + +## EXAMPLES + +### Example 1: Get a specific onboarded api collection resource +```powershell +Get-AzSecurityApiCollection -ResourceGroupName apicollectionstests -ServiceName "demoapimservice2" -ApiId "echo-api" +``` + +```output +BaseUrl : https://demoapimservice2.azure-api.net/echo +DiscoveredVia : /subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/apicollectionstests/providers/Microsoft.ApiManagement/service/demoapim + service2 +DisplayName : Echo API +Id : /subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/apicollectionstests/providers/Microsoft.ApiManagement/service/demoapim + service2/providers/Microsoft.Security/apiCollections/echo-api +Name : echo-api +NumberOfApiEndpoint : 6 +NumberOfApiEndpointsWithSensitiveDataExposed : 0 +NumberOfExternalApiEndpoint : 0 +NumberOfInactiveApiEndpoint : 6 +NumberOfUnauthenticatedApiEndpoint : 0 +ProvisioningState : Succeeded +ResourceGroupName : apicollectionstests +SensitivityLabel : +Type : microsoft.security/apicollections +``` + + + +### Example 2: List onboarded api collections by service name +```powershell +Get-AzSecurityApiCollection -ResourceGroupName "apicollectionstests" -ServiceName "demoapimservice2" +``` + +```output +Name ResourceGroupName +---- ----------------- +echo-api apicollectionstests +echo-api-2 apicollectionstests +``` + + + +### Example 3: List onboarded api collections by subscription +```powershell +Get-AzSecurityApiCollection +``` + +```output +Name ResourceGroupName +---- ----------------- +echo-api apicollectionstests +echo-api-2 apicollectionstests +``` + + + +## PARAMETERS + +### -ApiId +API revision identifier. +Must be unique in the API Management service instance. +Non-current revision has ;rev=n as a suffix where n is the revision number. + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: Get, List1, List2 +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ServiceName +The name of the API Management service. + +```yaml +Type: System.String +Parameter Sets: Get, List2 +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure subscription ID + +```yaml +Type: System.String[] +Parameter Sets: Get, List, List1, List2 +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollection + +## NOTES + +## RELATED LINKS + diff --git a/src/Security/Security.Autorest/help/Get-AzSecurityConnector.md b/src/Security/Security.Autorest/help/Get-AzSecurityConnector.md new file mode 100644 index 000000000000..7842d7a2dcb0 --- /dev/null +++ b/src/Security/Security.Autorest/help/Get-AzSecurityConnector.md @@ -0,0 +1,186 @@ +--- +external help file: +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnector +schema: 2.0.0 +--- + +# Get-AzSecurityConnector + +## SYNOPSIS +Retrieves details of a specific security connector + +## SYNTAX + +### List (Default) +``` +Get-AzSecurityConnector [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzSecurityConnector -Name -ResourceGroupName [-SubscriptionId ] + [-DefaultProfile ] [] +``` + +### GetViaIdentity +``` +Get-AzSecurityConnector -InputObject [-DefaultProfile ] [] +``` + +### List1 +``` +Get-AzSecurityConnector -ResourceGroupName [-SubscriptionId ] [-DefaultProfile ] + [] +``` + +## DESCRIPTION +Retrieves details of a specific security connector + +## EXAMPLES + +### Example 1: Get Security Connector resource by name +```powershell +Get-AzSecurityConnector -ResourceGroupName "dfdtest-sdk" -Name "dfdsdktests-azdo-01" +``` + +```output +EnvironmentData : { + "environmentType": "AzureDevOpsScope" + } +EnvironmentName : AzureDevOps +Etag : +HierarchyIdentifier : 4a8eb7f1-f533-48c5-b102-9b09e90906b7 +HierarchyIdentifierTrialEndDate : +Id : /subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourcegroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01 +Kind : +Location : centralus +Name : dfdsdktests-azdo-01 +Offering : {{ + "offeringType": "CspmMonitorAzureDevOps" + }} +ResourceGroupName : dfdtest-sdk +SystemDataCreatedAt : 12/7/2023 6:38:36 AM +SystemDataCreatedBy : c3d82ccb-fee1-430c-949e-6c0a217c00a8 +SystemDataCreatedByType : Application +SystemDataLastModifiedAt : 2/14/2024 2:11:46 AM +SystemDataLastModifiedBy : c3d82ccb-fee1-430c-949e-6c0a217c00a8 +SystemDataLastModifiedByType : Application +Tag : {} +Type : Microsoft.Security/securityconnectors +``` + + + +### Example 2: List Security Connectors by subscription +```powershell +Get-AzSecurityConnector +``` + +```output +Name ResourceGroupName EnvironmentName Location HierarchyIdentifier +---- ----------------- --------------- -------- ------------------- +dfdsdktests-azdo-01 dfdtest-sdk AzureDevOps centralus 4a8eb7f1-f533-48c5-b102-9b09e90906b7 +dfdsdktests-gl-01 dfdtest-sdk GitLab centralus 7a1f4efe-f8c6-48e7-b7ef-1b45994ed602 +dfdsdktests-gh-01 dfdtest-sdk Github centralus bc12ba4d-b89c-486e-85e1-d803e7d80525 +aws-sdktest01 securityconnectors-tests AWS CentralUS 891376984375 +gcp-sdktest01 securityconnectors-tests GCP CentralUS 843025268399 +``` + + + +## PARAMETERS + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Name +The security connector name. + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: SecurityConnectorName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group within the user's subscription. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: Get, List1 +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure subscription ID + +```yaml +Type: System.String[] +Parameter Sets: Get, List, List1 +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnector + +## NOTES + +## RELATED LINKS + diff --git a/src/Security/Security.Autorest/help/Get-AzSecurityConnectorAzureDevOpsOrg.md b/src/Security/Security.Autorest/help/Get-AzSecurityConnectorAzureDevOpsOrg.md new file mode 100644 index 000000000000..4b90cfbe6338 --- /dev/null +++ b/src/Security/Security.Autorest/help/Get-AzSecurityConnectorAzureDevOpsOrg.md @@ -0,0 +1,200 @@ +--- +external help file: +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorazuredevopsorg +schema: 2.0.0 +--- + +# Get-AzSecurityConnectorAzureDevOpsOrg + +## SYNOPSIS +Returns a monitored Azure DevOps organization resource. + +## SYNTAX + +### List (Default) +``` +Get-AzSecurityConnectorAzureDevOpsOrg -ResourceGroupName -SecurityConnectorName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzSecurityConnectorAzureDevOpsOrg -OrgName -ResourceGroupName + -SecurityConnectorName [-SubscriptionId ] [-DefaultProfile ] + [] +``` + +### GetViaIdentity +``` +Get-AzSecurityConnectorAzureDevOpsOrg -InputObject [-DefaultProfile ] + [] +``` + +## DESCRIPTION +Returns a monitored Azure DevOps organization resource. + +## EXAMPLES + +### Example 1: Get discovered AzureDevOps organization by name +```powershell +Get-AzSecurityConnectorAzureDevOpsOrg -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-azdo-01 -OrgName dfdsdktests +``` + +```output +ActionableRemediation : { + "state": "Enabled", + "categoryConfigurations": [ + { + "minimumSeverityLevel": "High", + "category": "IaC" + } + ], + "branchConfiguration": { + "branchNames": [ ], + "annotateDefaultBranch": "Enabled" + }, + "inheritFromParentState": "Disabled" + } +Id : /subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests +Name : dfdsdktests +OnboardingState : Onboarded +ProvisioningState : Succeeded +ProvisioningStatusMessage : OK +ProvisioningStatusUpdateTimeUtc : 2/23/2024 6:49:40 PM +ResourceGroupName : dfdtest-sdk +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Type : Microsoft.Security/securityConnectors/devops/azureDevOpsOrgs +``` + + + +### Example 2: List discovered AzureDevOps organizations +```powershell +Get-AzSecurityConnectorAzureDevOpsOrg -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-azdo-01 +``` + +```output +Name ResourceGroupName +---- ----------------- +dfdsdktests dfdtest-sdk +dfdsdktests2 dfdtest-sdk +``` + + + +## PARAMETERS + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -OrgName +The Azure DevOps organization name. + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SecurityConnectorName +The security connector name. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure subscription ID + +```yaml +Type: System.String[] +Parameter Sets: Get, List +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrg + +## NOTES + +## RELATED LINKS + diff --git a/src/Security/Security.Autorest/help/Get-AzSecurityConnectorAzureDevOpsOrgAvailable.md b/src/Security/Security.Autorest/help/Get-AzSecurityConnectorAzureDevOpsOrgAvailable.md new file mode 100644 index 000000000000..1bc3d3dd03ae --- /dev/null +++ b/src/Security/Security.Autorest/help/Get-AzSecurityConnectorAzureDevOpsOrgAvailable.md @@ -0,0 +1,170 @@ +--- +external help file: +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorazuredevopsorgavailable +schema: 2.0.0 +--- + +# Get-AzSecurityConnectorAzureDevOpsOrgAvailable + +## SYNOPSIS +Returns a list of all Azure DevOps organizations accessible by the user token consumed by the connector. + +## SYNTAX + +``` +Get-AzSecurityConnectorAzureDevOpsOrgAvailable -ResourceGroupName -SecurityConnectorName + [-SubscriptionId ] [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Returns a list of all Azure DevOps organizations accessible by the user token consumed by the connector. + +## EXAMPLES + +### Example 1: List available AzureDevOps organizations for onboarding +```powershell +Get-AzSecurityConnectorAzureDevOpsOrgAvailable -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-azdo-01 +``` + +```output +ActionableRemediation : { + "state": "Enabled", + "categoryConfigurations": [ + { + "minimumSeverityLevel": "High", + "category": "IaC" + } + ], + "branchConfiguration": { + "branchNames": [ ], + "annotateDefaultBranch": "Enabled" + }, + "inheritFromParentState": "Disabled" + } +Id : /subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests +Name : dfdsdktests +OnboardingState : Onboarded +ProvisioningState : Succeeded +ProvisioningStatusMessage : OK +ProvisioningStatusUpdateTimeUtc : 2/23/2024 6:49:40 PM +ResourceGroupName : dfdtest-sdk +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Type : Microsoft.Security/securityConnectors/devops/azureDevOpsOrgs +``` + + + +## PARAMETERS + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SecurityConnectorName +The security connector name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure subscription ID + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgListResponse + +## NOTES + +## RELATED LINKS + diff --git a/src/Security/Security.Autorest/help/Get-AzSecurityConnectorAzureDevOpsProject.md b/src/Security/Security.Autorest/help/Get-AzSecurityConnectorAzureDevOpsProject.md new file mode 100644 index 000000000000..a1fde408b8a1 --- /dev/null +++ b/src/Security/Security.Autorest/help/Get-AzSecurityConnectorAzureDevOpsProject.md @@ -0,0 +1,219 @@ +--- +external help file: +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorazuredevopsproject +schema: 2.0.0 +--- + +# Get-AzSecurityConnectorAzureDevOpsProject + +## SYNOPSIS +Returns a monitored Azure DevOps project resource. + +## SYNTAX + +### List (Default) +``` +Get-AzSecurityConnectorAzureDevOpsProject -OrgName -ResourceGroupName + -SecurityConnectorName [-SubscriptionId ] [-DefaultProfile ] + [] +``` + +### Get +``` +Get-AzSecurityConnectorAzureDevOpsProject -OrgName -ProjectName -ResourceGroupName + -SecurityConnectorName [-SubscriptionId ] [-DefaultProfile ] + [] +``` + +### GetViaIdentity +``` +Get-AzSecurityConnectorAzureDevOpsProject -InputObject [-DefaultProfile ] + [] +``` + +## DESCRIPTION +Returns a monitored Azure DevOps project resource. + +## EXAMPLES + +### Example 1: Get discovered AzureDevOps project by organization and project name +```powershell +Get-AzSecurityConnectorAzureDevOpsProject -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-azdo-01 -OrgName dfdsdktests -ProjectName ContosoSDKDfd +``` + +```output +ActionableRemediation : { + "state": "Enabled", + "categoryConfigurations": [ + { + "minimumSeverityLevel": "High", + "category": "IaC" + } + ], + "branchConfiguration": { + "branchNames": [ ], + "annotateDefaultBranch": "Enabled" + }, + "inheritFromParentState": "Disabled" + } +Id : /subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests/projects/Co + ntosoSDKDfd +Name : ContosoSDKDfd +OnboardingState : Onboarded +ParentOrgName : dfdsdktests +ProjectId : 161fb6f6-f2fe-4616-a627-293b788ff583 +ProvisioningState : Succeeded +ProvisioningStatusMessage : OK +ProvisioningStatusUpdateTimeUtc : 2/23/2024 6:52:43 PM +ResourceGroupName : dfdtest-sdk +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Type : Microsoft.Security/securityConnectors/devops/azureDevOpsOrgs/projects +``` + + + +### Example 2: List discovered AzureDevOps projects +```powershell +Get-AzSecurityConnectorAzureDevOpsProject -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-azdo-01 -OrgName dfdsdktests +``` + +```output +Name ResourceGroupName +---- ----------------- +ContosoSDKDfd dfdtest-sdk +ContosoEnterprise dfdtest-sdk +``` + + + +## PARAMETERS + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -OrgName +The Azure DevOps organization name. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProjectName +The project name. + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SecurityConnectorName +The security connector name. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure subscription ID + +```yaml +Type: System.String[] +Parameter Sets: Get, List +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProject + +## NOTES + +## RELATED LINKS + diff --git a/src/Security/Security.Autorest/help/Get-AzSecurityConnectorAzureDevOpsRepo.md b/src/Security/Security.Autorest/help/Get-AzSecurityConnectorAzureDevOpsRepo.md new file mode 100644 index 000000000000..d0e4d1092976 --- /dev/null +++ b/src/Security/Security.Autorest/help/Get-AzSecurityConnectorAzureDevOpsRepo.md @@ -0,0 +1,238 @@ +--- +external help file: +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorazuredevopsrepo +schema: 2.0.0 +--- + +# Get-AzSecurityConnectorAzureDevOpsRepo + +## SYNOPSIS +Returns a monitored Azure DevOps repository resource. + +## SYNTAX + +### List (Default) +``` +Get-AzSecurityConnectorAzureDevOpsRepo -OrgName -ProjectName -ResourceGroupName + -SecurityConnectorName [-SubscriptionId ] [-DefaultProfile ] + [] +``` + +### Get +``` +Get-AzSecurityConnectorAzureDevOpsRepo -OrgName -ProjectName -RepoName + -ResourceGroupName -SecurityConnectorName [-SubscriptionId ] + [-DefaultProfile ] [] +``` + +### GetViaIdentity +``` +Get-AzSecurityConnectorAzureDevOpsRepo -InputObject [-DefaultProfile ] + [] +``` + +## DESCRIPTION +Returns a monitored Azure DevOps repository resource. + +## EXAMPLES + +### Example 1: Get discovered AzureDevOps repository by organization, project and repo name +```powershell +Get-AzSecurityConnectorAzureDevOpsRepo -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-azdo-01 -OrgName dfdsdktests -ProjectName ContosoSDKDfd -RepoName TestApp0 +``` + +```output +ActionableRemediation : { + "state": "Enabled", + "categoryConfigurations": [ + { + "minimumSeverityLevel": "High", + "category": "IaC" + } + ], + "branchConfiguration": { + "branchNames": [ ], + "annotateDefaultBranch": "Enabled" + }, + "inheritFromParentState": "Enabled" + } +Id : /subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests/projects/Co + ntosoSDKDfd/repos/TestApp0 +Name : TestApp0 +OnboardingState : Onboarded +ParentOrgName : dfdsdktests +ParentProjectName : ContosoSDKDfd +ProvisioningState : Succeeded +ProvisioningStatusMessage : OK +ProvisioningStatusUpdateTimeUtc : 2/23/2024 6:52:44 PM +RepoId : 35cd4811-63c7-4043-8587-f0a9cf37709e +RepoUrl : https://dev.azure.com/dfdsdktests/ContosoSDKDfd/_git/TestApp0 +ResourceGroupName : dfdtest-sdk +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Type : Microsoft.Security/securityConnectors/devops/azureDevOpsOrgs/projects/repos +Visibility : +``` + + + +### Example 2: List discovered AzureDevOps repositories +```powershell +Get-AzSecurityConnectorAzureDevOpsRepo -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-azdo-01 -OrgName dfdsdktests -ProjectName ContosoSDKDfd +``` + +```output +Name ResourceGroupName +---- ----------------- +ContosoSDKDfd dfdtest-sdk +TestApp0 dfdtest-sdk +TestApp2 dfdtest-sdk +``` + + + +## PARAMETERS + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -OrgName +The Azure DevOps organization name. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProjectName +The project name. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -RepoName +The repository name. + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SecurityConnectorName +The security connector name. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure subscription ID + +```yaml +Type: System.String[] +Parameter Sets: Get, List +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepository + +## NOTES + +## RELATED LINKS + diff --git a/src/Security/Security.Autorest/help/Get-AzSecurityConnectorDevOpsConfiguration.md b/src/Security/Security.Autorest/help/Get-AzSecurityConnectorDevOpsConfiguration.md new file mode 100644 index 000000000000..5fb3dec3a191 --- /dev/null +++ b/src/Security/Security.Autorest/help/Get-AzSecurityConnectorDevOpsConfiguration.md @@ -0,0 +1,169 @@ +--- +external help file: +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectordevopsconfiguration +schema: 2.0.0 +--- + +# Get-AzSecurityConnectorDevOpsConfiguration + +## SYNOPSIS +Gets a DevOps Configuration. + +## SYNTAX + +### Get (Default) +``` +Get-AzSecurityConnectorDevOpsConfiguration -ResourceGroupName -SecurityConnectorName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### GetViaIdentity +``` +Get-AzSecurityConnectorDevOpsConfiguration -InputObject [-DefaultProfile ] + [] +``` + +### List +``` +Get-AzSecurityConnectorDevOpsConfiguration -ResourceGroupName -SecurityConnectorName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +## DESCRIPTION +Gets a DevOps Configuration. + +## EXAMPLES + +### Example 1: Get Security Connector DevOps Configuration +```powershell +Get-AzSecurityConnectorDevOpsConfiguration -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-azdo-01 +``` + +```output +AuthorizationCode : +AutoDiscovery : Disabled +Id : /subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default +Name : default +ProvisioningState : Succeeded +ProvisioningStatusMessage : Resource creation successful. +ProvisioningStatusUpdateTimeUtc : +ResourceGroupName : dfdtest-sdk +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +TopLevelInventoryList : +Type : Microsoft.Security/securityConnectors/devops +``` + + + +### Example 2: Try to get non existing Security Connector DevOps Configuration +```powershell +Get-AzSecurityConnectorDevOpsConfiguration -ResourceGroupName securityconnectors-tests -SecurityConnectorName aws-sdktest01 +``` + +```output +Get-AzSecurityConnectorDevOpsConfiguration_Get: DevOps configuration was not found +``` + + + +## PARAMETERS + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SecurityConnectorName +The security connector name. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure subscription ID + +```yaml +Type: System.String[] +Parameter Sets: Get, List +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfiguration + +## NOTES + +## RELATED LINKS + diff --git a/src/Security/Security.Autorest/help/Get-AzSecurityConnectorGitHubOwner.md b/src/Security/Security.Autorest/help/Get-AzSecurityConnectorGitHubOwner.md new file mode 100644 index 000000000000..46fca5fe1763 --- /dev/null +++ b/src/Security/Security.Autorest/help/Get-AzSecurityConnectorGitHubOwner.md @@ -0,0 +1,188 @@ +--- +external help file: +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorgithubowner +schema: 2.0.0 +--- + +# Get-AzSecurityConnectorGitHubOwner + +## SYNOPSIS +Returns a monitored GitHub owner. + +## SYNTAX + +### List (Default) +``` +Get-AzSecurityConnectorGitHubOwner -ResourceGroupName -SecurityConnectorName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzSecurityConnectorGitHubOwner -OwnerName -ResourceGroupName + -SecurityConnectorName [-SubscriptionId ] [-DefaultProfile ] + [] +``` + +### GetViaIdentity +``` +Get-AzSecurityConnectorGitHubOwner -InputObject [-DefaultProfile ] + [] +``` + +## DESCRIPTION +Returns a monitored GitHub owner. + +## EXAMPLES + +### Example 1: Get discovered GitHub owner by name +```powershell +Get-AzSecurityConnectorGitHubOwner -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-gh-01 -OwnerName dfdsdktests +``` + +```output +GitHubInternalId : 45003365 +Id : /subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gh-01/devops/default/gitHubOwners/dfdsdktests +Name : dfdsdktests +OnboardingState : Onboarded +OwnerUrl : https://github.com/dfdsdktests +ProvisioningState : Pending +ProvisioningStatusMessage : Beginning provisioning of GitHub connector. +ProvisioningStatusUpdateTimeUtc : 2/23/2024 8:46:22 PM +ResourceGroupName : dfdtest-sdk +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Type : Microsoft.Security/securityConnectors/devops/gitHubOwners +``` + + + +### Example 2: List discovered GitHub owners +```powershell +Get-AzSecurityConnectorGitHubOwner -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-gh-01 +``` + +```output +Name ResourceGroupName +---- ----------------- +dfdsdktests dfdtest-sdk +dfdsdktests2 dfdtest-sdk +``` + + + +## PARAMETERS + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -OwnerName +The GitHub owner name. + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SecurityConnectorName +The security connector name. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure subscription ID + +```yaml +Type: System.String[] +Parameter Sets: Get, List +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwner + +## NOTES + +## RELATED LINKS + diff --git a/src/Security/Security.Autorest/help/Get-AzSecurityConnectorGitHubOwnerAvailable.md b/src/Security/Security.Autorest/help/Get-AzSecurityConnectorGitHubOwnerAvailable.md new file mode 100644 index 000000000000..68d0893e9597 --- /dev/null +++ b/src/Security/Security.Autorest/help/Get-AzSecurityConnectorGitHubOwnerAvailable.md @@ -0,0 +1,158 @@ +--- +external help file: +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorgithubowneravailable +schema: 2.0.0 +--- + +# Get-AzSecurityConnectorGitHubOwnerAvailable + +## SYNOPSIS +Returns a list of all GitHub owners accessible by the user token consumed by the connector. + +## SYNTAX + +``` +Get-AzSecurityConnectorGitHubOwnerAvailable -ResourceGroupName -SecurityConnectorName + [-SubscriptionId ] [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Returns a list of all GitHub owners accessible by the user token consumed by the connector. + +## EXAMPLES + +### Example 1: List available GitHub owners for onboarding +```powershell +Get-AzSecurityConnectorGitHubOwnerAvailable -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-gh-01 +``` + +```output +GitHubInternalId : 45003365 +Id : /subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gh-01/devops/default/gitHubOwners/dfdsdktests +Name : dfdsdktests +OnboardingState : Onboarded +OwnerUrl : https://github.com/dfdsdktests +ProvisioningState : Pending +ProvisioningStatusMessage : Beginning provisioning of GitHub connector. +ProvisioningStatusUpdateTimeUtc : 2/23/2024 8:46:22 PM +ResourceGroupName : dfdtest-sdk +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Type : Microsoft.Security/securityConnectors/devops/gitHubOwners +``` + + + +## PARAMETERS + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SecurityConnectorName +The security connector name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure subscription ID + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerListResponse + +## NOTES + +## RELATED LINKS + diff --git a/src/Security/Security.Autorest/help/Get-AzSecurityConnectorGitHubRepo.md b/src/Security/Security.Autorest/help/Get-AzSecurityConnectorGitHubRepo.md new file mode 100644 index 000000000000..f2f9539a564d --- /dev/null +++ b/src/Security/Security.Autorest/help/Get-AzSecurityConnectorGitHubRepo.md @@ -0,0 +1,208 @@ +--- +external help file: +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorgithubrepo +schema: 2.0.0 +--- + +# Get-AzSecurityConnectorGitHubRepo + +## SYNOPSIS +Returns a monitored GitHub repository. + +## SYNTAX + +### List (Default) +``` +Get-AzSecurityConnectorGitHubRepo -OwnerName -ResourceGroupName + -SecurityConnectorName [-SubscriptionId ] [-DefaultProfile ] + [] +``` + +### Get +``` +Get-AzSecurityConnectorGitHubRepo -OwnerName -RepoName -ResourceGroupName + -SecurityConnectorName [-SubscriptionId ] [-DefaultProfile ] + [] +``` + +### GetViaIdentity +``` +Get-AzSecurityConnectorGitHubRepo -InputObject [-DefaultProfile ] + [] +``` + +## DESCRIPTION +Returns a monitored GitHub repository. + +## EXAMPLES + +### Example 1: Get discovered GitHub repository by name +```powershell +Get-AzSecurityConnectorGitHubRepo -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-gh-01 -OwnerName dfdsdktests -RepoName TestApp0 +``` + +```output +Id : /subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gh-01/devops/default/gitHubOwners/dfdsdktests/repos/TestApp0 +Name : TestApp0 +OnboardingState : Onboarded +ParentOwnerName : dfdsdktests +ProvisioningState : +ProvisioningStatusMessage : +ProvisioningStatusUpdateTimeUtc : 2/23/2024 8:46:23 PM +RepoFullName : +RepoId : 728418798 +RepoName : TestApp0 +RepoUrl : https://github.com/dfdsdktests/TestApp0 +ResourceGroupName : dfdtest-sdk +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Type : Microsoft.Security/securityConnectors/devops/gitHubOwners/repos +``` + + + +### Example 2: List discovered GitHub repositories +```powershell +Get-AzSecurityConnectorGitHubRepo -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-gh-01 -OwnerName dfdsdktests +``` + +```output + +Name ResourceGroupName +---- ----------------- +TestApp0 dfdtest-sdk +TestApp1 dfdtest-sdk +``` + + + +## PARAMETERS + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -OwnerName +The GitHub owner name. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -RepoName +The repository name. + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SecurityConnectorName +The security connector name. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure subscription ID + +```yaml +Type: System.String[] +Parameter Sets: Get, List +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepository + +## NOTES + +## RELATED LINKS + diff --git a/src/Security/Security.Autorest/help/Get-AzSecurityConnectorGitLabGroup.md b/src/Security/Security.Autorest/help/Get-AzSecurityConnectorGitLabGroup.md new file mode 100644 index 000000000000..e773bc7bccae --- /dev/null +++ b/src/Security/Security.Autorest/help/Get-AzSecurityConnectorGitLabGroup.md @@ -0,0 +1,189 @@ +--- +external help file: +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorgitlabgroup +schema: 2.0.0 +--- + +# Get-AzSecurityConnectorGitLabGroup + +## SYNOPSIS +Returns a monitored GitLab Group resource for a given fully-qualified name. + +## SYNTAX + +### List (Default) +``` +Get-AzSecurityConnectorGitLabGroup -ResourceGroupName -SecurityConnectorName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzSecurityConnectorGitLabGroup -GroupFqName -ResourceGroupName + -SecurityConnectorName [-SubscriptionId ] [-DefaultProfile ] + [] +``` + +### GetViaIdentity +``` +Get-AzSecurityConnectorGitLabGroup -InputObject [-DefaultProfile ] + [] +``` + +## DESCRIPTION +Returns a monitored GitLab Group resource for a given fully-qualified name. + +## EXAMPLES + +### Example 1: Get discovered GitLab group by name +```powershell +Get-AzSecurityConnectorGitLabGroup -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-gl-01 -GroupFqName dfdsdktests +``` + +```output +FullyQualifiedFriendlyName : Defender for DevOps SDK Tests +FullyQualifiedName : dfdsdktests +Id : /subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gl-01/devops/default/gitLabGroups/dfdsdktests +Name : dfdsdktests +OnboardingState : Onboarded +ProvisioningState : Succeeded +ProvisioningStatusMessage : Resource modification successful. +ProvisioningStatusUpdateTimeUtc : 2/23/2024 10:42:28 PM +ResourceGroupName : dfdtest-sdk +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Type : Microsoft.Security/securityConnectors/devops/gitLabGroups +Url : https://gitlab.com/groups/dfdsdktests +``` + + + +### Example 2: List discovered GitLab groups +```powershell +Get-AzSecurityConnectorGitLabGroup -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-gl-01 +``` + +```output +Name ResourceGroupName +---- ----------------- +dfdsdktests dfdtest-sdk +dfdsdktests2 dfdtest-sdk +``` + + + +## PARAMETERS + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -GroupFqName +The GitLab group fully-qualified name. + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SecurityConnectorName +The security connector name. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure subscription ID + +```yaml +Type: System.String[] +Parameter Sets: Get, List +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroup + +## NOTES + +## RELATED LINKS + diff --git a/src/Security/Security.Autorest/help/Get-AzSecurityConnectorGitLabGroupAvailable.md b/src/Security/Security.Autorest/help/Get-AzSecurityConnectorGitLabGroupAvailable.md new file mode 100644 index 000000000000..45c67bd4e0cb --- /dev/null +++ b/src/Security/Security.Autorest/help/Get-AzSecurityConnectorGitLabGroupAvailable.md @@ -0,0 +1,159 @@ +--- +external help file: +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorgitlabgroupavailable +schema: 2.0.0 +--- + +# Get-AzSecurityConnectorGitLabGroupAvailable + +## SYNOPSIS +Returns a list of all GitLab groups accessible by the user token consumed by the connector. + +## SYNTAX + +``` +Get-AzSecurityConnectorGitLabGroupAvailable -ResourceGroupName -SecurityConnectorName + [-SubscriptionId ] [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Returns a list of all GitLab groups accessible by the user token consumed by the connector. + +## EXAMPLES + +### Example 1: List available GitLab groups for onboarding +```powershell +Get-AzSecurityConnectorGitLabGroupAvailable -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-gl-01 +``` + +```output +FullyQualifiedFriendlyName : Defender for DevOps SDK Tests +FullyQualifiedName : dfdsdktests +Id : /subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gl-01/devops/default/gitLabGroups/dfdsdktests +Name : dfdsdktests +OnboardingState : Onboarded +ProvisioningState : Succeeded +ProvisioningStatusMessage : Resource modification successful. +ProvisioningStatusUpdateTimeUtc : 2/23/2024 10:42:28 PM +ResourceGroupName : dfdtest-sdk +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Type : Microsoft.Security/securityConnectors/devops/gitLabGroups +Url : https://gitlab.com/groups/dfdsdktests +``` + + + +## PARAMETERS + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SecurityConnectorName +The security connector name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure subscription ID + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupListResponse + +## NOTES + +## RELATED LINKS + diff --git a/src/Security/Security.Autorest/help/Get-AzSecurityConnectorGitLabProject.md b/src/Security/Security.Autorest/help/Get-AzSecurityConnectorGitLabProject.md new file mode 100644 index 000000000000..bf5039f04a2b --- /dev/null +++ b/src/Security/Security.Autorest/help/Get-AzSecurityConnectorGitLabProject.md @@ -0,0 +1,207 @@ +--- +external help file: +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorgitlabproject +schema: 2.0.0 +--- + +# Get-AzSecurityConnectorGitLabProject + +## SYNOPSIS +Returns a monitored GitLab Project resource for a given fully-qualified group name and project name. + +## SYNTAX + +### List (Default) +``` +Get-AzSecurityConnectorGitLabProject -GroupFqName -ResourceGroupName + -SecurityConnectorName [-SubscriptionId ] [-DefaultProfile ] + [] +``` + +### Get +``` +Get-AzSecurityConnectorGitLabProject -GroupFqName -ProjectName -ResourceGroupName + -SecurityConnectorName [-SubscriptionId ] [-DefaultProfile ] + [] +``` + +### GetViaIdentity +``` +Get-AzSecurityConnectorGitLabProject -InputObject [-DefaultProfile ] + [] +``` + +## DESCRIPTION +Returns a monitored GitLab Project resource for a given fully-qualified group name and project name. + +## EXAMPLES + +### Example 1: Get discovered GitLab project by name +```powershell +Get-AzSecurityConnectorGitLabProject -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-gl-01 -GroupFqName dfdsdktests -ProjectName testapp0 +``` + +```output +FullyQualifiedFriendlyName : Defender for DevOps SDK Tests / TestApp0 +FullyQualifiedName : dfdsdktests$testapp0 +FullyQualifiedParentGroupName : dfdsdktests +Id : /subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gl-01/devops/default/gitLabGroups/dfdsdktests/projects/testapp0 +Name : testapp0 +OnboardingState : Onboarded +ProvisioningState : Succeeded +ProvisioningStatusMessage : Resource modification successful. +ProvisioningStatusUpdateTimeUtc : 1/1/1970 12:00:00 AM +ResourceGroupName : dfdtest-sdk +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Type : Microsoft.Security/securityConnectors/devops/gitLabGroups/projects +Url : https://gitlab.com/dfdsdktests/testapp0 +``` + + + +### Example 2: List discovered GitLab projects +```powershell +Get-AzSecurityConnectorGitLabProject -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-gl-01 -GroupFqName dfdsdktests +``` + +```output +Name ResourceGroupName +---- ----------------- +testapp10 dfdtest-sdk +testapp11 dfdtest-sdk +testapp0 dfdtest-sdk +``` + + + +## PARAMETERS + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -GroupFqName +The GitLab group fully-qualified name. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -ProjectName +The project name. + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SecurityConnectorName +The security connector name. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure subscription ID + +```yaml +Type: System.String[] +Parameter Sets: Get, List +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProject + +## NOTES + +## RELATED LINKS + diff --git a/src/Security/Security.Autorest/help/Get-AzSecurityConnectorGitLabSubgroup.md b/src/Security/Security.Autorest/help/Get-AzSecurityConnectorGitLabSubgroup.md new file mode 100644 index 000000000000..301548ca7f13 --- /dev/null +++ b/src/Security/Security.Autorest/help/Get-AzSecurityConnectorGitLabSubgroup.md @@ -0,0 +1,162 @@ +--- +external help file: +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorgitlabsubgroup +schema: 2.0.0 +--- + +# Get-AzSecurityConnectorGitLabSubgroup + +## SYNOPSIS +Gets nested subgroups of given GitLab Group which are onboarded to the connector. + +## SYNTAX + +``` +Get-AzSecurityConnectorGitLabSubgroup -GroupFqName -ResourceGroupName + -SecurityConnectorName [-SubscriptionId ] [-DefaultProfile ] [-Confirm] + [-WhatIf] [] +``` + +## DESCRIPTION +Gets nested subgroups of given GitLab Group which are onboarded to the connector. + +## EXAMPLES + +### Example 1: List discovered GitLab subgroups +```powershell +Get-AzSecurityConnectorGitLabSubgroup -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-gl-01 -GroupFqName dfdsdktests +``` + +```output +Name ResourceGroupName +---- ----------------- +dfdsdktests$testsubgroup1$testsubgroupNested dfdtest-sdk +dfdsdktests$testsubgroup1 dfdtest-sdk +``` + + + +## PARAMETERS + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -GroupFqName +The GitLab group fully-qualified name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SecurityConnectorName +The security connector name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure subscription ID + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupListResponse + +## NOTES + +## RELATED LINKS + diff --git a/src/Security/Security.Autorest/help/Invoke-AzSecurityApiCollectionApimOffboard.md b/src/Security/Security.Autorest/help/Invoke-AzSecurityApiCollectionApimOffboard.md new file mode 100644 index 000000000000..eebf6dd443ab --- /dev/null +++ b/src/Security/Security.Autorest/help/Invoke-AzSecurityApiCollectionApimOffboard.md @@ -0,0 +1,198 @@ +--- +external help file: +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/az.security/invoke-azsecurityapicollectionapimoffboard +schema: 2.0.0 +--- + +# Invoke-AzSecurityApiCollectionApimOffboard + +## SYNOPSIS +Offboard an Azure API Management API from Microsoft Defender for APIs. +The system will stop monitoring the operations within the Azure API Management API for intrusive behaviors. + +## SYNTAX + +### Delete (Default) +``` +Invoke-AzSecurityApiCollectionApimOffboard -ApiId -ResourceGroupName -ServiceName + [-SubscriptionId ] [-DefaultProfile ] [-PassThru] [-Confirm] [-WhatIf] [] +``` + +### DeleteViaIdentity +``` +Invoke-AzSecurityApiCollectionApimOffboard -InputObject [-DefaultProfile ] + [-PassThru] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Offboard an Azure API Management API from Microsoft Defender for APIs. +The system will stop monitoring the operations within the Azure API Management API for intrusive behaviors. + +## EXAMPLES + +### Example 1: Offboard an Azure API Management API to Microsoft Defender for APIs. +```powershell +Invoke-AzSecurityApiCollectionApimOffboard -ResourceGroupName "apicollectionstests" -ServiceName "demoapimservice2" -ApiId "echo-api-2" +``` + + + +## PARAMETERS + +### -ApiId +API revision identifier. +Must be unique in the API Management service instance. +Non-current revision has ;rev=n as a suffix where n is the revision number. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +Parameter Sets: DeleteViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -PassThru +Returns true when the command succeeds + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ServiceName +The name of the API Management service. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure subscription ID + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity + +## OUTPUTS + +### System.Boolean + +## NOTES + +## RELATED LINKS + diff --git a/src/Security/Security.Autorest/help/Invoke-AzSecurityApiCollectionApimOnboard.md b/src/Security/Security.Autorest/help/Invoke-AzSecurityApiCollectionApimOnboard.md new file mode 100644 index 000000000000..3ab4ca5e3543 --- /dev/null +++ b/src/Security/Security.Autorest/help/Invoke-AzSecurityApiCollectionApimOnboard.md @@ -0,0 +1,232 @@ +--- +external help file: +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/az.security/invoke-azsecurityapicollectionapimonboard +schema: 2.0.0 +--- + +# Invoke-AzSecurityApiCollectionApimOnboard + +## SYNOPSIS +Onboard an Azure API Management API to Microsoft Defender for APIs. +The system will start monitoring the operations within the Azure Management API for intrusive behaviors and provide alerts for attacks that have been detected. + +## SYNTAX + +### Azure (Default) +``` +Invoke-AzSecurityApiCollectionApimOnboard -ApiId -ResourceGroupName -ServiceName + [-SubscriptionId ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] + [] +``` + +### AzureViaIdentity +``` +Invoke-AzSecurityApiCollectionApimOnboard -InputObject [-DefaultProfile ] + [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Onboard an Azure API Management API to Microsoft Defender for APIs. +The system will start monitoring the operations within the Azure Management API for intrusive behaviors and provide alerts for attacks that have been detected. + +## EXAMPLES + +### Example 1: Onboard an Azure API Management API to Microsoft Defender for APIs. +```powershell +Invoke-AzSecurityApiCollectionApimOnboard -ResourceGroupName "apicollectionstests" -ServiceName "demoapimservice2" -ApiId "echo-api-2" +``` + +```output +BaseUrl : https://demoapimservice2.azure-api.net +DiscoveredVia : /subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/apicollectionstests/providers/Microsoft.ApiManagement/service/demoapimservice2 +DisplayName : Echo API 2 +Id : /subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/apicollectionstests/providers/Microsoft.ApiManagement/service/demoapimservice2/providers/Microsoft.Security/apiCollections/ech + o-api-2 +Name : echo-api-2 +NumberOfApiEndpoint : 0 +NumberOfApiEndpointsWithSensitiveDataExposed : 0 +NumberOfExternalApiEndpoint : 0 +NumberOfInactiveApiEndpoint : 0 +NumberOfUnauthenticatedApiEndpoint : 0 +ProvisioningState : Succeeded +ResourceGroupName : apicollectionstests +SensitivityLabel : +Type : microsoft.security/apicollections +``` + + + +## PARAMETERS + +### -ApiId +API revision identifier. +Must be unique in the API Management service instance. +Non-current revision has ;rev=n as a suffix where n is the revision number. + +```yaml +Type: System.String +Parameter Sets: Azure +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +Parameter Sets: AzureViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: Azure +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ServiceName +The name of the API Management service. + +```yaml +Type: System.String +Parameter Sets: Azure +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure subscription ID + +```yaml +Type: System.String +Parameter Sets: Azure +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollection + +## NOTES + +## RELATED LINKS + diff --git a/src/Security/Security.Autorest/help/New-AzSecurityAwsEnvironmentObject.md b/src/Security/Security.Autorest/help/New-AzSecurityAwsEnvironmentObject.md new file mode 100644 index 000000000000..49eba2fd9b59 --- /dev/null +++ b/src/Security/Security.Autorest/help/New-AzSecurityAwsEnvironmentObject.md @@ -0,0 +1,124 @@ +--- +external help file: +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/Az.Security/new-azsecurityawsenvironmentobject +schema: 2.0.0 +--- + +# New-AzSecurityAwsEnvironmentObject + +## SYNOPSIS +Create an in-memory object for AwsEnvironment. + +## SYNTAX + +``` +New-AzSecurityAwsEnvironmentObject [-OrganizationalData ] [-Region ] + [-ScanInterval ] [] +``` + +## DESCRIPTION +Create an in-memory object for AwsEnvironment. + +## EXAMPLES + +### Example 1: Create new AwsEnvironment object as member +```powershell +$member = New-AzSecurityAwsOrganizationalDataMemberObject -ParentHierarchyId "123" +New-AzSecurityAwsEnvironmentObject -Region "Central US" -ScanInterval 24 -OrganizationalData $member +``` + +```output +AccountName : +EnvironmentType : AwsAccount +OrganizationalData : { + "organizationMembershipType": "Member", + "parentHierarchyId": "123" + } +Region : {Central US} +ScanInterval : 24 +``` + + + +### Example 2: Create new AwsEnvironment object as organization +```powershell +$organization = New-AzSecurityAwsOrganizationalDataMasterObject -StacksetName "myAwsStackSet" -ExcludedAccountId "123456789012" +New-AzSecurityAwsEnvironmentObject -Region "Central US" -ScanInterval 24 -OrganizationalData $organization +``` + +```output +AccountName : +EnvironmentType : AwsAccount +OrganizationalData : { + "organizationMembershipType": "Organization", + "stacksetName": "myAwsStackSet", + "excludedAccountIds": [ "123456789012" ] + } +Region : {Central US} +ScanInterval : 24 +``` + + + +## PARAMETERS + +### -OrganizationalData +The AWS account's organizational data. +. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAwsOrganizationalData +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Region +list of regions to scan. + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ScanInterval +Scan interval in hours (value should be between 1-hour to 24-hours). + +```yaml +Type: System.Int64 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AwsEnvironment + +## NOTES + +## RELATED LINKS + diff --git a/src/Security/Security.Autorest/help/New-AzSecurityAwsOrganizationalDataMasterObject.md b/src/Security/Security.Autorest/help/New-AzSecurityAwsOrganizationalDataMasterObject.md new file mode 100644 index 000000000000..2b81beb6a626 --- /dev/null +++ b/src/Security/Security.Autorest/help/New-AzSecurityAwsOrganizationalDataMasterObject.md @@ -0,0 +1,82 @@ +--- +external help file: +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/Az.Security/new-azsecurityawsorganizationaldatamasterobject +schema: 2.0.0 +--- + +# New-AzSecurityAwsOrganizationalDataMasterObject + +## SYNOPSIS +Create an in-memory object for AwsOrganizationalDataMaster. + +## SYNTAX + +``` +New-AzSecurityAwsOrganizationalDataMasterObject [-ExcludedAccountId ] [-StacksetName ] + [] +``` + +## DESCRIPTION +Create an in-memory object for AwsOrganizationalDataMaster. + +## EXAMPLES + +### Example 1: Create new AwsOrganizationalDataMaster object +```powershell +New-AzSecurityAwsOrganizationalDataMasterObject -StacksetName "myAwsStackSet" -ExcludedAccountId "123456789012" +``` + +```output +ExcludedAccountId OrganizationMembershipType StacksetName +----------------- -------------------------- ------------ +{123456789012} Organization myAwsStackSet +``` + + + +## PARAMETERS + +### -ExcludedAccountId +If the multi cloud account is of membership type organization, list of accounts excluded from offering. + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -StacksetName +If the multi cloud account is of membership type organization, this will be the name of the onboarding stackset. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AwsOrganizationalDataMaster + +## NOTES + +## RELATED LINKS + diff --git a/src/Security/Security.Autorest/help/New-AzSecurityAwsOrganizationalDataMemberObject.md b/src/Security/Security.Autorest/help/New-AzSecurityAwsOrganizationalDataMemberObject.md new file mode 100644 index 000000000000..a19129698d20 --- /dev/null +++ b/src/Security/Security.Autorest/help/New-AzSecurityAwsOrganizationalDataMemberObject.md @@ -0,0 +1,66 @@ +--- +external help file: +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/Az.Security/new-azsecurityawsorganizationaldatamemberobject +schema: 2.0.0 +--- + +# New-AzSecurityAwsOrganizationalDataMemberObject + +## SYNOPSIS +Create an in-memory object for AwsOrganizationalDataMember. + +## SYNTAX + +``` +New-AzSecurityAwsOrganizationalDataMemberObject [-ParentHierarchyId ] [] +``` + +## DESCRIPTION +Create an in-memory object for AwsOrganizationalDataMember. + +## EXAMPLES + +### Example 1: Create new AwsOrganizationalDataMember object +```powershell +New-AzSecurityAwsOrganizationalDataMemberObject -ParentHierarchyId "123" +``` + +```output +OrganizationMembershipType ParentHierarchyId +-------------------------- ----------------- +Member 123 +``` + + + +## PARAMETERS + +### -ParentHierarchyId +If the multi cloud account is not of membership type organization, this will be the ID of the account's parent. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AwsOrganizationalDataMember + +## NOTES + +## RELATED LINKS + diff --git a/src/Security/Security.Autorest/help/New-AzSecurityAzureDevOpsScopeEnvironmentObject.md b/src/Security/Security.Autorest/help/New-AzSecurityAzureDevOpsScopeEnvironmentObject.md new file mode 100644 index 000000000000..09ce09624915 --- /dev/null +++ b/src/Security/Security.Autorest/help/New-AzSecurityAzureDevOpsScopeEnvironmentObject.md @@ -0,0 +1,51 @@ +--- +external help file: +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/Az.Security/new-azsecurityazuredevopsscopeenvironmentobject +schema: 2.0.0 +--- + +# New-AzSecurityAzureDevOpsScopeEnvironmentObject + +## SYNOPSIS +Create an in-memory object for AzureDevOpsScopeEnvironment. + +## SYNTAX + +``` +New-AzSecurityAzureDevOpsScopeEnvironmentObject [] +``` + +## DESCRIPTION +Create an in-memory object for AzureDevOpsScopeEnvironment. + +## EXAMPLES + +### Example 1: Create new AzureDevOpsScopeEnvironment object +```powershell +New-AzSecurityAzureDevOpsScopeEnvironmentObject +``` + +```output +EnvironmentType +--------------- +AzureDevOpsScope +``` + + + +## PARAMETERS + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsScopeEnvironment + +## NOTES + +## RELATED LINKS + diff --git a/src/Security/Security.Autorest/help/New-AzSecurityConnector.md b/src/Security/Security.Autorest/help/New-AzSecurityConnector.md new file mode 100644 index 000000000000..254b8b79d12c --- /dev/null +++ b/src/Security/Security.Autorest/help/New-AzSecurityConnector.md @@ -0,0 +1,612 @@ +--- +external help file: +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/az.security/new-azsecurityconnector +schema: 2.0.0 +--- + +# New-AzSecurityConnector + +## SYNOPSIS +Create a security connector. +If a security connector is already created and a subsequent request is issued for the same security connector id, then it will be updated. + +## SYNTAX + +``` +New-AzSecurityConnector -Name -ResourceGroupName [-SubscriptionId ] + [-EnvironmentData ] [-EnvironmentName ] [-Etag ] + [-HierarchyIdentifier ] [-Kind ] [-Location ] [-Offering ] + [-Tag ] [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Create a security connector. +If a security connector is already created and a subsequent request is issued for the same security connector id, then it will be updated. + +## EXAMPLES + +### Example 1: Create AWS security connector +```powershell +$account = "891376984375" +$arnPrefix = "arn:aws:iam::$($account):role" + +$cspmMonitorOffering = New-AzSecurityCspmMonitorAwsOfferingObject -NativeCloudConnectionCloudRoleArn "$arnPrefix/CspmMonitorAws" + +$dcspmOffering = New-AzSecurityDefenderCspmAwsOfferingObject ` + -VMScannerEnabled $true -ConfigurationScanningMode Default -ConfigurationCloudRoleArn "$arnPrefix/DefenderForCloud-AgentlessScanner" ` + -DataSensitivityDiscoveryEnabled $true -DataSensitivityDiscoveryCloudRoleArn "$arnPrefix/SensitiveDataDiscovery" ` + -DatabaseDspmEnabled $true -DatabaseDspmCloudRoleArn "$arnPrefix/DefenderForCloud-DataSecurityPostureDB" ` + -CiemDiscoveryCloudRoleArn "$arnPrefix/DefenderForCloud-Ciem" -CiemOidcAzureActiveDirectoryAppName "mciem-aws-oidc-connector" -CiemOidcCloudRoleArn "$arnPrefix/DefenderForCloud-OidcCiem" ` + -MdcContainerImageAssessmentEnabled $true -MdcContainerImageAssessmentCloudRoleArn "$arnPrefix/MDCContainersImageAssessmentRole" ` + -MdcContainerAgentlessDiscoveryK8SEnabled $true -MdcContainerAgentlessDiscoveryK8SCloudRoleArn "$arnPrefix/MDCContainersAgentlessDiscoveryK8sRole" + +$defenderForContainersOffering = New-AzSecurityDefenderForContainersAwsOfferingObject ` + -AutoProvisioning $true -KuberneteServiceCloudRoleArn "$arnPrefix/DefenderForCloud-Containers-K8s" -KuberneteScubaReaderCloudRoleArn "$arnPrefix/DefenderForCloud-DataCollection" ` + -KinesiToS3CloudRoleArn "$arnPrefix/DefenderForCloud-Containers-K8s-kinesis-to-s3" -CloudWatchToKinesiCloudRoleArn "$arnPrefix/DefenderForCloud-Containers-K8s-cloudwatch-to-kinesis" ` + -KubeAuditRetentionTime 30 -ScubaExternalId "a47ae0a2-7bf7-482a-897a-7a139d30736c" ` + -MdcContainerAgentlessDiscoveryK8SEnabled $true -MdcContainerAgentlessDiscoveryK8SCloudRoleArn "$arnPrefix/MDCContainersAgentlessDiscoveryK8sRole" ` + -MdcContainerImageAssessmentEnabled $true -MdcContainerImageAssessmentCloudRoleArn "$arnPrefix/MDCContainersImageAssessmentRole" ` + -EnableContainerVulnerabilityAssessment $false + +$environment = New-AzSecurityAwsEnvironmentObject -ScanInterval 24 + +New-AzSecurityConnector -Name "aws-sdktest01" -ResourceGroupName "securityConnectors-tests" ` + -EnvironmentData $environment -EnvironmentName AWS -HierarchyIdentifier "$account" ` + -Offering @($cspmMonitorOffering, $dcspmOffering, $defenderForContainersOffering) ` + -Location "CentralUS" +``` + +```output +EnvironmentData : { + "environmentType": "AwsAccount", + "regions": [ ], + "scanInterval": 24 + } +EnvironmentName : AWS +Etag : +HierarchyIdentifier : 891376984375 +HierarchyIdentifierTrialEndDate : 3/24/2024 12:00:00 AM +Id : /subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourcegroups/securityconnectors-tests/providers/Microsoft.Security/securityConnectors/aws-sdktes + t01 +Kind : +Location : CentralUS +Name : aws-sdktest01 +Offering : {{ + "offeringType": "CspmMonitorAws", + "nativeCloudConnection": { + "cloudRoleArn": "arn:aws:iam::891376984375:role/CspmMonitorAws" + } + }, { + "offeringType": "DefenderCspmAws", + "vmScanners": { + "configuration": { + "cloudRoleArn": "arn:aws:iam::891376984375:role/DefenderForCloud-AgentlessScanner", + "scanningMode": "Default" + }, + "enabled": true + }, + "dataSensitivityDiscovery": { + "enabled": true, + "cloudRoleArn": "arn:aws:iam::891376984375:role/SensitiveDataDiscovery" + }, + "databasesDspm": { + "enabled": true, + "cloudRoleArn": "arn:aws:iam::891376984375:role/DefenderForCloud-DataSecurityPostureDB" + }, + "ciem": { + "ciemDiscovery": { + "cloudRoleArn": "arn:aws:iam::891376984375:role/DefenderForCloud-Ciem" + }, + "ciemOidc": { + "cloudRoleArn": "arn:aws:iam::891376984375:role/DefenderForCloud-OidcCiem", + "azureActiveDirectoryAppName": "mciem-aws-oidc-connector" + } + }, + "mdcContainersImageAssessment": { + "enabled": true, + "cloudRoleArn": "arn:aws:iam::891376984375:role/MDCContainersImageAssessmentRole" + }, + "mdcContainersAgentlessDiscoveryK8s": { + "enabled": true, + "cloudRoleArn": "arn:aws:iam::891376984375:role/MDCContainersAgentlessDiscoveryK8sRole" + } + }, { + "offeringType": "DefenderForContainersAws", + "kubernetesService": { + "cloudRoleArn": "arn:aws:iam::891376984375:role/DefenderForCloud-Containers-K8s" + }, + "kubernetesScubaReader": { + "cloudRoleArn": "arn:aws:iam::891376984375:role/DefenderForCloud-DataCollection" + }, + "cloudWatchToKinesis": { + "cloudRoleArn": "arn:aws:iam::891376984375:role/DefenderForCloud-Containers-K8s-cloudwatch-to-kinesis" + }, + "kinesisToS3": { + "cloudRoleArn": "arn:aws:iam::891376984375:role/DefenderForCloud-Containers-K8s-kinesis-to-s3" + }, + "mdcContainersImageAssessment": { + "enabled": true, + "cloudRoleArn": "arn:aws:iam::891376984375:role/MDCContainersImageAssessmentRole" + }, + "mdcContainersAgentlessDiscoveryK8s": { + "enabled": true, + "cloudRoleArn": "arn:aws:iam::891376984375:role/MDCContainersAgentlessDiscoveryK8sRole" + }, + "enableContainerVulnerabilityAssessment": false, + "autoProvisioning": true, + "kubeAuditRetentionTime": 30, + "scubaExternalId": "a47ae0a2-7bf7-482a-897a-7a139d30736c" + }} +ResourceGroupName : securityconnectors-tests +SystemDataCreatedAt : 2/22/2024 11:45:53 PM +SystemDataCreatedBy : c3d82ccb-fee1-430c-949e-6c0a217c00a8 +SystemDataCreatedByType : Application +SystemDataLastModifiedAt : 2/22/2024 11:45:53 PM +SystemDataLastModifiedBy : c3d82ccb-fee1-430c-949e-6c0a217c00a8 +SystemDataLastModifiedByType : Application +Tag : { + } +Type : Microsoft.Security/securityconnectors +``` + + + +### Example 2: Create GCP security connector +```powershell +$account = "843025268399" +$emailSuffix = "myproject.iam.gserviceaccount.com" +$cspmMonitorOffering = New-AzSecurityCspmMonitorGcpOfferingObject -NativeCloudConnectionServiceAccountEmailAddress "microsoft-defender-cspm@$emailSuffix" -NativeCloudConnectionWorkloadIdentityProviderId "cspm" + +$dcspmOffering = New-AzSecurityDefenderCspmGcpOfferingObject ` + -VMScannerEnabled $true -ConfigurationScanningMode Default -ConfigurationExclusionTag @{key="value"} ` + -MdcContainerAgentlessDiscoveryK8SEnabled $true -MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress "mdc-containers-k8s-operator@$emailSuffix" -MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId "containers" ` + -MdcContainerImageAssessmentEnabled $true -MdcContainerImageAssessmentServiceAccountEmailAddress "mdc-containers-artifact-assess@$emailSuffix" -MdcContainerImageAssessmentWorkloadIdentityProviderId "containers" ` + -DataSensitivityDiscoveryEnabled $true -DataSensitivityDiscoveryServiceAccountEmailAddress "mdc-data-sec-posture-storage@$emailSuffix" -DataSensitivityDiscoveryWorkloadIdentityProviderId "data-security-posture-storage" ` + -CiemDiscoveryServiceAccountEmailAddress "microsoft-defender-ciem@$emailSuffix" -CiemDiscoveryAzureActiveDirectoryAppName "mciem-gcp-oidc-app" -CiemDiscoveryWorkloadIdentityProviderId "ciem-discovery" + +$defenderForContainersOffering = New-AzSecurityDefenderForContainersGcpOfferingObject ` + -NativeCloudConnectionServiceAccountEmailAddress "microsoft-defender-containers@$emailSuffix" -NativeCloudConnectionWorkloadIdentityProviderId "containers" ` + -DataPipelineNativeCloudConnectionServiceAccountEmailAddress "ms-defender-containers-stream@$emailSuffix" -DataPipelineNativeCloudConnectionWorkloadIdentityProviderId "containers-streams" ` + -AuditLogsAutoProvisioningFlag $true -DefenderAgentAutoProvisioningFlag $true -PolicyAgentAutoProvisioningFlag $true ` + -MdcContainerAgentlessDiscoveryK8SEnabled $true -MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId "containers" -MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress "mdc-containers-k8s-operator@$emailSuffix" ` + -MdcContainerImageAssessmentEnabled $true -MdcContainerImageAssessmentWorkloadIdentityProviderId "containers" -MdcContainerImageAssessmentServiceAccountEmailAddress "mdc-containers-artifact-assess@$emailSuffix" + +$environment = New-AzSecurityGcpProjectEnvironmentObject -ScanInterval 24 -ProjectDetailProjectId "asc-sdk-samples" -ProjectDetailProjectNumber "$account" + +New-AzSecurityConnector -Name "gcp-sdktest01" -ResourceGroupName "securityConnectors-tests" -EnvironmentData $environment -EnvironmentName GCP -HierarchyIdentifier "$account" ` + -Offering @($cspmMonitorOffering, $dcspmOffering, $defenderForContainersOffering) -Location "CentralUS" +``` + +```output +EnvironmentData : { + "environmentType": "GcpProject", + "projectDetails": { + "projectNumber": "843025268399", + "projectId": "asc-sdk-samples" + }, + "scanInterval": 24 + } +EnvironmentName : GCP +Etag : +HierarchyIdentifier : 843025268399 +HierarchyIdentifierTrialEndDate : 3/24/2024 12:00:00 AM +Id : /subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourcegroups/securityconnectors-tests/providers/Microsoft.Security/securityConnectors/gcp-sdktest01 +Kind : +Location : CentralUS +Name : gcp-sdktest01 +Offering : {{ + "offeringType": "CspmMonitorGcp", + "nativeCloudConnection": { + "workloadIdentityProviderId": "cspm", + "serviceAccountEmailAddress": "microsoft-defender-cspm@myproject.iam.gserviceaccount.com" + } + }, { + "offeringType": "DefenderCspmGcp", + "ciemDiscovery": { + "workloadIdentityProviderId": "ciem-discovery", + "serviceAccountEmailAddress": "microsoft-defender-ciem@myproject.iam.gserviceaccount.com", + "azureActiveDirectoryAppName": "mciem-gcp-oidc-app" + }, + "vmScanners": { + "configuration": { + "scanningMode": "Default", + "exclusionTags": { + "key": "value" + } + }, + "enabled": true + }, + "dataSensitivityDiscovery": { + "enabled": true, + "workloadIdentityProviderId": "data-security-posture-storage", + "serviceAccountEmailAddress": "mdc-data-sec-posture-storage@myproject.iam.gserviceaccount.com" + }, + "mdcContainersImageAssessment": { + "enabled": true, + "workloadIdentityProviderId": "containers", + "serviceAccountEmailAddress": "mdc-containers-artifact-assess@myproject.iam.gserviceaccount.com" + }, + "mdcContainersAgentlessDiscoveryK8s": { + "enabled": true, + "workloadIdentityProviderId": "containers", + "serviceAccountEmailAddress": "mdc-containers-k8s-operator@myproject.iam.gserviceaccount.com" + } + }, { + "offeringType": "DefenderForContainersGcp", + "nativeCloudConnection": { + "serviceAccountEmailAddress": "microsoft-defender-containers@myproject.iam.gserviceaccount.com", + "workloadIdentityProviderId": "containers" + }, + "dataPipelineNativeCloudConnection": { + "serviceAccountEmailAddress": "ms-defender-containers-stream@myproject.iam.gserviceaccount.com", + "workloadIdentityProviderId": "containers-streams" + }, + "mdcContainersImageAssessment": { + "enabled": true, + "workloadIdentityProviderId": "containers", + "serviceAccountEmailAddress": "mdc-containers-artifact-assess@myproject.iam.gserviceaccount.com" + }, + "mdcContainersAgentlessDiscoveryK8s": { + "enabled": true, + "workloadIdentityProviderId": "containers", + "serviceAccountEmailAddress": "mdc-containers-k8s-operator@myproject.iam.gserviceaccount.com" + }, + "auditLogsAutoProvisioningFlag": true, + "defenderAgentAutoProvisioningFlag": true, + "policyAgentAutoProvisioningFlag": true + }} +ResourceGroupName : securityconnectors-tests +SystemDataCreatedAt : 2/22/2024 11:45:53 PM +SystemDataCreatedBy : c3d82ccb-fee1-430c-949e-6c0a217c00a8 +SystemDataCreatedByType : Application +SystemDataLastModifiedAt : 2/22/2024 11:45:53 PM +SystemDataLastModifiedBy : c3d82ccb-fee1-430c-949e-6c0a217c00a8 +SystemDataLastModifiedByType : Application +Tag : {} +Type : Microsoft.Security/securityconnectors +``` + + + +### Example 3: Create AzureDevOps security connector +```powershell +New-AzSecurityConnector -ResourceGroupName "securityConnectors-pwsh-tmp" -Name "ado-sdk-pwsh-test03" ` + -EnvironmentName AzureDevOps -EnvironmentData (New-AzSecurityAzureDevOpsScopeEnvironmentObject) ` + -HierarchyIdentifier ([guid]::NewGuid().ToString()) -Location "CentralUS" ` + -Offering @(New-AzSecurityCspmMonitorAzureDevOpsOfferingObject) +``` + +```output +EnvironmentData : { + "environmentType": "AzureDevOpsScope" + } +EnvironmentName : AzureDevOps +Etag : +HierarchyIdentifier : 9dd01e19-8aaf-43a2-8dd4-1c5992f4df35 +HierarchyIdentifierTrialEndDate : +Id : /subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourcegroups/securityconnectors-pwsh-tmp/providers/Microsoft.Security/securityConnectors/ado-sdk-pwsh-test03 +Kind : +Location : CentralUS +Name : ado-sdk-pwsh-test03 +Offering : {{ + "offeringType": "CspmMonitorAzureDevOps" + }} +ResourceGroupName : securityconnectors-pwsh-tmp +SystemDataCreatedAt : 2/24/2024 12:13:11 AM +SystemDataCreatedBy : c3d82ccb-fee1-430c-949e-6c0a217c00a8 +SystemDataCreatedByType : Application +SystemDataLastModifiedAt : 2/24/2024 12:13:11 AM +SystemDataLastModifiedBy : c3d82ccb-fee1-430c-949e-6c0a217c00a8 +SystemDataLastModifiedByType : Application +Tag : { + } +Type : Microsoft.Security/securityconnectors +``` + + + +### Example 4: Create GitHub security connector +```powershell +New-AzSecurityConnector -ResourceGroupName "securityConnectors-pwsh-tmp" -Name "gh-sdk-pwsh-test03" ` + -EnvironmentName GitHub -EnvironmentData (New-AzSecurityGitHubScopeEnvironmentObject) ` + -HierarchyIdentifier ([guid]::NewGuid().ToString()) -Location "CentralUS" ` + -Offering @(New-AzSecurityCspmMonitorGithubOfferingObject) +``` + +```output +EnvironmentData : { + "environmentType": "GithubScope" + } +EnvironmentName : Github +Etag : +HierarchyIdentifier : e8661d05-8003-46ae-b687-fa83746f44f3 +HierarchyIdentifierTrialEndDate : +Id : /subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourcegroups/securityconnectors-pwsh-tmp/providers/Microsoft.Security/securityConnectors/gh-sdk-pwsh-test03 +Kind : +Location : CentralUS +Name : gh-sdk-pwsh-test03 +Offering : {{ + "offeringType": "CspmMonitorGithub" + }} +ResourceGroupName : securityconnectors-pwsh-tmp +SystemDataCreatedAt : 2/24/2024 12:55:33 AM +SystemDataCreatedBy : c3d82ccb-fee1-430c-949e-6c0a217c00a8 +SystemDataCreatedByType : Application +SystemDataLastModifiedAt : 2/24/2024 12:55:33 AM +SystemDataLastModifiedBy : c3d82ccb-fee1-430c-949e-6c0a217c00a8 +SystemDataLastModifiedByType : Application +Tag : { + } +Type : Microsoft.Security/securityconnectors +``` + + + +### Example 5: Create GitLab security connector +```powershell +New-AzSecurityConnector -ResourceGroupName "securityConnectors-pwsh-tmp" -Name "gl-sdk-pwsh-test03" ` + -EnvironmentName GitLab -EnvironmentData (New-AzSecurityGitLabScopeEnvironmentObject) ` + -HierarchyIdentifier ([guid]::NewGuid().ToString()) -Location "CentralUS" ` + -Offering @(New-AzSecurityCspmMonitorGitLabOfferingObject) +``` + +```output +EnvironmentData : { + "environmentType": "GitLabScope" + } +EnvironmentName : GitLab +Etag : +HierarchyIdentifier : e8661d05-8003-46ae-b687-fa83746f44f3 +HierarchyIdentifierTrialEndDate : +Id : /subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourcegroups/securityconnectors-pwsh-tmp/providers/Microsoft.Security/securityConnectors/gl-sdk-pwsh-test03 +Kind : +Location : CentralUS +Name : gl-sdk-pwsh-test03 +Offering : {{ + "offeringType": "CspmMonitorGitLab" + }} +ResourceGroupName : securityconnectors-pwsh-tmp +SystemDataCreatedAt : 2/24/2024 12:55:33 AM +SystemDataCreatedBy : c3d82ccb-fee1-430c-949e-6c0a217c00a8 +SystemDataCreatedByType : Application +SystemDataLastModifiedAt : 2/24/2024 12:55:33 AM +SystemDataLastModifiedBy : c3d82ccb-fee1-430c-949e-6c0a217c00a8 +SystemDataLastModifiedByType : Application +Tag : { + } +Type : Microsoft.Security/securityconnectors +``` + + + +## PARAMETERS + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -EnvironmentData +The security connector environment data. +. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironment +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -EnvironmentName +The multi cloud resource's cloud name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Etag +Entity tag is used for comparing two or more entities from the same requested resource. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -HierarchyIdentifier +The multi cloud resource identifier (account id in case of AWS connector, project number in case of GCP connector). + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Kind +Kind of the resource + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Location +Location where the resource is stored + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +The security connector name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: SecurityConnectorName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Offering +A collection of offerings for the security connector. +. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOffering[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group within the user's subscription. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure subscription ID + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Tag +A list of key value pairs that describe the resource. + +```yaml +Type: System.Collections.Hashtable +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnector + +## NOTES + +## RELATED LINKS + diff --git a/src/Security/Security.Autorest/help/New-AzSecurityConnectorActionableRemediationObject.md b/src/Security/Security.Autorest/help/New-AzSecurityConnectorActionableRemediationObject.md new file mode 100644 index 000000000000..59dc566ad45a --- /dev/null +++ b/src/Security/Security.Autorest/help/New-AzSecurityConnectorActionableRemediationObject.md @@ -0,0 +1,132 @@ +--- +external help file: +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/Az.Security/new-azsecurityconnectoractionableremediationobject +schema: 2.0.0 +--- + +# New-AzSecurityConnectorActionableRemediationObject + +## SYNOPSIS +Create an in-memory object for ActionableRemediation. + +## SYNTAX + +``` +New-AzSecurityConnectorActionableRemediationObject [-BranchConfiguration ] + [-CategoryConfiguration ] [-InheritFromParentState ] [-State ] + [] +``` + +## DESCRIPTION +Create an in-memory object for ActionableRemediation. + +## EXAMPLES + +### Example 1: Create new ActionableRemediation object +```powershell +New-AzSecurityConnectorActionableRemediationObject -State Enabled -InheritFromParentState Disabled ` + -BranchConfiguration @{AnnotateDefaultBranch="Enabled"; branchName=@("main", "hotfix")} -CategoryConfiguration @( @{category="First"; minimumSeverityLevel="High"}, @{category="Second"; minimumSeverityLevel="Low"}) +``` + +```output +BranchConfiguration : { + "branchNames": [ "main", "hotfix" ], + "annotateDefaultBranch": "Enabled" + } +CategoryConfiguration : {{ + "minimumSeverityLevel": "High", + "category": "First" + }, { + "minimumSeverityLevel": "Low", + "category": "Second" + }} +InheritFromParentState : Disabled +State : Enabled +``` + + + +## PARAMETERS + +### -BranchConfiguration +Repository branch configuration for PR Annotations. +. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ITargetBranchConfiguration +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -CategoryConfiguration +Gets or sets list of categories and severity levels. +. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICategoryConfiguration[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InheritFromParentState +Update Settings. + + Enabled - Resource should inherit configurations from parent. + Disabled - Resource should not inherit configurations from parent. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -State +ActionableRemediation Setting. + None - the setting was never set. + Enabled - ActionableRemediation is enabled. + Disabled - ActionableRemediation is disabled. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ActionableRemediation + +## NOTES + +## RELATED LINKS + diff --git a/src/Security/Security.Autorest/help/New-AzSecurityConnectorDevOpsConfiguration.md b/src/Security/Security.Autorest/help/New-AzSecurityConnectorDevOpsConfiguration.md new file mode 100644 index 000000000000..334a4acfb5bc --- /dev/null +++ b/src/Security/Security.Autorest/help/New-AzSecurityConnectorDevOpsConfiguration.md @@ -0,0 +1,236 @@ +--- +external help file: +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/az.security/new-azsecurityconnectordevopsconfiguration +schema: 2.0.0 +--- + +# New-AzSecurityConnectorDevOpsConfiguration + +## SYNOPSIS +Create a DevOps Configuration. + +## SYNTAX + +``` +New-AzSecurityConnectorDevOpsConfiguration -ResourceGroupName -SecurityConnectorName + [-SubscriptionId ] [-AuthorizationCode ] [-AutoDiscovery ] + [-TopLevelInventoryList ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] + [] +``` + +## DESCRIPTION +Create a DevOps Configuration. + +## EXAMPLES + +### Example 1: Create new DevOps Configuration for the security connector +```powershell +New-AzSecurityConnectorDevOpsConfiguration -ResourceGroupName "securityconnectors-pwsh-tmp" -SecurityConnectorName "ado-sdk-pwsh-test03" -AutoDiscovery Disabled -TopLevelInventoryList @("org1", "org2") -AuthorizationCode "myAuthorizationCode" +``` + +```output +AuthorizationCode : +AutoDiscovery : Disabled +Id : /subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/securityconnectors-pwsh-tmp/providers/Microsoft.Security/securityConnectors/ado-sdk-pwsh-test03/devops/default +Name : default +ProvisioningState : Succeeded +ProvisioningStatusMessage : Resource creation successful. +ProvisioningStatusUpdateTimeUtc : +ResourceGroupName : securityconnectors-pwsh-tmp +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +TopLevelInventoryList : +Type : Microsoft.Security/securityConnectors/devops +``` + + + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -AuthorizationCode +Gets or sets one-time OAuth code to exchange for refresh and access tokens.Only used during PUT/PATCH operations. +The secret is cleared during GET. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -AutoDiscovery +AutoDiscovery states. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SecurityConnectorName +The security connector name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure subscription ID + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TopLevelInventoryList +List of top-level inventory to select when AutoDiscovery is disabled.This field is ignored when AutoDiscovery is enabled. + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfiguration + +## NOTES + +## RELATED LINKS + diff --git a/src/Security/Security.Autorest/help/New-AzSecurityCspmMonitorAwsOfferingObject.md b/src/Security/Security.Autorest/help/New-AzSecurityCspmMonitorAwsOfferingObject.md new file mode 100644 index 000000000000..5445f328cb32 --- /dev/null +++ b/src/Security/Security.Autorest/help/New-AzSecurityCspmMonitorAwsOfferingObject.md @@ -0,0 +1,66 @@ +--- +external help file: +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritycspmmonitorawsofferingobject +schema: 2.0.0 +--- + +# New-AzSecurityCspmMonitorAwsOfferingObject + +## SYNOPSIS +Create an in-memory object for CspmMonitorAwsOffering. + +## SYNTAX + +``` +New-AzSecurityCspmMonitorAwsOfferingObject [-NativeCloudConnectionCloudRoleArn ] [] +``` + +## DESCRIPTION +Create an in-memory object for CspmMonitorAwsOffering. + +## EXAMPLES + +### Example 1: Create new CspmMonitorAwsOffering object +```powershell +New-AzSecurityCspmMonitorAwsOfferingObject -NativeCloudConnectionCloudRoleArn "arn:aws:iam::123456789012:role/CspmMonitorAws" +``` + +```output +Description NativeCloudConnectionCloudRoleArn OfferingType +----------- --------------------------------- ------------ + arn:aws:iam::123456789012:role/CspmMonitorAws CspmMonitorAws +``` + + + +## PARAMETERS + +### -NativeCloudConnectionCloudRoleArn +The cloud role ARN in AWS for this feature. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CspmMonitorAwsOffering + +## NOTES + +## RELATED LINKS + diff --git a/src/Security/Security.Autorest/help/New-AzSecurityCspmMonitorAzureDevOpsOfferingObject.md b/src/Security/Security.Autorest/help/New-AzSecurityCspmMonitorAzureDevOpsOfferingObject.md new file mode 100644 index 000000000000..322ff17055a2 --- /dev/null +++ b/src/Security/Security.Autorest/help/New-AzSecurityCspmMonitorAzureDevOpsOfferingObject.md @@ -0,0 +1,51 @@ +--- +external help file: +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritycspmmonitorazuredevopsofferingobject +schema: 2.0.0 +--- + +# New-AzSecurityCspmMonitorAzureDevOpsOfferingObject + +## SYNOPSIS +Create an in-memory object for CspmMonitorAzureDevOpsOffering. + +## SYNTAX + +``` +New-AzSecurityCspmMonitorAzureDevOpsOfferingObject [] +``` + +## DESCRIPTION +Create an in-memory object for CspmMonitorAzureDevOpsOffering. + +## EXAMPLES + +### Example 1: Create new CspmMonitorAzureDevOpsOffering object +```powershell +New-AzSecurityCspmMonitorAzureDevOpsOfferingObject +``` + +```output +Description OfferingType +----------- ------------ + CspmMonitorAzureDevOps +``` + + + +## PARAMETERS + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CspmMonitorAzureDevOpsOffering + +## NOTES + +## RELATED LINKS + diff --git a/src/Security/Security.Autorest/help/New-AzSecurityCspmMonitorGcpOfferingObject.md b/src/Security/Security.Autorest/help/New-AzSecurityCspmMonitorGcpOfferingObject.md new file mode 100644 index 000000000000..b517486a45af --- /dev/null +++ b/src/Security/Security.Autorest/help/New-AzSecurityCspmMonitorGcpOfferingObject.md @@ -0,0 +1,82 @@ +--- +external help file: +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritycspmmonitorgcpofferingobject +schema: 2.0.0 +--- + +# New-AzSecurityCspmMonitorGcpOfferingObject + +## SYNOPSIS +Create an in-memory object for CspmMonitorGcpOffering. + +## SYNTAX + +``` +New-AzSecurityCspmMonitorGcpOfferingObject [-NativeCloudConnectionServiceAccountEmailAddress ] + [-NativeCloudConnectionWorkloadIdentityProviderId ] [] +``` + +## DESCRIPTION +Create an in-memory object for CspmMonitorGcpOffering. + +## EXAMPLES + +### Example 1: Create new CspmMonitorGcpOffering object +```powershell +New-AzSecurityCspmMonitorGcpOfferingObject -NativeCloudConnectionServiceAccountEmailAddress "microsoft-defender-cspm@asc-sdk-samples.iam.gserviceaccount.com" -NativeCloudConnectionWorkloadIdentityProviderId "cspm" +``` + +```output +Description NativeCloudConnectionServiceAccountEmailAddress NativeCloudConnectionWorkloadIdentityProviderId OfferingType +----------- ----------------------------------------------- ----------------------------------------------- ------------ + microsoft-defender-cspm@asc-sdk-samples.iam.gserviceaccount.com cspm CspmMonitorGcp +``` + + + +## PARAMETERS + +### -NativeCloudConnectionServiceAccountEmailAddress +The service account email address in GCP for this offering. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NativeCloudConnectionWorkloadIdentityProviderId +The GCP workload identity provider id for the offering. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CspmMonitorGcpOffering + +## NOTES + +## RELATED LINKS + diff --git a/src/Security/Security.Autorest/help/New-AzSecurityCspmMonitorGitLabOfferingObject.md b/src/Security/Security.Autorest/help/New-AzSecurityCspmMonitorGitLabOfferingObject.md new file mode 100644 index 000000000000..a733d02a4530 --- /dev/null +++ b/src/Security/Security.Autorest/help/New-AzSecurityCspmMonitorGitLabOfferingObject.md @@ -0,0 +1,51 @@ +--- +external help file: +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritycspmmonitorgitlabofferingobject +schema: 2.0.0 +--- + +# New-AzSecurityCspmMonitorGitLabOfferingObject + +## SYNOPSIS +Create an in-memory object for CspmMonitorGitLabOffering. + +## SYNTAX + +``` +New-AzSecurityCspmMonitorGitLabOfferingObject [] +``` + +## DESCRIPTION +Create an in-memory object for CspmMonitorGitLabOffering. + +## EXAMPLES + +### Example 1: Create new CspmMonitorGitLabOffering object +```powershell +New-AzSecurityCspmMonitorGitLabOfferingObject +``` + +```output +Description OfferingType +----------- ------------ + CspmMonitorGitLab +``` + + + +## PARAMETERS + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CspmMonitorGitLabOffering + +## NOTES + +## RELATED LINKS + diff --git a/src/Security/Security.Autorest/help/New-AzSecurityCspmMonitorGithubOfferingObject.md b/src/Security/Security.Autorest/help/New-AzSecurityCspmMonitorGithubOfferingObject.md new file mode 100644 index 000000000000..c1c01a8b24e0 --- /dev/null +++ b/src/Security/Security.Autorest/help/New-AzSecurityCspmMonitorGithubOfferingObject.md @@ -0,0 +1,51 @@ +--- +external help file: +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritycspmmonitorgithubofferingobject +schema: 2.0.0 +--- + +# New-AzSecurityCspmMonitorGithubOfferingObject + +## SYNOPSIS +Create an in-memory object for CspmMonitorGithubOffering. + +## SYNTAX + +``` +New-AzSecurityCspmMonitorGithubOfferingObject [] +``` + +## DESCRIPTION +Create an in-memory object for CspmMonitorGithubOffering. + +## EXAMPLES + +### Example 1: Create new CspmMonitorGithubOffering object +```powershell +New-AzSecurityCspmMonitorGithubOfferingObject +``` + +```output +Description OfferingType +----------- ------------ + CspmMonitorGithub +``` + + + +## PARAMETERS + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CspmMonitorGithubOffering + +## NOTES + +## RELATED LINKS + diff --git a/src/Security/Security.Autorest/help/New-AzSecurityDefenderCspmAwsOfferingObject.md b/src/Security/Security.Autorest/help/New-AzSecurityDefenderCspmAwsOfferingObject.md new file mode 100644 index 000000000000..2a6e4fc5dc84 --- /dev/null +++ b/src/Security/Security.Autorest/help/New-AzSecurityDefenderCspmAwsOfferingObject.md @@ -0,0 +1,308 @@ +--- +external help file: +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritydefendercspmawsofferingobject +schema: 2.0.0 +--- + +# New-AzSecurityDefenderCspmAwsOfferingObject + +## SYNOPSIS +Create an in-memory object for DefenderCspmAwsOffering. + +## SYNTAX + +``` +New-AzSecurityDefenderCspmAwsOfferingObject [-CiemDiscoveryCloudRoleArn ] + [-CiemOidcAzureActiveDirectoryAppName ] [-CiemOidcCloudRoleArn ] + [-ConfigurationCloudRoleArn ] + [-ConfigurationExclusionTag ] + [-ConfigurationScanningMode ] [-DatabaseDspmCloudRoleArn ] [-DatabaseDspmEnabled ] + [-DataSensitivityDiscoveryCloudRoleArn ] [-DataSensitivityDiscoveryEnabled ] + [-MdcContainerAgentlessDiscoveryK8SCloudRoleArn ] + [-MdcContainerAgentlessDiscoveryK8SEnabled ] [-MdcContainerImageAssessmentCloudRoleArn ] + [-MdcContainerImageAssessmentEnabled ] [-VMScannerEnabled ] [] +``` + +## DESCRIPTION +Create an in-memory object for DefenderCspmAwsOffering. + +## EXAMPLES + +### Example 1: Create new DefenderCspmAwsOffering object +```powershell +$arnPrefix = "arn:aws:iam::123456789012:role" +New-AzSecurityDefenderCspmAwsOfferingObject ` + -VMScannerEnabled $true -ConfigurationScanningMode Default -ConfigurationCloudRoleArn "$arnPrefix/DefenderForCloud-AgentlessScanner" -ConfigurationExclusionTag @{key="value"} ` + -DataSensitivityDiscoveryEnabled $true -DataSensitivityDiscoveryCloudRoleArn "$arnPrefix/SensitiveDataDiscovery" ` + -DatabaseDspmEnabled $true -DatabaseDspmCloudRoleArn "$arnPrefix/DefenderForCloud-DataSecurityPostureDB" ` + -CiemDiscoveryCloudRoleArn "$arnPrefix/DefenderForCloud-Ciem" -CiemOidcAzureActiveDirectoryAppName "mciem-aws-oidc-connector" -CiemOidcCloudRoleArn "$arnPrefix/DefenderForCloud-OidcCiem" ` + -MdcContainerImageAssessmentEnabled $true -MdcContainerImageAssessmentCloudRoleArn "$arnPrefix/MDCContainersImageAssessmentRole" ` + -MdcContainerAgentlessDiscoveryK8SEnabled $true -MdcContainerAgentlessDiscoveryK8SCloudRoleArn "$arnPrefix/MDCContainersAgentlessDiscoveryK8sRole" +``` + +```output +CiemDiscoveryCloudRoleArn : arn:aws:iam::123456789012:role/DefenderForCloud-Ciem +CiemOidcAzureActiveDirectoryAppName : mciem-aws-oidc-connector +CiemOidcCloudRoleArn : arn:aws:iam::123456789012:role/DefenderForCloud-OidcCiem +ConfigurationCloudRoleArn : arn:aws:iam::123456789012:role/DefenderForCloud-AgentlessScanner +ConfigurationExclusionTag : { + "key": "value" + } +ConfigurationScanningMode : Default +DataSensitivityDiscoveryCloudRoleArn : arn:aws:iam::123456789012:role/SensitiveDataDiscovery +DataSensitivityDiscoveryEnabled : True +DatabaseDspmCloudRoleArn : arn:aws:iam::123456789012:role/DefenderForCloud-DataSecurityPostureDB +DatabaseDspmEnabled : True +Description : +MdcContainerAgentlessDiscoveryK8SCloudRoleArn : arn:aws:iam::123456789012:role/MDCContainersAgentlessDiscoveryK8sRole +MdcContainerAgentlessDiscoveryK8SEnabled : True +MdcContainerImageAssessmentCloudRoleArn : arn:aws:iam::123456789012:role/MDCContainersImageAssessmentRole +MdcContainerImageAssessmentEnabled : True +OfferingType : DefenderCspmAws +VMScannerEnabled : True +``` + + + +## PARAMETERS + +### -CiemDiscoveryCloudRoleArn +The cloud role ARN in AWS for CIEM discovery. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -CiemOidcAzureActiveDirectoryAppName +the azure active directory app name used of authenticating against AWS. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -CiemOidcCloudRoleArn +The cloud role ARN in AWS for CIEM oidc connection. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ConfigurationCloudRoleArn +The cloud role ARN in AWS for this feature. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ConfigurationExclusionTag +VM tags that indicates that VM should not be scanned. +. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmAwsOfferingVMScannersConfigurationExclusionTags +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ConfigurationScanningMode +The scanning mode for the VM scan. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DatabaseDspmCloudRoleArn +The cloud role ARN in AWS for this feature. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DatabaseDspmEnabled +Is databases DSPM protection enabled. + +```yaml +Type: System.Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DataSensitivityDiscoveryCloudRoleArn +The cloud role ARN in AWS for this feature. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DataSensitivityDiscoveryEnabled +Is Microsoft Defender Data Sensitivity discovery enabled. + +```yaml +Type: System.Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -MdcContainerAgentlessDiscoveryK8SCloudRoleArn +The cloud role ARN in AWS for this feature. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -MdcContainerAgentlessDiscoveryK8SEnabled +Is Microsoft Defender container agentless discovery K8s enabled. + +```yaml +Type: System.Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -MdcContainerImageAssessmentCloudRoleArn +The cloud role ARN in AWS for this feature. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -MdcContainerImageAssessmentEnabled +Is Microsoft Defender container image assessment enabled. + +```yaml +Type: System.Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -VMScannerEnabled +Is Microsoft Defender for Server VM scanning enabled. + +```yaml +Type: System.Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOffering + +## NOTES + +## RELATED LINKS + diff --git a/src/Security/Security.Autorest/help/New-AzSecurityDefenderCspmGcpOfferingObject.md b/src/Security/Security.Autorest/help/New-AzSecurityDefenderCspmGcpOfferingObject.md new file mode 100644 index 000000000000..064fdbedc623 --- /dev/null +++ b/src/Security/Security.Autorest/help/New-AzSecurityDefenderCspmGcpOfferingObject.md @@ -0,0 +1,311 @@ +--- +external help file: +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritydefendercspmgcpofferingobject +schema: 2.0.0 +--- + +# New-AzSecurityDefenderCspmGcpOfferingObject + +## SYNOPSIS +Create an in-memory object for DefenderCspmGcpOffering. + +## SYNTAX + +``` +New-AzSecurityDefenderCspmGcpOfferingObject [-CiemDiscoveryAzureActiveDirectoryAppName ] + [-CiemDiscoveryServiceAccountEmailAddress ] [-CiemDiscoveryWorkloadIdentityProviderId ] + [-ConfigurationExclusionTag ] + [-ConfigurationScanningMode ] [-DataSensitivityDiscoveryEnabled ] + [-DataSensitivityDiscoveryServiceAccountEmailAddress ] + [-DataSensitivityDiscoveryWorkloadIdentityProviderId ] + [-MdcContainerAgentlessDiscoveryK8SEnabled ] + [-MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress ] + [-MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId ] + [-MdcContainerImageAssessmentEnabled ] + [-MdcContainerImageAssessmentServiceAccountEmailAddress ] + [-MdcContainerImageAssessmentWorkloadIdentityProviderId ] [-VMScannerEnabled ] + [] +``` + +## DESCRIPTION +Create an in-memory object for DefenderCspmGcpOffering. + +## EXAMPLES + +### Example 1: Create new DefenderCspmGcpOffering object +```powershell +$emailSuffix = "myproject.iam.gserviceaccount.com" +New-AzSecurityDefenderCspmGcpOfferingObject ` + -VMScannerEnabled $true -ConfigurationScanningMode Default -ConfigurationExclusionTag @{key="value"} ` + -MdcContainerAgentlessDiscoveryK8SEnabled $true -MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress "mdc-containers-k8s-operator@$emailSuffix" -MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId "containers" ` + -MdcContainerImageAssessmentEnabled $true -MdcContainerImageAssessmentServiceAccountEmailAddress "mdc-containers-artifact-assess@$emailSuffix" -MdcContainerImageAssessmentWorkloadIdentityProviderId "containers" ` + -DataSensitivityDiscoveryEnabled $true -DataSensitivityDiscoveryServiceAccountEmailAddress "mdc-data-sec-posture-storage@$emailSuffix" -DataSensitivityDiscoveryWorkloadIdentityProviderId "data-security-posture-storage" ` + -CiemDiscoveryServiceAccountEmailAddress "microsoft-defender-ciem@$emailSuffix" -CiemDiscoveryAzureActiveDirectoryAppName "mciem-gcp-oidc-app" -CiemDiscoveryWorkloadIdentityProviderId "ciem-discovery" +``` + +```output +CiemDiscoveryAzureActiveDirectoryAppName : mciem-gcp-oidc-app +CiemDiscoveryServiceAccountEmailAddress : microsoft-defender-ciem@myproject.iam.gserviceaccount.com +CiemDiscoveryWorkloadIdentityProviderId : ciem-discovery +ConfigurationExclusionTag : { + "key": "value" + } +ConfigurationScanningMode : Default +DataSensitivityDiscoveryEnabled : True +DataSensitivityDiscoveryServiceAccountEmailAddress : mdc-data-sec-posture-storage@myproject.iam.gserviceaccount.com +DataSensitivityDiscoveryWorkloadIdentityProviderId : data-security-posture-storage +Description : +MdcContainerAgentlessDiscoveryK8SEnabled : True +MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress : mdc-containers-k8s-operator@myproject.iam.gserviceaccount.com +MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId : containers +MdcContainerImageAssessmentEnabled : True +MdcContainerImageAssessmentServiceAccountEmailAddress : mdc-containers-artifact-assess@myproject.iam.gserviceaccount.com +MdcContainerImageAssessmentWorkloadIdentityProviderId : containers +OfferingType : DefenderCspmGcp +VMScannerEnabled : True +``` + + + +## PARAMETERS + +### -CiemDiscoveryAzureActiveDirectoryAppName +the azure active directory app name used of authenticating against GCP workload identity federation. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -CiemDiscoveryServiceAccountEmailAddress +The service account email address in GCP for CIEM discovery offering. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -CiemDiscoveryWorkloadIdentityProviderId +The GCP workload identity provider id for CIEM discovery offering. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ConfigurationExclusionTag +VM tags that indicates that VM should not be scanned. +. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderCspmGcpOfferingVMScannersConfigurationExclusionTags +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ConfigurationScanningMode +The scanning mode for the VM scan. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DataSensitivityDiscoveryEnabled +Is Microsoft Defender Data Sensitivity discovery enabled. + +```yaml +Type: System.Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DataSensitivityDiscoveryServiceAccountEmailAddress +The service account email address in GCP for this feature. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DataSensitivityDiscoveryWorkloadIdentityProviderId +The workload identity provider id in GCP for this feature. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -MdcContainerAgentlessDiscoveryK8SEnabled +Is Microsoft Defender container agentless discovery enabled. + +```yaml +Type: System.Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress +The service account email address in GCP for this feature. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId +The workload identity provider id in GCP for this feature. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -MdcContainerImageAssessmentEnabled +Is Microsoft Defender container image assessment enabled. + +```yaml +Type: System.Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -MdcContainerImageAssessmentServiceAccountEmailAddress +The service account email address in GCP for this feature. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -MdcContainerImageAssessmentWorkloadIdentityProviderId +The workload identity provider id in GCP for this feature. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -VMScannerEnabled +Is Microsoft Defender for Server VM scanning enabled. + +```yaml +Type: System.Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmGcpOffering + +## NOTES + +## RELATED LINKS + diff --git a/src/Security/Security.Autorest/help/New-AzSecurityDefenderForContainersAwsOfferingObject.md b/src/Security/Security.Autorest/help/New-AzSecurityDefenderForContainersAwsOfferingObject.md new file mode 100644 index 000000000000..62f449d96e53 --- /dev/null +++ b/src/Security/Security.Autorest/help/New-AzSecurityDefenderForContainersAwsOfferingObject.md @@ -0,0 +1,288 @@ +--- +external help file: +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritydefenderforcontainersawsofferingobject +schema: 2.0.0 +--- + +# New-AzSecurityDefenderForContainersAwsOfferingObject + +## SYNOPSIS +Create an in-memory object for DefenderForContainersAwsOffering. + +## SYNTAX + +``` +New-AzSecurityDefenderForContainersAwsOfferingObject [-AutoProvisioning ] + [-CloudWatchToKinesiCloudRoleArn ] [-ContainerVulnerabilityAssessmentCloudRoleArn ] + [-ContainerVulnerabilityAssessmentTaskCloudRoleArn ] + [-EnableContainerVulnerabilityAssessment ] [-KinesiToS3CloudRoleArn ] + [-KubeAuditRetentionTime ] [-KuberneteScubaReaderCloudRoleArn ] + [-KuberneteServiceCloudRoleArn ] [-MdcContainerAgentlessDiscoveryK8SCloudRoleArn ] + [-MdcContainerAgentlessDiscoveryK8SEnabled ] [-MdcContainerImageAssessmentCloudRoleArn ] + [-MdcContainerImageAssessmentEnabled ] [-ScubaExternalId ] [] +``` + +## DESCRIPTION +Create an in-memory object for DefenderForContainersAwsOffering. + +## EXAMPLES + +### Example 1: Create new DefenderForContainersAwsOffering object +```powershell +$arnPrefix = "arn:aws:iam::123456789012:role" +New-AzSecurityDefenderForContainersAwsOfferingObject ` + -AutoProvisioning $true -KuberneteServiceCloudRoleArn "$arnPrefix/DefenderForCloud-Containers-K8s" -KuberneteScubaReaderCloudRoleArn "$arnPrefix/DefenderForCloud-DataCollection" ` + -KinesiToS3CloudRoleArn "$arnPrefix/DefenderForCloud-Containers-K8s-kinesis-to-s3" -CloudWatchToKinesiCloudRoleArn "$arnPrefix/DefenderForCloud-Containers-K8s-cloudwatch-to-kinesis" ` + -KubeAuditRetentionTime 30 -ScubaExternalId "a47ae0a2-7bf7-482a-897a-7a139d30736c" ` + -MdcContainerAgentlessDiscoveryK8SEnabled $true -MdcContainerAgentlessDiscoveryK8SCloudRoleArn "$arnPrefix/MDCContainersAgentlessDiscoveryK8sRole" ` + -MdcContainerImageAssessmentEnabled $true -MdcContainerImageAssessmentCloudRoleArn "$arnPrefix/MDCContainersImageAssessmentRole" ` + -EnableContainerVulnerabilityAssessment $false +``` + +```output +AutoProvisioning : True +CloudWatchToKinesiCloudRoleArn : arn:aws:iam::123456789012:role/DefenderForCloud-Containers-K8s-cloudwatch-to-kinesis +ContainerVulnerabilityAssessmentCloudRoleArn : +ContainerVulnerabilityAssessmentTaskCloudRoleArn : +Description : +EnableContainerVulnerabilityAssessment : False +KinesiToS3CloudRoleArn : arn:aws:iam::123456789012:role/DefenderForCloud-Containers-K8s-kinesis-to-s3 +KubeAuditRetentionTime : 30 +KuberneteScubaReaderCloudRoleArn : arn:aws:iam::123456789012:role/DefenderForCloud-DataCollection +KuberneteServiceCloudRoleArn : arn:aws:iam::123456789012:role/DefenderForCloud-Containers-K8s +MdcContainerAgentlessDiscoveryK8SCloudRoleArn : arn:aws:iam::123456789012:role/MDCContainersAgentlessDiscoveryK8sRole +MdcContainerAgentlessDiscoveryK8SEnabled : True +MdcContainerImageAssessmentCloudRoleArn : arn:aws:iam::123456789012:role/MDCContainersImageAssessmentRole +MdcContainerImageAssessmentEnabled : True +OfferingType : DefenderForContainersAws +ScubaExternalId : a47ae0a2-7bf7-482a-897a-7a139d30736c +``` + + + +## PARAMETERS + +### -AutoProvisioning +Is audit logs pipeline auto provisioning enabled. + +```yaml +Type: System.Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -CloudWatchToKinesiCloudRoleArn +The cloud role ARN in AWS used by CloudWatch to transfer data into Kinesis. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ContainerVulnerabilityAssessmentCloudRoleArn +The cloud role ARN in AWS for this feature. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ContainerVulnerabilityAssessmentTaskCloudRoleArn +The cloud role ARN in AWS for this feature. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -EnableContainerVulnerabilityAssessment +Enable container vulnerability assessment feature. + +```yaml +Type: System.Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -KinesiToS3CloudRoleArn +The cloud role ARN in AWS used by Kinesis to transfer data into S3. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -KubeAuditRetentionTime +The retention time in days of kube audit logs set on the CloudWatch log group. + +```yaml +Type: System.Int64 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -KuberneteScubaReaderCloudRoleArn +The cloud role ARN in AWS for this feature used for reading data. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -KuberneteServiceCloudRoleArn +The cloud role ARN in AWS for this feature used for provisioning resources. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -MdcContainerAgentlessDiscoveryK8SCloudRoleArn +The cloud role ARN in AWS for this feature. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -MdcContainerAgentlessDiscoveryK8SEnabled +Is Microsoft Defender container agentless discovery K8s enabled. + +```yaml +Type: System.Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -MdcContainerImageAssessmentCloudRoleArn +The cloud role ARN in AWS for this feature. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -MdcContainerImageAssessmentEnabled +Is Microsoft Defender container image assessment enabled. + +```yaml +Type: System.Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ScubaExternalId +The externalId used by the data reader to prevent the confused deputy attack. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersAwsOffering + +## NOTES + +## RELATED LINKS + diff --git a/src/Security/Security.Autorest/help/New-AzSecurityDefenderForContainersGcpOfferingObject.md b/src/Security/Security.Autorest/help/New-AzSecurityDefenderForContainersGcpOfferingObject.md new file mode 100644 index 000000000000..fe242dc06889 --- /dev/null +++ b/src/Security/Security.Autorest/help/New-AzSecurityDefenderForContainersGcpOfferingObject.md @@ -0,0 +1,275 @@ +--- +external help file: +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritydefenderforcontainersgcpofferingobject +schema: 2.0.0 +--- + +# New-AzSecurityDefenderForContainersGcpOfferingObject + +## SYNOPSIS +Create an in-memory object for DefenderForContainersGcpOffering. + +## SYNTAX + +``` +New-AzSecurityDefenderForContainersGcpOfferingObject [-AuditLogsAutoProvisioningFlag ] + [-DataPipelineNativeCloudConnectionServiceAccountEmailAddress ] + [-DataPipelineNativeCloudConnectionWorkloadIdentityProviderId ] + [-DefenderAgentAutoProvisioningFlag ] [-MdcContainerAgentlessDiscoveryK8SEnabled ] + [-MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress ] + [-MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId ] + [-MdcContainerImageAssessmentEnabled ] + [-MdcContainerImageAssessmentServiceAccountEmailAddress ] + [-MdcContainerImageAssessmentWorkloadIdentityProviderId ] + [-NativeCloudConnectionServiceAccountEmailAddress ] + [-NativeCloudConnectionWorkloadIdentityProviderId ] [-PolicyAgentAutoProvisioningFlag ] + [] +``` + +## DESCRIPTION +Create an in-memory object for DefenderForContainersGcpOffering. + +## EXAMPLES + +### Example 1: Create new DefenderForContainersGcpOffering object +```powershell +$emailSuffix = "myproject.iam.gserviceaccount.com" +New-AzSecurityDefenderForContainersGcpOfferingObject ` + -NativeCloudConnectionServiceAccountEmailAddress "microsoft-defender-containers@$emailSuffix" -NativeCloudConnectionWorkloadIdentityProviderId "containers" ` + -DataPipelineNativeCloudConnectionServiceAccountEmailAddress "ms-defender-containers-stream@$emailSuffix" -DataPipelineNativeCloudConnectionWorkloadIdentityProviderId "containers-streams" ` + -AuditLogsAutoProvisioningFlag $true -DefenderAgentAutoProvisioningFlag $true -PolicyAgentAutoProvisioningFlag $true ` + -MdcContainerAgentlessDiscoveryK8SEnabled $true -MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId "containers" -MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress "mdc-containers-k8s-operator@$emailSuffix" ` + -MdcContainerImageAssessmentEnabled $true -MdcContainerImageAssessmentWorkloadIdentityProviderId "containers" -MdcContainerImageAssessmentServiceAccountEmailAddress "mdc-containers-artifact-assess@$emailSuffix" +``` + +```output +AuditLogsAutoProvisioningFlag : True +DataPipelineNativeCloudConnectionServiceAccountEmailAddress : ms-defender-containers-stream@myproject.iam.gserviceaccount.com +DataPipelineNativeCloudConnectionWorkloadIdentityProviderId : containers-streams +DefenderAgentAutoProvisioningFlag : True +Description : +MdcContainerAgentlessDiscoveryK8SEnabled : True +MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress : mdc-containers-k8s-operator@myproject.iam.gserviceaccount.com +MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId : containers +MdcContainerImageAssessmentEnabled : True +MdcContainerImageAssessmentServiceAccountEmailAddress : mdc-containers-artifact-assess@myproject.iam.gserviceaccount.com +MdcContainerImageAssessmentWorkloadIdentityProviderId : containers +NativeCloudConnectionServiceAccountEmailAddress : microsoft-defender-containers@myproject.iam.gserviceaccount.com +NativeCloudConnectionWorkloadIdentityProviderId : containers +OfferingType : DefenderForContainersGcp +PolicyAgentAutoProvisioningFlag : True +``` + + + +## PARAMETERS + +### -AuditLogsAutoProvisioningFlag +Is audit logs data collection enabled. + +```yaml +Type: System.Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DataPipelineNativeCloudConnectionServiceAccountEmailAddress +The data collection service account email address in GCP for this offering. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DataPipelineNativeCloudConnectionWorkloadIdentityProviderId +The data collection GCP workload identity provider id for this offering. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefenderAgentAutoProvisioningFlag +Is Microsoft Defender for Cloud Kubernetes agent auto provisioning enabled. + +```yaml +Type: System.Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -MdcContainerAgentlessDiscoveryK8SEnabled +Is Microsoft Defender container agentless discovery enabled. + +```yaml +Type: System.Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress +The service account email address in GCP for this feature. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId +The workload identity provider id in GCP for this feature. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -MdcContainerImageAssessmentEnabled +Is Microsoft Defender container image assessment enabled. + +```yaml +Type: System.Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -MdcContainerImageAssessmentServiceAccountEmailAddress +The service account email address in GCP for this feature. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -MdcContainerImageAssessmentWorkloadIdentityProviderId +The workload identity provider id in GCP for this feature. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NativeCloudConnectionServiceAccountEmailAddress +The service account email address in GCP for this offering. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NativeCloudConnectionWorkloadIdentityProviderId +The GCP workload identity provider id for this offering. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PolicyAgentAutoProvisioningFlag +Is Policy Kubernetes agent auto provisioning enabled. + +```yaml +Type: System.Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersGcpOffering + +## NOTES + +## RELATED LINKS + diff --git a/src/Security/Security.Autorest/help/New-AzSecurityDefenderForDatabasesAwsOfferingObject.md b/src/Security/Security.Autorest/help/New-AzSecurityDefenderForDatabasesAwsOfferingObject.md new file mode 100644 index 000000000000..eaf3f50057b1 --- /dev/null +++ b/src/Security/Security.Autorest/help/New-AzSecurityDefenderForDatabasesAwsOfferingObject.md @@ -0,0 +1,185 @@ +--- +external help file: +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritydefenderfordatabasesawsofferingobject +schema: 2.0.0 +--- + +# New-AzSecurityDefenderForDatabasesAwsOfferingObject + +## SYNOPSIS +Create an in-memory object for DefenderForDatabasesAwsOffering. + +## SYNTAX + +``` +New-AzSecurityDefenderForDatabasesAwsOfferingObject [-ArcAutoProvisioningCloudRoleArn ] + [-ArcAutoProvisioningEnabled ] [-ConfigurationPrivateLinkScope ] + [-ConfigurationProxy ] [-DatabaseDspmCloudRoleArn ] [-DatabaseDspmEnabled ] + [-RdCloudRoleArn ] [-RdEnabled ] [] +``` + +## DESCRIPTION +Create an in-memory object for DefenderForDatabasesAwsOffering. + +## EXAMPLES + +### Example 1: Create new DefenderForDatabasesAwsOffering object +```powershell +$arnPrefix = "arn:aws:iam::123456789012:role" +New-AzSecurityDefenderForDatabasesAwsOfferingObject ` + -ArcAutoProvisioningEnabled $true -ArcAutoProvisioningCloudRoleArn "$arnPrefix/DefenderForCloud-ArcAutoProvisioning" ` + -DatabaseDspmEnabled $true -DatabaseDspmCloudRoleArn "$arnPrefix/DefenderForCloud-DataSecurityPostureDB" + +``` + +```output +ArcAutoProvisioningCloudRoleArn : arn:aws:iam::123456789012:role/DefenderForCloud-ArcAutoProvisioning +ArcAutoProvisioningEnabled : True +ConfigurationPrivateLinkScope : +ConfigurationProxy : +DatabaseDspmCloudRoleArn : arn:aws:iam::123456789012:role/DefenderForCloud-DataSecurityPostureDB +DatabaseDspmEnabled : True +Description : +OfferingType : DefenderForDatabasesAws +RdCloudRoleArn : +RdEnabled : +``` + + + +## PARAMETERS + +### -ArcAutoProvisioningCloudRoleArn +The cloud role ARN in AWS for this feature. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ArcAutoProvisioningEnabled +Is arc auto provisioning enabled. + +```yaml +Type: System.Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ConfigurationPrivateLinkScope +Optional Arc private link scope resource id to link the Arc agent. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ConfigurationProxy +Optional http proxy endpoint to use for the Arc agent. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DatabaseDspmCloudRoleArn +The cloud role ARN in AWS for this feature. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DatabaseDspmEnabled +Is databases data security posture management (DSPM) protection enabled. + +```yaml +Type: System.Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -RdCloudRoleArn +The cloud role ARN in AWS for this feature. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -RdEnabled +Is RDS protection enabled. + +```yaml +Type: System.Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForDatabasesAwsOffering + +## NOTES + +## RELATED LINKS + diff --git a/src/Security/Security.Autorest/help/New-AzSecurityDefenderForDatabasesGcpOfferingObject.md b/src/Security/Security.Autorest/help/New-AzSecurityDefenderForDatabasesGcpOfferingObject.md new file mode 100644 index 000000000000..cbea2d8d29f6 --- /dev/null +++ b/src/Security/Security.Autorest/help/New-AzSecurityDefenderForDatabasesGcpOfferingObject.md @@ -0,0 +1,137 @@ +--- +external help file: +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritydefenderfordatabasesgcpofferingobject +schema: 2.0.0 +--- + +# New-AzSecurityDefenderForDatabasesGcpOfferingObject + +## SYNOPSIS +Create an in-memory object for DefenderForDatabasesGcpOffering. + +## SYNTAX + +``` +New-AzSecurityDefenderForDatabasesGcpOfferingObject [-ArcAutoProvisioningEnabled ] + [-ConfigurationPrivateLinkScope ] [-ConfigurationProxy ] + [-DefenderForDatabaseArcAutoProvisioningServiceAccountEmailAddress ] + [-DefenderForDatabaseArcAutoProvisioningWorkloadIdentityProviderId ] [] +``` + +## DESCRIPTION +Create an in-memory object for DefenderForDatabasesGcpOffering. + +## EXAMPLES + +### Example 1: Create new DefenderForDatabasesGcpOffering object +```powershell +$emailSuffix = "myproject.iam.gserviceaccount.com" +New-AzSecurityDefenderForDatabasesGcpOfferingObject ` + -ArcAutoProvisioningEnabled $true ` + -DefenderForDatabaseArcAutoProvisioningServiceAccountEmailAddress "microsoft-databases-arc-ap@" -DefenderForDatabaseArcAutoProvisioningWorkloadIdentityProviderId "defender-for-databases-arc-ap" + +``` + +```output +ArcAutoProvisioningEnabled : True +ConfigurationPrivateLinkScope : +ConfigurationProxy : +DefenderForDatabaseArcAutoProvisioningServiceAccountEmailAddress : microsoft-databases-arc-ap@ +DefenderForDatabaseArcAutoProvisioningWorkloadIdentityProviderId : defender-for-databases-arc-ap +Description : +OfferingType : DefenderForDatabasesGcp +``` + + + +## PARAMETERS + +### -ArcAutoProvisioningEnabled +Is arc auto provisioning enabled. + +```yaml +Type: System.Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ConfigurationPrivateLinkScope +Optional Arc private link scope resource id to link the Arc agent. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ConfigurationProxy +Optional http proxy endpoint to use for the Arc agent. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefenderForDatabaseArcAutoProvisioningServiceAccountEmailAddress +The service account email address in GCP for this offering. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefenderForDatabaseArcAutoProvisioningWorkloadIdentityProviderId +The GCP workload identity provider id for this offering. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForDatabasesGcpOffering + +## NOTES + +## RELATED LINKS + diff --git a/src/Security/Security.Autorest/help/New-AzSecurityDefenderForServersAwsOfferingObject.md b/src/Security/Security.Autorest/help/New-AzSecurityDefenderForServersAwsOfferingObject.md new file mode 100644 index 000000000000..8de0507ff435 --- /dev/null +++ b/src/Security/Security.Autorest/help/New-AzSecurityDefenderForServersAwsOfferingObject.md @@ -0,0 +1,291 @@ +--- +external help file: +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritydefenderforserversawsofferingobject +schema: 2.0.0 +--- + +# New-AzSecurityDefenderForServersAwsOfferingObject + +## SYNOPSIS +Create an in-memory object for DefenderForServersAwsOffering. + +## SYNTAX + +``` +New-AzSecurityDefenderForServersAwsOfferingObject [-ArcAutoProvisioningCloudRoleArn ] + [-ArcAutoProvisioningEnabled ] [-ConfigurationCloudRoleArn ] + [-ConfigurationExclusionTag ] + [-ConfigurationPrivateLinkScope ] [-ConfigurationProxy ] + [-ConfigurationScanningMode ] [-ConfigurationType ] [-DefenderForServerCloudRoleArn ] + [-MdeAutoProvisioningConfiguration ] [-MdeAutoProvisioningEnabled ] [-SubPlanType ] + [-VaAutoProvisioningEnabled ] [-VMScannerEnabled ] [] +``` + +## DESCRIPTION +Create an in-memory object for DefenderForServersAwsOffering. + +## EXAMPLES + +### Example 1: Create new DefenderForServersAwsOffering object +```powershell +$arnPrefix = "arn:aws:iam::123456789012:role" +New-AzSecurityDefenderForServersAwsOfferingObject ` + -DefenderForServerCloudRoleArn "$arnPrefix/DefenderForCloud-DefenderForServers" ` + -ArcAutoProvisioningEnabled $true -ArcAutoProvisioningCloudRoleArn "$arnPrefix/DefenderForCloud-ArcAutoProvisioning" ` + -MdeAutoProvisioningEnabled $true ` + -VaAutoProvisioningEnabled $true -ConfigurationType TVM ` + -VMScannerEnabled $true -ConfigurationCloudRoleArn "$arnPrefix/DefenderForCloud-AgentlessScanner" -ConfigurationScanningMode Default ` + -SubPlanType P2 +``` + +```output +ArcAutoProvisioningCloudRoleArn : arn:aws:iam::123456789012:role/DefenderForCloud-ArcAutoProvisioning +ArcAutoProvisioningEnabled : True +ConfigurationCloudRoleArn : arn:aws:iam::123456789012:role/DefenderForCloud-AgentlessScanner +ConfigurationExclusionTag : { + } +ConfigurationPrivateLinkScope : +ConfigurationProxy : +ConfigurationScanningMode : Default +ConfigurationType : TVM +DefenderForServerCloudRoleArn : arn:aws:iam::123456789012:role/DefenderForCloud-DefenderForServers +Description : +MdeAutoProvisioningConfiguration : { + } +MdeAutoProvisioningEnabled : True +OfferingType : DefenderForServersAws +SubPlanType : P2 +VMScannerEnabled : True +VaAutoProvisioningEnabled : True +``` + + + +## PARAMETERS + +### -ArcAutoProvisioningCloudRoleArn +The cloud role ARN in AWS for this feature. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ArcAutoProvisioningEnabled +Is arc auto provisioning enabled. + +```yaml +Type: System.Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ConfigurationCloudRoleArn +The cloud role ARN in AWS for this feature. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ConfigurationExclusionTag +VM tags that indicates that VM should not be scanned. +. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersAwsOfferingVMScannersConfigurationExclusionTags +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ConfigurationPrivateLinkScope +Optional Arc private link scope resource id to link the Arc agent. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ConfigurationProxy +Optional HTTP proxy endpoint to use for the Arc agent. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ConfigurationScanningMode +The scanning mode for the VM scan. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ConfigurationType +The Vulnerability Assessment solution to be provisioned. +Can be either 'TVM' or 'Qualys'. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefenderForServerCloudRoleArn +The cloud role ARN in AWS for this feature. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -MdeAutoProvisioningConfiguration +configuration for Microsoft Defender for Endpoint autoprovisioning. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAny +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -MdeAutoProvisioningEnabled +Is Microsoft Defender for Endpoint auto provisioning enabled. + +```yaml +Type: System.Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubPlanType +The available sub plans. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -VaAutoProvisioningEnabled +Is Vulnerability Assessment auto provisioning enabled. + +```yaml +Type: System.Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -VMScannerEnabled +Is Microsoft Defender for Server VM scanning enabled. + +```yaml +Type: System.Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOffering + +## NOTES + +## RELATED LINKS + diff --git a/src/Security/Security.Autorest/help/New-AzSecurityDefenderForServersGcpOfferingObject.md b/src/Security/Security.Autorest/help/New-AzSecurityDefenderForServersGcpOfferingObject.md new file mode 100644 index 000000000000..f495201c9523 --- /dev/null +++ b/src/Security/Security.Autorest/help/New-AzSecurityDefenderForServersGcpOfferingObject.md @@ -0,0 +1,274 @@ +--- +external help file: +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritydefenderforserversgcpofferingobject +schema: 2.0.0 +--- + +# New-AzSecurityDefenderForServersGcpOfferingObject + +## SYNOPSIS +Create an in-memory object for DefenderForServersGcpOffering. + +## SYNTAX + +``` +New-AzSecurityDefenderForServersGcpOfferingObject [-ArcAutoProvisioningEnabled ] + [-ConfigurationExclusionTag ] + [-ConfigurationPrivateLinkScope ] [-ConfigurationProxy ] + [-ConfigurationScanningMode ] [-ConfigurationType ] + [-DefenderForServerServiceAccountEmailAddress ] + [-DefenderForServerWorkloadIdentityProviderId ] [-MdeAutoProvisioningConfiguration ] + [-MdeAutoProvisioningEnabled ] [-SubPlanType ] [-VaAutoProvisioningEnabled ] + [-VMScannerEnabled ] [] +``` + +## DESCRIPTION +Create an in-memory object for DefenderForServersGcpOffering. + +## EXAMPLES + +### Example 1: Create new DefenderForServersGcpOffering object +```powershell +$emailSuffix = "myproject.iam.gserviceaccount.com" +New-AzSecurityDefenderForServersGcpOfferingObject ` + -DefenderForServerServiceAccountEmailAddress "microsoft-defender-for-servers@$emailSuffix" -DefenderForServerWorkloadIdentityProviderId "defender-for-servers" ` + -ArcAutoProvisioningEnabled $true -MdeAutoProvisioningEnabled $true -VaAutoProvisioningEnabled $true -ConfigurationType TVM ` + -VMScannerEnabled $true -ConfigurationScanningMode Default ` + -SubPlanType P2 +``` + +```output +ArcAutoProvisioningEnabled : True +ConfigurationExclusionTag : { + } +ConfigurationPrivateLinkScope : +ConfigurationProxy : +ConfigurationScanningMode : Default +ConfigurationType : TVM +DefenderForServerServiceAccountEmailAddress : microsoft-defender-for-servers@myproject.iam.gserviceaccount.com +DefenderForServerWorkloadIdentityProviderId : defender-for-servers +Description : +MdeAutoProvisioningConfiguration : { + } +MdeAutoProvisioningEnabled : True +OfferingType : DefenderForServersGcp +SubPlanType : P2 +VMScannerEnabled : True +VaAutoProvisioningEnabled : True +``` + + + +## PARAMETERS + +### -ArcAutoProvisioningEnabled +Is arc auto provisioning enabled. + +```yaml +Type: System.Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ConfigurationExclusionTag +VM tags that indicate that VM should not be scanned. +. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDefenderForServersGcpOfferingVMScannersConfigurationExclusionTags +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ConfigurationPrivateLinkScope +Optional Arc private link scope resource id to link the Arc agent. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ConfigurationProxy +Optional HTTP proxy endpoint to use for the Arc agent. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ConfigurationScanningMode +The scanning mode for the VM scan. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ConfigurationType +The Vulnerability Assessment solution to be provisioned. +Can be either 'TVM' or 'Qualys'. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefenderForServerServiceAccountEmailAddress +The service account email address in GCP for this feature. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefenderForServerWorkloadIdentityProviderId +The workload identity provider id in GCP for this feature. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -MdeAutoProvisioningConfiguration +configuration for Microsoft Defender for Endpoint autoprovisioning. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAny +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -MdeAutoProvisioningEnabled +Is Microsoft Defender for Endpoint auto provisioning enabled. + +```yaml +Type: System.Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubPlanType +The available sub plans. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -VaAutoProvisioningEnabled +Is Vulnerability Assessment auto provisioning enabled. + +```yaml +Type: System.Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -VMScannerEnabled +Is Microsoft Defender for Server VM scanning enabled. + +```yaml +Type: System.Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOffering + +## NOTES + +## RELATED LINKS + diff --git a/src/Security/Security.Autorest/help/New-AzSecurityGcpOrganizationalDataMemberObject.md b/src/Security/Security.Autorest/help/New-AzSecurityGcpOrganizationalDataMemberObject.md new file mode 100644 index 000000000000..b23234432a89 --- /dev/null +++ b/src/Security/Security.Autorest/help/New-AzSecurityGcpOrganizationalDataMemberObject.md @@ -0,0 +1,82 @@ +--- +external help file: +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritygcporganizationaldatamemberobject +schema: 2.0.0 +--- + +# New-AzSecurityGcpOrganizationalDataMemberObject + +## SYNOPSIS +Create an in-memory object for GcpOrganizationalDataMember. + +## SYNTAX + +``` +New-AzSecurityGcpOrganizationalDataMemberObject [-ManagementProjectNumber ] + [-ParentHierarchyId ] [] +``` + +## DESCRIPTION +Create an in-memory object for GcpOrganizationalDataMember. + +## EXAMPLES + +### Example 1: Create new GcpOrganizationalDataMember object +```powershell +New-AzSecurityGcpOrganizationalDataMemberObject -ManagementProjectNumber "12345" -ParentHierarchyId "00000" +``` + +```output +ManagementProjectNumber OrganizationMembershipType ParentHierarchyId +----------------------- -------------------------- ----------------- +12345 Member 00000 +``` + + + +## PARAMETERS + +### -ManagementProjectNumber +The GCP management project number from organizational onboarding. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ParentHierarchyId +If the multi cloud account is not of membership type organization, this will be the ID of the project's parent. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GcpOrganizationalDataMember + +## NOTES + +## RELATED LINKS + diff --git a/src/Security/Security.Autorest/help/New-AzSecurityGcpOrganizationalDataOrganizationObject.md b/src/Security/Security.Autorest/help/New-AzSecurityGcpOrganizationalDataOrganizationObject.md new file mode 100644 index 000000000000..28ff618bad4a --- /dev/null +++ b/src/Security/Security.Autorest/help/New-AzSecurityGcpOrganizationalDataOrganizationObject.md @@ -0,0 +1,99 @@ +--- +external help file: +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritygcporganizationaldataorganizationobject +schema: 2.0.0 +--- + +# New-AzSecurityGcpOrganizationalDataOrganizationObject + +## SYNOPSIS +Create an in-memory object for GcpOrganizationalDataOrganization. + +## SYNTAX + +``` +New-AzSecurityGcpOrganizationalDataOrganizationObject [-ExcludedProjectNumber ] + [-ServiceAccountEmailAddress ] [-WorkloadIdentityProviderId ] [] +``` + +## DESCRIPTION +Create an in-memory object for GcpOrganizationalDataOrganization. + +## EXAMPLES + +### Example 1: Create new GcpOrganizationalDataOrganization object +```powershell +New-AzSecurityGcpOrganizationalDataOrganizationObject -WorkloadIdentityProviderId "provider" -ServiceAccountEmailAddress "my@email.com" -ExcludedProjectNumber @(1,2) +``` + +```output +ExcludedProjectNumber : {1, 2} +OrganizationMembershipType : Organization +OrganizationName : +ServiceAccountEmailAddress : my@email.com +WorkloadIdentityProviderId : provider +``` + + + +## PARAMETERS + +### -ExcludedProjectNumber +If the multi cloud account is of membership type organization, list of accounts excluded from offering. + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ServiceAccountEmailAddress +The service account email address which represents the organization level permissions container. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WorkloadIdentityProviderId +The GCP workload identity provider id which represents the permissions required to auto provision security connectors. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GcpOrganizationalDataOrganization + +## NOTES + +## RELATED LINKS + diff --git a/src/Security/Security.Autorest/help/New-AzSecurityGcpProjectEnvironmentObject.md b/src/Security/Security.Autorest/help/New-AzSecurityGcpProjectEnvironmentObject.md new file mode 100644 index 000000000000..69a0a97e2744 --- /dev/null +++ b/src/Security/Security.Autorest/help/New-AzSecurityGcpProjectEnvironmentObject.md @@ -0,0 +1,124 @@ +--- +external help file: +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritygcpprojectenvironmentobject +schema: 2.0.0 +--- + +# New-AzSecurityGcpProjectEnvironmentObject + +## SYNOPSIS +Create an in-memory object for GcpProjectEnvironment. + +## SYNTAX + +``` +New-AzSecurityGcpProjectEnvironmentObject [-OrganizationalData ] + [-ProjectDetailProjectId ] [-ProjectDetailProjectNumber ] [-ScanInterval ] + [] +``` + +## DESCRIPTION +Create an in-memory object for GcpProjectEnvironment. + +## EXAMPLES + +### Example 1: Create new GcpOrganizationalDataOrganization object +```powershell +$orgData = New-AzSecurityGcpOrganizationalDataOrganizationObject -WorkloadIdentityProviderId "provider" -ServiceAccountEmailAddress "my@email.com" -ExcludedProjectNumber @(1,2) +New-AzSecurityGcpProjectEnvironmentObject -ProjectDetailProjectId "asc-sdk-samples" -ScanInterval 24 -OrganizationalData $orgData -ProjectDetailProjectNumber "1234" +``` + +```output +EnvironmentType : GcpProject +OrganizationalData : { + "organizationMembershipType": "Organization", + "excludedProjectNumbers": [ "1", "2" ], + "serviceAccountEmailAddress": "my@email.com", + "workloadIdentityProviderId": "provider" + } +ProjectDetailProjectId : asc-sdk-samples +ProjectDetailProjectName : +ProjectDetailProjectNumber : 1234 +ProjectDetailWorkloadIdentityPoolId : +ScanInterval : 24 +``` + + + +## PARAMETERS + +### -OrganizationalData +The Gcp project's organizational data. +. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGcpOrganizationalData +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProjectDetailProjectId +The GCP Project id. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProjectDetailProjectNumber +The unique GCP Project number. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ScanInterval +Scan interval in hours (value should be between 1-hour to 24-hours). + +```yaml +Type: System.Int64 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GcpProjectEnvironment + +## NOTES + +## RELATED LINKS + diff --git a/src/Security/Security.Autorest/help/New-AzSecurityGitHubScopeEnvironmentObject.md b/src/Security/Security.Autorest/help/New-AzSecurityGitHubScopeEnvironmentObject.md new file mode 100644 index 000000000000..141983d581bf --- /dev/null +++ b/src/Security/Security.Autorest/help/New-AzSecurityGitHubScopeEnvironmentObject.md @@ -0,0 +1,51 @@ +--- +external help file: +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritygithubscopeenvironmentobject +schema: 2.0.0 +--- + +# New-AzSecurityGitHubScopeEnvironmentObject + +## SYNOPSIS +Create an in-memory object for GitHubScopeEnvironment. + +## SYNTAX + +``` +New-AzSecurityGitHubScopeEnvironmentObject [] +``` + +## DESCRIPTION +Create an in-memory object for GitHubScopeEnvironment. + +## EXAMPLES + +### Example 1: Create new GitHubScopeEnvironment object +```powershell +New-AzSecurityGitHubScopeEnvironmentObject +``` + +```output +EnvironmentType +--------------- +GithubScope +``` + + + +## PARAMETERS + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitHubScopeEnvironment + +## NOTES + +## RELATED LINKS + diff --git a/src/Security/Security.Autorest/help/New-AzSecurityGitLabScopeEnvironmentObject.md b/src/Security/Security.Autorest/help/New-AzSecurityGitLabScopeEnvironmentObject.md new file mode 100644 index 000000000000..c623c408609b --- /dev/null +++ b/src/Security/Security.Autorest/help/New-AzSecurityGitLabScopeEnvironmentObject.md @@ -0,0 +1,51 @@ +--- +external help file: +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritygitlabscopeenvironmentobject +schema: 2.0.0 +--- + +# New-AzSecurityGitLabScopeEnvironmentObject + +## SYNOPSIS +Create an in-memory object for GitLabScopeEnvironment. + +## SYNTAX + +``` +New-AzSecurityGitLabScopeEnvironmentObject [] +``` + +## DESCRIPTION +Create an in-memory object for GitLabScopeEnvironment. + +## EXAMPLES + +### Example 1: Create new GitLabScopeEnvironment object +```powershell +New-AzSecurityGitLabScopeEnvironmentObject +``` + +```output +EnvironmentType +--------------- +GitlabScope +``` + + + +## PARAMETERS + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitLabScopeEnvironment + +## NOTES + +## RELATED LINKS + diff --git a/src/Security/Security.Autorest/help/New-AzSecurityInformationProtectionAwsOfferingObject.md b/src/Security/Security.Autorest/help/New-AzSecurityInformationProtectionAwsOfferingObject.md new file mode 100644 index 000000000000..a2acdcb48b3a --- /dev/null +++ b/src/Security/Security.Autorest/help/New-AzSecurityInformationProtectionAwsOfferingObject.md @@ -0,0 +1,67 @@ +--- +external help file: +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/Az.Security/new-azsecurityinformationprotectionawsofferingobject +schema: 2.0.0 +--- + +# New-AzSecurityInformationProtectionAwsOfferingObject + +## SYNOPSIS +Create an in-memory object for InformationProtectionAwsOffering. + +## SYNTAX + +``` +New-AzSecurityInformationProtectionAwsOfferingObject [-InformationProtectionCloudRoleArn ] + [] +``` + +## DESCRIPTION +Create an in-memory object for InformationProtectionAwsOffering. + +## EXAMPLES + +### Example 1: Create new InformationProtectionAwsOffering object +```powershell +New-AzSecurityInformationProtectionAwsOfferingObject -InformationProtectionCloudRoleArn "arn:aws:iam::123456789012:role/myRole" +``` + +```output +Description InformationProtectionCloudRoleArn OfferingType +----------- --------------------------------- ------------ + arn:aws:iam::123456789012:role/myRole InformationProtectionAws +``` + + + +## PARAMETERS + +### -InformationProtectionCloudRoleArn +The cloud role ARN in AWS for this feature. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.InformationProtectionAwsOffering + +## NOTES + +## RELATED LINKS + diff --git a/src/Security/Security.Autorest/help/README.md b/src/Security/Security.Autorest/help/README.md new file mode 100644 index 000000000000..520e923d558e --- /dev/null +++ b/src/Security/Security.Autorest/help/README.md @@ -0,0 +1,11 @@ +# Docs +This directory contains the documentation of the cmdlets for the `Az.Security` module. To run documentation generation, use the `generate-help.ps1` script at the root module folder. Files in this folder will *always be overridden on regeneration*. To update documentation examples, please use the `..\examples` folder. + +## Info +- Modifiable: no +- Generated: all +- Committed: yes +- Packaged: yes + +## Details +The process of documentation generation loads `Az.Security` and analyzes the exported cmdlets from the module. It recognizes the [help comments](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_comment_based_help) that are generated into the scripts in the `..\exports` folder. Additionally, when writing custom cmdlets in the `..\custom` folder, you can use the help comments syntax, which decorate the exported scripts at build-time. The documentation examples are taken from the `..\examples` folder. \ No newline at end of file diff --git a/src/Security/Security.Autorest/help/Remove-AzSecurityConnector.md b/src/Security/Security.Autorest/help/Remove-AzSecurityConnector.md new file mode 100644 index 000000000000..c843838656e0 --- /dev/null +++ b/src/Security/Security.Autorest/help/Remove-AzSecurityConnector.md @@ -0,0 +1,179 @@ +--- +external help file: +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/az.security/remove-azsecurityconnector +schema: 2.0.0 +--- + +# Remove-AzSecurityConnector + +## SYNOPSIS +Deletes a security connector. + +## SYNTAX + +### Delete (Default) +``` +Remove-AzSecurityConnector -Name -ResourceGroupName [-SubscriptionId ] + [-DefaultProfile ] [-PassThru] [-Confirm] [-WhatIf] [] +``` + +### DeleteViaIdentity +``` +Remove-AzSecurityConnector -InputObject [-DefaultProfile ] [-PassThru] + [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Deletes a security connector. + +## EXAMPLES + +### Example 1: Remove security connector +```powershell +Remove-AzSecurityConnector -ResourceGroupName "securityconnectors-pwsh-tmp" -Name "ado-sdk-pwsh-test03" +``` + + + +## PARAMETERS + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +Parameter Sets: DeleteViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Name +The security connector name. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: SecurityConnectorName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PassThru +Returns true when the command succeeds + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group within the user's subscription. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure subscription ID + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity + +## OUTPUTS + +### System.Boolean + +## NOTES + +## RELATED LINKS + diff --git a/src/Security/Security.Autorest/help/Remove-AzSecurityConnectorDevOpsConfiguration.md b/src/Security/Security.Autorest/help/Remove-AzSecurityConnectorDevOpsConfiguration.md new file mode 100644 index 000000000000..080f72e0c669 --- /dev/null +++ b/src/Security/Security.Autorest/help/Remove-AzSecurityConnectorDevOpsConfiguration.md @@ -0,0 +1,210 @@ +--- +external help file: +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/az.security/remove-azsecurityconnectordevopsconfiguration +schema: 2.0.0 +--- + +# Remove-AzSecurityConnectorDevOpsConfiguration + +## SYNOPSIS +Deletes a DevOps Connector. + +## SYNTAX + +### Delete (Default) +``` +Remove-AzSecurityConnectorDevOpsConfiguration -ResourceGroupName -SecurityConnectorName + [-SubscriptionId ] [-DefaultProfile ] [-AsJob] [-NoWait] [-PassThru] [-Confirm] [-WhatIf] + [] +``` + +### DeleteViaIdentity +``` +Remove-AzSecurityConnectorDevOpsConfiguration -InputObject [-DefaultProfile ] + [-AsJob] [-NoWait] [-PassThru] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Deletes a DevOps Connector. + +## EXAMPLES + +### Example 1: Remove DevOps Configuration for the security connector +```powershell +Remove-AzSecurityConnectorDevOpsConfiguration -ResourceGroupName "securityconnectors-pwsh-tmp" -SecurityConnectorName "ado-sdk-pwsh-test03" +``` + + + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +Parameter Sets: DeleteViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PassThru +Returns true when the command succeeds + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SecurityConnectorName +The security connector name. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure subscription ID + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity + +## OUTPUTS + +### System.Boolean + +## NOTES + +## RELATED LINKS + diff --git a/src/Security/Security.Autorest/help/Update-AzSecurityConnector.md b/src/Security/Security.Autorest/help/Update-AzSecurityConnector.md new file mode 100644 index 000000000000..a4d142952ee5 --- /dev/null +++ b/src/Security/Security.Autorest/help/Update-AzSecurityConnector.md @@ -0,0 +1,318 @@ +--- +external help file: +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/az.security/update-azsecurityconnector +schema: 2.0.0 +--- + +# Update-AzSecurityConnector + +## SYNOPSIS +Updates a security connector + +## SYNTAX + +### UpdateExpanded (Default) +``` +Update-AzSecurityConnector -Name -ResourceGroupName [-SubscriptionId ] + [-EnvironmentData ] [-EnvironmentName ] [-Etag ] + [-HierarchyIdentifier ] [-Kind ] [-Location ] [-Offering ] + [-Tag ] [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +### UpdateViaIdentityExpanded +``` +Update-AzSecurityConnector -InputObject [-EnvironmentData ] + [-EnvironmentName ] [-Etag ] [-HierarchyIdentifier ] [-Kind ] + [-Location ] [-Offering ] [-Tag ] [-DefaultProfile ] + [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Updates a security connector + +## EXAMPLES + +### Example 1: Update security connector +```powershell +Update-AzSecurityConnector -ResourceGroupName "securityConnectors-pwsh-tmp" -Name "ado-sdk-pwsh-test03" -Tag @{myTag="v1"} +``` + +```output +EnvironmentData : { + "environmentType": "AzureDevOpsScope" + } +EnvironmentName : AzureDevOps +Etag : +HierarchyIdentifier : 9dd01e19-8aaf-43a2-8dd4-1c5992f4df35 +HierarchyIdentifierTrialEndDate : +Id : /subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourcegroups/securityconnectors-pwsh-tmp/providers/Microsoft.Security/securityConnectors/ado-sdk-pwsh-test03 +Kind : +Location : CentralUS +Name : ado-sdk-pwsh-test03 +Offering : {{ + "offeringType": "CspmMonitorAzureDevOps" + }} +ResourceGroupName : securityconnectors-pwsh-tmp +SystemDataCreatedAt : 2/24/2024 12:13:11 AM +SystemDataCreatedBy : c3d82ccb-fee1-430c-949e-6c0a217c00a8 +SystemDataCreatedByType : Application +SystemDataLastModifiedAt : 2/24/2024 12:24:02 AM +SystemDataLastModifiedBy : c3d82ccb-fee1-430c-949e-6c0a217c00a8 +SystemDataLastModifiedByType : Application +Tag : { + "myTag": "v1" + } +Type : Microsoft.Security/securityconnectors +``` + + + +## PARAMETERS + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -EnvironmentData +The security connector environment data. +. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnectorEnvironment +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -EnvironmentName +The multi cloud resource's cloud name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Etag +Entity tag is used for comparing two or more entities from the same requested resource. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -HierarchyIdentifier +The multi cloud resource identifier (account id in case of AWS connector, project number in case of GCP connector). + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +Parameter Sets: UpdateViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Kind +Kind of the resource + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Location +Location where the resource is stored + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +The security connector name. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: SecurityConnectorName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Offering +A collection of offerings for the security connector. +. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ICloudOffering[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group within the user's subscription. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure subscription ID + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Tag +A list of key value pairs that describe the resource. + +```yaml +Type: System.Collections.Hashtable +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnector + +## NOTES + +## RELATED LINKS + diff --git a/src/Security/Security.Autorest/help/Update-AzSecurityConnectorAzureDevOpsOrg.md b/src/Security/Security.Autorest/help/Update-AzSecurityConnectorAzureDevOpsOrg.md new file mode 100644 index 000000000000..e9c06896a427 --- /dev/null +++ b/src/Security/Security.Autorest/help/Update-AzSecurityConnectorAzureDevOpsOrg.md @@ -0,0 +1,259 @@ +--- +external help file: +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/az.security/update-azsecurityconnectorazuredevopsorg +schema: 2.0.0 +--- + +# Update-AzSecurityConnectorAzureDevOpsOrg + +## SYNOPSIS +Updates monitored Azure DevOps organization details. + +## SYNTAX + +### UpdateExpanded (Default) +``` +Update-AzSecurityConnectorAzureDevOpsOrg -OrgName -ResourceGroupName + -SecurityConnectorName [-SubscriptionId ] [-ActionableRemediation ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +### UpdateViaIdentityExpanded +``` +Update-AzSecurityConnectorAzureDevOpsOrg -InputObject + [-ActionableRemediation ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] + [-WhatIf] [] +``` + +## DESCRIPTION +Updates monitored Azure DevOps organization details. + +## EXAMPLES + +### Example 1: Update discovered AzureDevOps organization configuration +```powershell +$config = New-AzSecurityConnectorActionableRemediationObject -State Enabled -InheritFromParentState Disabled -CategoryConfiguration @( @{category="IaC"; minimumSeverityLevel="High"}) +Update-AzSecurityConnectorAzureDevOpsOrg -ResourceGroupName "securityConnectors-pwsh-tmp" -SecurityConnectorName "ado-sdk-pwsh-test03" -OrgName "org1" -ActionableRemediation $config +``` + +```output +ActionableRemediation : { + "state": "Enabled", + "categoryConfigurations": [ + { + "minimumSeverityLevel": "High", + "category": "IaC" + } + ], + "branchConfiguration": { + "branchNames": [ ], + "annotateDefaultBranch": "Enabled" + }, + "inheritFromParentState": "Disabled" + } +Id : /subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/securityConnectors-pwsh-tmp/providers/Microsoft.Security/securityConnectors/ado-sdk-pwsh-test03/devops/default/azureDevOpsOrgs/org1 +Name : org1 +OnboardingState : Onboarded +ProvisioningState : Succeeded +ProvisioningStatusMessage : OK +ProvisioningStatusUpdateTimeUtc : 2/24/2024 12:28:16 AM +ResourceGroupName : securityConnectors-pwsh-tmp +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Type : Microsoft.Security/securityConnectors/devops/azureDevOpsOrgs +``` + + + +## PARAMETERS + +### -ActionableRemediation +Configuration payload for PR Annotations. +. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediation +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +Parameter Sets: UpdateViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -OrgName +The Azure DevOps organization name. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SecurityConnectorName +The security connector name. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure subscription ID + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrg + +## NOTES + +## RELATED LINKS + diff --git a/src/Security/Security.Autorest/help/Update-AzSecurityConnectorAzureDevOpsProject.md b/src/Security/Security.Autorest/help/Update-AzSecurityConnectorAzureDevOpsProject.md new file mode 100644 index 000000000000..ce26834fa6fd --- /dev/null +++ b/src/Security/Security.Autorest/help/Update-AzSecurityConnectorAzureDevOpsProject.md @@ -0,0 +1,293 @@ +--- +external help file: +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/az.security/update-azsecurityconnectorazuredevopsproject +schema: 2.0.0 +--- + +# Update-AzSecurityConnectorAzureDevOpsProject + +## SYNOPSIS +Updates a monitored Azure DevOps project resource. + +## SYNTAX + +### UpdateExpanded (Default) +``` +Update-AzSecurityConnectorAzureDevOpsProject -OrgName -ProjectName + -ResourceGroupName -SecurityConnectorName [-SubscriptionId ] + [-ActionableRemediation ] [-ParentOrgName ] [-DefaultProfile ] + [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +### UpdateViaIdentityExpanded +``` +Update-AzSecurityConnectorAzureDevOpsProject -InputObject + [-ActionableRemediation ] [-ParentOrgName ] [-DefaultProfile ] + [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Updates a monitored Azure DevOps project resource. + +## EXAMPLES + +### Example 1: Update discovered AzureDevOps project configuration +```powershell +$config = New-AzSecurityConnectorActionableRemediationObject -State Disabled -InheritFromParentState Disabled -CategoryConfiguration @( @{category="IaC"; minimumSeverityLevel="Low"}) +Update-AzSecurityConnectorAzureDevOpsProject -ResourceGroupName "securityConnectors-pwsh-tmp" -SecurityConnectorName "ado-sdk-pwsh-test03" -OrgName "org1" -ProjectName "Build" -ActionableRemediation $config +``` + +```output +ActionableRemediation : { + "state": "Disabled", + "categoryConfigurations": [ + { + "minimumSeverityLevel": "Low", + "category": "IaC" + } + ], + "branchConfiguration": { + "branchNames": [ ], + "annotateDefaultBranch": "Enabled" + }, + "inheritFromParentState": "Disabled" + } +Id : /subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/securityConnectors-pwsh-tmp/providers/Microsoft.Security/securityConnectors/ado-sdk-pwsh-test03/devops/default/azureDevOpsOrgs/org1/p + rojects/Build +Name : Build +OnboardingState : Onboarded +ParentOrgName : org1 +ProjectId : 68b6a6ae-a3e4-41fa-b16e-bc4bbacd139a +ProvisioningState : Succeeded +ProvisioningStatusMessage : OK +ProvisioningStatusUpdateTimeUtc : 2/24/2024 12:31:18 AM +ResourceGroupName : securityConnectors-pwsh-tmp +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Type : Microsoft.Security/securityConnectors/devops/azureDevOpsOrgs/projects +``` + + + +## PARAMETERS + +### -ActionableRemediation +Configuration payload for PR Annotations. +. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediation +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +Parameter Sets: UpdateViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -OrgName +The Azure DevOps organization name. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ParentOrgName +Gets or sets parent Azure DevOps Organization name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProjectName +The project name. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SecurityConnectorName +The security connector name. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure subscription ID + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProject + +## NOTES + +## RELATED LINKS + diff --git a/src/Security/Security.Autorest/help/Update-AzSecurityConnectorAzureDevOpsRepo.md b/src/Security/Security.Autorest/help/Update-AzSecurityConnectorAzureDevOpsRepo.md new file mode 100644 index 000000000000..48b41700cb2f --- /dev/null +++ b/src/Security/Security.Autorest/help/Update-AzSecurityConnectorAzureDevOpsRepo.md @@ -0,0 +1,326 @@ +--- +external help file: +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/az.security/update-azsecurityconnectorazuredevopsrepo +schema: 2.0.0 +--- + +# Update-AzSecurityConnectorAzureDevOpsRepo + +## SYNOPSIS +Updates a monitored Azure DevOps repository resource. + +## SYNTAX + +### UpdateExpanded (Default) +``` +Update-AzSecurityConnectorAzureDevOpsRepo -OrgName -ProjectName -RepoName + -ResourceGroupName -SecurityConnectorName [-SubscriptionId ] + [-ActionableRemediation ] [-ParentOrgName ] [-ParentProjectName ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +### UpdateViaIdentityExpanded +``` +Update-AzSecurityConnectorAzureDevOpsRepo -InputObject + [-ActionableRemediation ] [-ParentOrgName ] [-ParentProjectName ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Updates a monitored Azure DevOps repository resource. + +## EXAMPLES + +### Example 1: Update discovered AzureDevOps repository configuration +```powershell +$config = New-AzSecurityConnectorActionableRemediationObject -State Enabled -InheritFromParentState Disabled -CategoryConfiguration @( @{category="IaC"; minimumSeverityLevel="Low"} ) +Update-AzSecurityConnectorAzureDevOpsRepo -ResourceGroupName "securityConnectors-pwsh-tmp" -SecurityConnectorName "ado-sdk-pwsh-test03" -OrgName "org1" -ProjectName "Build" -RepoName "Build" -ActionableRemediation $config +``` + +```output +ActionableRemediation : { + "state": "Enabled", + "categoryConfigurations": [ + { + "minimumSeverityLevel": "Low", + "category": "IaC" + } + ], + "branchConfiguration": { + "branchNames": [ ], + "annotateDefaultBranch": "Enabled" + }, + "inheritFromParentState": "Disabled" + } +Id : /subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/securityConnectors-pwsh-tmp/providers/Microsoft.Security/securityConnectors/ado-sdk-pwsh-test03/devops/default/azureDevOpsOrgs/org1/p + rojects/Build/repos/Build +Name : Build +OnboardingState : Onboarded +ParentOrgName : org1 +ParentProjectName : Build +ProvisioningState : Succeeded +ProvisioningStatusMessage : OK +ProvisioningStatusUpdateTimeUtc : 2/24/2024 12:31:19 AM +RepoId : 64d6ea8c-6030-44db-86a4-044f13a7f43e +RepoUrl : https://dev.azure.com/org1/Build/_git/Build +ResourceGroupName : securityConnectors-pwsh-tmp +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Type : Microsoft.Security/securityConnectors/devops/azureDevOpsOrgs/projects/repos +Visibility : +``` + + + +## PARAMETERS + +### -ActionableRemediation +Configuration payload for PR Annotations. +. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IActionableRemediation +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +Parameter Sets: UpdateViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -OrgName +The Azure DevOps organization name. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ParentOrgName +Gets or sets parent Azure DevOps Organization name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ParentProjectName +Gets or sets parent Azure DevOps Project name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProjectName +The project name. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -RepoName +The repository name. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SecurityConnectorName +The security connector name. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure subscription ID + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepository + +## NOTES + +## RELATED LINKS + diff --git a/src/Security/Security.Autorest/help/Update-AzSecurityConnectorDevOpsConfiguration.md b/src/Security/Security.Autorest/help/Update-AzSecurityConnectorDevOpsConfiguration.md new file mode 100644 index 000000000000..b30edb8a5d0e --- /dev/null +++ b/src/Security/Security.Autorest/help/Update-AzSecurityConnectorDevOpsConfiguration.md @@ -0,0 +1,262 @@ +--- +external help file: +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/az.security/update-azsecurityconnectordevopsconfiguration +schema: 2.0.0 +--- + +# Update-AzSecurityConnectorDevOpsConfiguration + +## SYNOPSIS +Updates a DevOps Configuration. + +## SYNTAX + +### UpdateExpanded (Default) +``` +Update-AzSecurityConnectorDevOpsConfiguration -ResourceGroupName -SecurityConnectorName + [-SubscriptionId ] [-AuthorizationCode ] [-AutoDiscovery ] + [-TopLevelInventoryList ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] + [] +``` + +### UpdateViaIdentityExpanded +``` +Update-AzSecurityConnectorDevOpsConfiguration -InputObject [-AuthorizationCode ] + [-AutoDiscovery ] [-TopLevelInventoryList ] [-DefaultProfile ] [-AsJob] [-NoWait] + [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Updates a DevOps Configuration. + +## EXAMPLES + +### Example 1: Update DevOps configuration +```powershell +Update-AzSecurityConnectorDevOpsConfiguration -ResourceGroupName "securityConnectors-pwsh-tmp" -SecurityConnectorName "ado-sdk-pwsh-test03" -AutoDiscovery Enabled +``` + +```output +AuthorizationCode : +AutoDiscovery : Enabled +Id : /subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/securityConnectors-pwsh-tmp/providers/Microsoft.Security/securityConnectors/ado-sdk-pwsh-test03/devops/default +Name : default +ProvisioningState : Succeeded +ProvisioningStatusMessage : Resource creation successful. +ProvisioningStatusUpdateTimeUtc : +ResourceGroupName : securityConnectors-pwsh-tmp +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +TopLevelInventoryList : +Type : Microsoft.Security/securityConnectors/devops +``` + + + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -AuthorizationCode +Gets or sets one-time OAuth code to exchange for refresh and access tokens.Only used during PUT/PATCH operations. +The secret is cleared during GET. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -AutoDiscovery +AutoDiscovery states. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +Parameter Sets: UpdateViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SecurityConnectorName +The security connector name. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure subscription ID + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TopLevelInventoryList +List of top-level inventory to select when AutoDiscovery is disabled.This field is ignored when AutoDiscovery is enabled. + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfiguration + +## NOTES + +## RELATED LINKS + diff --git a/src/Security/Security.Autorest/how-to.md b/src/Security/Security.Autorest/how-to.md new file mode 100644 index 000000000000..56e8a9194bc8 --- /dev/null +++ b/src/Security/Security.Autorest/how-to.md @@ -0,0 +1,58 @@ +# How-To +This document describes how to develop for `Az.Security`. + +## Building `Az.Security` +To build, run the `build-module.ps1` at the root of the module directory. This will generate the proxy script cmdlets that are the cmdlets being exported by this module. After the build completes, the proxy script cmdlets will be output to the `exports` folder. To read more about the proxy script cmdlets, look at the [README.md](exports/README.md) in the `exports` folder. + +## Creating custom cmdlets +To add cmdlets that were not generated by the REST specification, use the `custom` folder. This folder allows you to add handwritten `.ps1` and `.cs` files. Currently, we support using `.ps1` scripts as new cmdlets or as additional low-level variants (via `ParameterSet`), and `.cs` files as low-level (variants) cmdlets that the exported script cmdlets call. We do not support exporting any `.cs` (dll) cmdlets directly. To read more about custom cmdlets, look at the [README.md](custom/README.md) in the `custom` folder. + +## Generating documentation +To generate documentation, the process is now integrated into the `build-module.ps1` script. If you don't want to run this process as part of `build-module.ps1`, you can provide the `-NoDocs` switch. If you want to run documentation generation after the build process, you may still run the `generate-help.ps1` script. Overall, the process will look at the documentation comments in the generated and custom cmdlets and types, and create `.md` files into the `docs` folder. Additionally, this pulls in any examples from the `examples` folder and adds them to the generated help markdown documents. To read more about examples, look at the [README.md](examples/README.md) in the `examples` folder. To read more about documentation, look at the [README.md](docs/README.md) in the `docs` folder. + +## Testing `Az.Security` +To test the cmdlets, we use [Pester](https://github.com/pester/Pester). Tests scripts (`.ps1`) should be added to the `test` folder. To execute the Pester tests, run the `test-module.ps1` script. This will run all tests in `playback` mode within the `test` folder. To read more about testing cmdlets, look at the [README.md](examples/README.md) in the `examples` folder. + +## Packing `Az.Security` +To pack `Az.Security` for distribution, run the `pack-module.ps1` script. This will take the contents of multiple directories and certain root-folder files to create a `.nupkg`. The structure of the `.nupkg` is created so it can be loaded part of a [PSRepository](https://learn.microsoft.com/powershell/module/powershellget/register-psrepository). Additionally, this package is in a format for distribution to the [PSGallery](https://www.powershellgallery.com/). For signing an Azure module, please contact the [Azure PowerShell](https://github.com/Azure/azure-powershell) team. + +## Module Script Details +There are multiple scripts created for performing different actions for developing `Az.Security`. +- `build-module.ps1` + - Builds the module DLL (`./bin/Az.Security.private.dll`), creates the exported cmdlets and documentation, generates custom cmdlet test stubs and exported cmdlet example stubs, and updates `./Az.Security.psd1` with Azure profile information. + - **Parameters**: [`Switch` parameters] + - `-Run`: After building, creates an isolated PowerShell session and loads `Az.Security`. + - `-Test`: After building, runs the `Pester` tests defined in the `test` folder. + - `-Docs`: After building, generates the Markdown documents for the modules into the `docs` folder. + - `-Pack`: After building, packages the module into a `.nupkg`. + - `-Code`: After building, opens a VSCode window with the module's directory and runs (see `-Run`) the module. + - `-Release`: Builds the module in `Release` configuration (as opposed to `Debug` configuration). + - `-NoDocs`: Supresses writing the documentation markdown files as part of the cmdlet exporting process. + - `-Debugger`: Used when attaching the debugger in Visual Studio to the PowerShell session, and running the build process without recompiling the DLL. This suppresses running the script as an isolated process. +- `run-module.ps1` + - Creates an isolated PowerShell session and loads `Az.Security` into the session. + - Same as `-Run` in `build-module.ps1`. + - **Parameters**: [`Switch` parameters] + - `-Code`: Opens a VSCode window with the module's directory. + - Same as `-Code` in `build-module.ps1`. +- `generate-help.ps1` + - Generates the Markdown documents for the modules into the `docs` folder. + - Same as `-Docs` in `build-module.ps1`. +- `test-module.ps1` + - Runs the `Pester` tests defined in the `test` folder. + - Same as `-Test` in `build-module.ps1`. +- `pack-module.ps1` + - Packages the module into a `.nupkg` for distribution. + - Same as `-Pack` in `build-module.ps1`. +- `generate-help.ps1` + - Generates the Markdown documents for the modules into the `docs` folder. + - Same as `-Docs` in `build-module.ps1`. + - This process is now integrated into `build-module.ps1` automatically. To disable, use `-NoDocs` when running `build-module.ps1`. +- `export-surface.ps1` + - Generates Markdown documents for both the cmdlet surface and the model (class) surface of the module. + - These files are placed into the `resources` folder. + - Used for investigating the surface of your module. These are *not* documentation for distribution. +- `check-dependencies.ps1` + - Used in `run-module.ps1` and `test-module.ps1` to verify dependent modules are available to run those tasks. + - It will download local (within the module's directory structure) versions of those modules as needed. + - This script *does not* need to be ran by-hand. \ No newline at end of file diff --git a/src/Security/Security.Autorest/internal/Az.Security.internal.psm1 b/src/Security/Security.Autorest/internal/Az.Security.internal.psm1 new file mode 100644 index 000000000000..76a1fdabfd0c --- /dev/null +++ b/src/Security/Security.Autorest/internal/Az.Security.internal.psm1 @@ -0,0 +1,38 @@ +# region Generated + # Load the private module dll + $null = Import-Module -PassThru -Name (Join-Path $PSScriptRoot '..\bin\Az.Security.private.dll') + + # Get the private module's instance + $instance = [Microsoft.Azure.PowerShell.Cmdlets.Security.Module]::Instance + + # Export nothing to clear implicit exports + Export-ModuleMember + + # Export proxy cmdlet scripts + $exportsPath = $PSScriptRoot + $directories = Get-ChildItem -Directory -Path $exportsPath + $profileDirectory = $null + if($instance.ProfileName) { + if(($directories | ForEach-Object { $_.Name }) -contains $instance.ProfileName) { + $profileDirectory = $directories | Where-Object { $_.Name -eq $instance.ProfileName } + } else { + # Don't export anything if the profile doesn't exist for the module + $exportsPath = $null + Write-Warning "Selected Azure profile '$($instance.ProfileName)' does not exist for module '$($instance.Name)'. No cmdlets were loaded." + } + } elseif(($directories | Measure-Object).Count -gt 0) { + # Load the last folder if no profile is selected + $profileDirectory = $directories | Select-Object -Last 1 + } + + if($profileDirectory) { + Write-Information "Loaded Azure profile '$($profileDirectory.Name)' for module '$($instance.Name)'" + $exportsPath = $profileDirectory.FullName + } + + if($exportsPath) { + Get-ChildItem -Path $exportsPath -Recurse -Include '*.ps1' -File | ForEach-Object { . $_.FullName } + $cmdletNames = Get-ScriptCmdlet -ScriptFolder $exportsPath + Export-ModuleMember -Function $cmdletNames -Alias (Get-ScriptCmdlet -ScriptFolder $exportsPath -AsAlias) + } +# endregion diff --git a/src/Security/Security.Autorest/internal/README.md b/src/Security/Security.Autorest/internal/README.md new file mode 100644 index 000000000000..3b2535bdf09d --- /dev/null +++ b/src/Security/Security.Autorest/internal/README.md @@ -0,0 +1,14 @@ +# Internal +This directory contains a module to handle *internal only* cmdlets. Cmdlets that you **hide** in configuration are created here. For more information on hiding, see [cmdlet hiding](https://github.com/Azure/autorest.powershell/blob/main/docs/directives.md#cmdlet-hiding-exportation-suppression). The cmdlets in this directory are generated at **build-time**. Do not put any custom code, files, cmdlets, etc. into this directory. Please use `..\custom` for all custom implementation. + +## Info +- Modifiable: no +- Generated: all +- Committed: no +- Packaged: yes + +## Details +The `Az.Security.internal.psm1` file is generated to this folder. This module file handles the hidden cmdlets. These cmdlets will not be exported by `Az.Security`. Instead, this sub-module is imported by the `..\custom\Az.Security.custom.psm1` module, allowing you to use hidden cmdlets in your custom, exposed cmdlets. To call these cmdlets in your custom scripts, simply use [module-qualified calls](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_command_precedence?view=powershell-6#qualified-names). For example, `Az.Security.internal\Get-Example` would call an internal cmdlet named `Get-Example`. + +## Purpose +This allows you to include REST specifications for services that you *do not wish to expose from your module*, but simply want to call within custom cmdlets. For example, if you want to make a custom cmdlet that uses `Storage` services, you could include a simplified `Storage` REST specification that has only the operations you need. When you run the generator and build this module, note the generated `Storage` cmdlets. Then, in your readme configuration, use [cmdlet hiding](https://github.com/Azure/autorest/blob/master/docs/powershell/options.md#cmdlet-hiding-exportation-suppression) on the `Storage` cmdlets and they will *only be exposed to the custom cmdlets* you want to write, and not be exported as part of `Az.Security`. diff --git a/src/Security/Security.Autorest/pack-module.ps1 b/src/Security/Security.Autorest/pack-module.ps1 new file mode 100644 index 000000000000..2f30ca3fffa0 --- /dev/null +++ b/src/Security/Security.Autorest/pack-module.ps1 @@ -0,0 +1,17 @@ +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- +Write-Host -ForegroundColor Green 'Packing module...' +dotnet pack $PSScriptRoot --no-build /nologo +Write-Host -ForegroundColor Green '-------------Done-------------' \ No newline at end of file diff --git a/src/Security/Security.Autorest/run-module.ps1 b/src/Security/Security.Autorest/run-module.ps1 new file mode 100644 index 000000000000..df2262cbe970 --- /dev/null +++ b/src/Security/Security.Autorest/run-module.ps1 @@ -0,0 +1,62 @@ +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- +param([switch]$NotIsolated, [switch]$Code) +$ErrorActionPreference = 'Stop' + +if(-not $NotIsolated) { + Write-Host -ForegroundColor Green 'Creating isolated process...' + $pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path + & "$pwsh" -NoExit -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -NotIsolated + return +} + +$isAzure = $true +if($isAzure) { + . (Join-Path $PSScriptRoot 'check-dependencies.ps1') -NotIsolated -Accounts + # Load the latest version of Az.Accounts installed + Import-Module -Name Az.Accounts -RequiredVersion (Get-Module -Name Az.Accounts -ListAvailable | Sort-Object -Property Version -Descending)[0].Version +} + +$localModulesPath = Join-Path $PSScriptRoot 'generated\modules' +if(Test-Path -Path $localModulesPath) { + $env:PSModulePath = "$localModulesPath$([IO.Path]::PathSeparator)$env:PSModulePath" +} + +$modulePsd1 = Get-Item -Path (Join-Path $PSScriptRoot './Az.Security.psd1') +$modulePath = $modulePsd1.FullName +$moduleName = $modulePsd1.BaseName + +function Prompt { + Write-Host -NoNewline -ForegroundColor Green "PS $(Get-Location)" + Write-Host -NoNewline -ForegroundColor Gray ' [' + Write-Host -NoNewline -ForegroundColor White -BackgroundColor DarkCyan $moduleName + ']> ' +} + +# where we would find the launch.json file +$vscodeDirectory = New-Item -ItemType Directory -Force -Path (Join-Path $PSScriptRoot '.vscode') +$launchJson = Join-Path $vscodeDirectory 'launch.json' + +# if there is a launch.json file, let's just assume -Code, and update the file +if(($Code) -or (test-Path $launchJson) ) { + $launchContent = '{ "version": "0.2.0", "configurations":[{ "name":"Attach to PowerShell", "type":"coreclr", "request":"attach", "processId":"' + ([System.Diagnostics.Process]::GetCurrentProcess().Id) + '", "justMyCode":false }] }' + Set-Content -Path $launchJson -Value $launchContent + if($Code) { + # only launch vscode if they say -code + code $PSScriptRoot + } +} + +Import-Module -Name $modulePath \ No newline at end of file diff --git a/src/Security/Security.Autorest/test-module.ps1 b/src/Security/Security.Autorest/test-module.ps1 new file mode 100644 index 000000000000..f22005d54b2f --- /dev/null +++ b/src/Security/Security.Autorest/test-module.ps1 @@ -0,0 +1,94 @@ +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- +param([switch]$NotIsolated, [switch]$Live, [switch]$Record, [switch]$Playback, [switch]$RegenerateSupportModule, [switch]$UsePreviousConfigForRecord, [string[]]$TestName) +$ErrorActionPreference = 'Stop' + +if(-not $NotIsolated) +{ + Write-Host -ForegroundColor Green 'Creating isolated process...' + if ($PSBoundParameters.ContainsKey("TestName")) { + $PSBoundParameters["TestName"] = $PSBoundParameters["TestName"] -join "," + } + $pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path + & "$pwsh" -NonInteractive -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -NotIsolated + return +} + +# This is a workaround, since for string array parameter, pwsh -File will only take the first element +if ($PSBoundParameters.ContainsKey("TestName") -and ($TestName.count -eq 1) -and ($TestName[0].Contains(','))) { + $TestName = $TestName[0].Split(",") +} + +$ProgressPreference = 'SilentlyContinue' +$baseName = $PSScriptRoot.BaseName +$requireResourceModule = (($baseName -ne "Resources") -and ($Record.IsPresent -or $Live.IsPresent)) +. (Join-Path $PSScriptRoot 'check-dependencies.ps1') -NotIsolated -Accounts:$false -Pester -Resources:$requireResourceModule -RegenerateSupportModule:$RegenerateSupportModule +. ("$PSScriptRoot\test\utils.ps1") + +if ($requireResourceModule) +{ + # Load the latest Az.Accounts installed + Import-Module -Name Az.Accounts -RequiredVersion (Get-Module -Name Az.Accounts -ListAvailable | Sort-Object -Property Version -Descending)[0].Version + $resourceModulePSD = Get-Item -Path (Join-Path $HOME '.PSSharedModules\Resources\Az.Resources.TestSupport.psd1') + Import-Module -Name $resourceModulePSD.FullName +} + +$localModulesPath = Join-Path $PSScriptRoot 'generated\modules' +if(Test-Path -Path $localModulesPath) +{ + $env:PSModulePath = "$localModulesPath$([IO.Path]::PathSeparator)$env:PSModulePath" +} + +$modulePsd1 = Get-Item -Path (Join-Path $PSScriptRoot './Az.Security.psd1') +$modulePath = $modulePsd1.FullName +$moduleName = $modulePsd1.BaseName + +Import-Module -Name Pester +Import-Module -Name $modulePath + +$TestMode = 'playback' +$ExcludeTag = @("LiveOnly") +if($Live) +{ + $TestMode = 'live' + $ExcludeTag = @() +} +if($Record) +{ + $TestMode = 'record' +} +try +{ + if ($TestMode -ne 'playback') + { + setupEnv + } + $testFolder = Join-Path $PSScriptRoot 'test' + if ($null -ne $TestName) + { + Invoke-Pester -Script @{ Path = $testFolder } -TestName $TestName -ExcludeTag $ExcludeTag -EnableExit -OutputFile (Join-Path $testFolder "$moduleName-TestResults.xml") + } else + { + Invoke-Pester -Script @{ Path = $testFolder } -ExcludeTag $ExcludeTag -EnableExit -OutputFile (Join-Path $testFolder "$moduleName-TestResults.xml") + } +} Finally +{ + if ($TestMode -ne 'playback') + { + cleanupEnv + } +} + +Write-Host -ForegroundColor Green '-------------Done-------------' diff --git a/src/Security/Security.Autorest/test/Get-AzSecurityApiCollection.Recording.json b/src/Security/Security.Autorest/test/Get-AzSecurityApiCollection.Recording.json new file mode 100644 index 000000000000..89682913dc1b --- /dev/null +++ b/src/Security/Security.Autorest/test/Get-AzSecurityApiCollection.Recording.json @@ -0,0 +1,222 @@ +{ + "Get-AzSecurityApiCollection+[NoContext]+List+$GET+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/apicollectionstests/providers/Microsoft.Security/apiCollections?api-version=2023-11-15+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/apicollectionstests/providers/Microsoft.Security/apiCollections?api-version=2023-11-15", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "1" ], + "x-ms-client-request-id": [ "7d0031e5-ed48-4233-a623-bd767782aad7" ], + "CommandName": [ "Get-AzSecurityApiCollection" ], + "FullCommandName": [ "Get-AzSecurityApiCollection_List1" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "03254352-061e-4931-b16c-4a063caeb8cd" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "mise-correlation-id": [ "fb5b0b9e-8f77-47a3-a9b7-8d9047781e52" ], + "traceparent": [ "00-ebdd1d6618ffbedebc6b040c94281175-7bc85025f8be91c1-00" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "x-ms-correlation-request-id": [ "03254352-061e-4931-b16c-4a063caeb8cd" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T020818Z:03254352-061e-4931-b16c-4a063caeb8cd" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 5393709516744ADA9CB9DAC31E2A45D8 Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:08:16Z" ], + "Date": [ "Wed, 14 Feb 2024 02:08:17 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "752" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/apicollectionstests/providers/Microsoft.ApiManagement/service/demoapimservice2/providers/Microsoft.Security/apiCollections/echo-api\",\"name\":\"echo-api\",\"type\":\"microsoft.security/apicollections\",\"properties\":{\"provisioningState\":\"Succeeded\",\"displayName\":\"Echo API\",\"discoveredVia\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/apicollectionstests/providers/Microsoft.ApiManagement/service/demoapimservice2\",\"baseUrl\":\"https://demoapimservice2.azure-api.net/echo\",\"numberOfApiEndpoints\":6,\"numberOfInactiveApiEndpoints\":6,\"numberOfUnauthenticatedApiEndpoints\":0,\"numberOfExternalApiEndpoints\":0,\"numberOfApiEndpointsWithSensitiveDataExposed\":0}}]}", + "isContentBase64": false + } + }, + "Get-AzSecurityApiCollection+[NoContext]+Get+$GET+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/apicollectionstests/providers/Microsoft.ApiManagement/service/demoapimservice2/providers/Microsoft.Security/apiCollections/echo-api?api-version=2023-11-15+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/apicollectionstests/providers/Microsoft.ApiManagement/service/demoapimservice2/providers/Microsoft.Security/apiCollections/echo-api?api-version=2023-11-15", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "2" ], + "x-ms-client-request-id": [ "980b76a5-9554-4911-8b7f-18e069160b07" ], + "CommandName": [ "Get-AzSecurityApiCollection" ], + "FullCommandName": [ "Get-AzSecurityApiCollection_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "f91b02c5-2107-43bb-a814-30d6793eab0f" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "mise-correlation-id": [ "11a79bf9-4e15-47b8-af4d-c221f3a3f8f9" ], + "traceparent": [ "00-577a658b2f9d113fdc086368c4a6f55a-6ff23f8c2c0a6491-00" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "x-ms-correlation-request-id": [ "f91b02c5-2107-43bb-a814-30d6793eab0f" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T020819Z:f91b02c5-2107-43bb-a814-30d6793eab0f" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 4B891016BCA844E482912D9AB545D4DA Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:08:18Z" ], + "Date": [ "Wed, 14 Feb 2024 02:08:18 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "740" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/apicollectionstests/providers/Microsoft.ApiManagement/service/demoapimservice2/providers/Microsoft.Security/apiCollections/echo-api\",\"name\":\"echo-api\",\"type\":\"microsoft.security/apicollections\",\"properties\":{\"provisioningState\":\"Succeeded\",\"displayName\":\"Echo API\",\"discoveredVia\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/apicollectionstests/providers/Microsoft.ApiManagement/service/demoapimservice2\",\"baseUrl\":\"https://demoapimservice2.azure-api.net/echo\",\"numberOfApiEndpoints\":6,\"numberOfInactiveApiEndpoints\":6,\"numberOfUnauthenticatedApiEndpoints\":0,\"numberOfExternalApiEndpoints\":0,\"numberOfApiEndpointsWithSensitiveDataExposed\":0}}", + "isContentBase64": false + } + }, + "Get-AzSecurityApiCollection+[NoContext]+ListBySubscription+$GET+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/providers/Microsoft.Security/apiCollections?api-version=2023-11-15+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/providers/Microsoft.Security/apiCollections?api-version=2023-11-15", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "3" ], + "x-ms-client-request-id": [ "9c81a86f-526f-41e3-8f11-473732e62ce6" ], + "CommandName": [ "Get-AzSecurityApiCollection" ], + "FullCommandName": [ "Get-AzSecurityApiCollection_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "f256739c-f25e-431f-b8a5-988982ca1296" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "mise-correlation-id": [ "9f1d750c-df89-43b5-a307-8120d285da4d" ], + "traceparent": [ "00-bc96983a21988c003131f593e0e9054e-52454530adf8fe97-00" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "x-ms-correlation-request-id": [ "f256739c-f25e-431f-b8a5-988982ca1296" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T020820Z:f256739c-f25e-431f-b8a5-988982ca1296" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 71C2BD2631C74A60962347F3D2026799 Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:08:19Z" ], + "Date": [ "Wed, 14 Feb 2024 02:08:20 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "752" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/apicollectionstests/providers/Microsoft.ApiManagement/service/demoapimservice2/providers/Microsoft.Security/apiCollections/echo-api\",\"name\":\"echo-api\",\"type\":\"microsoft.security/apicollections\",\"properties\":{\"provisioningState\":\"Succeeded\",\"displayName\":\"Echo API\",\"discoveredVia\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/apicollectionstests/providers/Microsoft.ApiManagement/service/demoapimservice2\",\"baseUrl\":\"https://demoapimservice2.azure-api.net/echo\",\"numberOfApiEndpoints\":6,\"numberOfInactiveApiEndpoints\":6,\"numberOfUnauthenticatedApiEndpoints\":0,\"numberOfExternalApiEndpoints\":0,\"numberOfApiEndpointsWithSensitiveDataExposed\":0}}]}", + "isContentBase64": false + } + }, + "Get-AzSecurityApiCollection+[NoContext]+ListByService+$GET+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/apicollectionstests/providers/Microsoft.ApiManagement/service/demoapimservice2/providers/Microsoft.Security/apiCollections?api-version=2023-11-15+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/apicollectionstests/providers/Microsoft.ApiManagement/service/demoapimservice2/providers/Microsoft.Security/apiCollections?api-version=2023-11-15", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "4" ], + "x-ms-client-request-id": [ "b824a0c6-a3c1-411f-9cfa-0fd538ecf4c3" ], + "CommandName": [ "Get-AzSecurityApiCollection" ], + "FullCommandName": [ "Get-AzSecurityApiCollection_List2" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "df0fe716-990c-45a0-9cc4-40a691efdf09" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11998" ], + "mise-correlation-id": [ "cac08564-154c-4912-97d9-da3ea38b5a95" ], + "traceparent": [ "00-b5142d373081f9e285b25474e7e1afd8-bf4a6d0d5c65b25c-00" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "x-ms-correlation-request-id": [ "df0fe716-990c-45a0-9cc4-40a691efdf09" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T020821Z:df0fe716-990c-45a0-9cc4-40a691efdf09" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: A19F57D31C3846CEA0D623212129A8A0 Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:08:20Z" ], + "Date": [ "Wed, 14 Feb 2024 02:08:21 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "752" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/apicollectionstests/providers/Microsoft.ApiManagement/service/demoapimservice2/providers/Microsoft.Security/apiCollections/echo-api\",\"name\":\"echo-api\",\"type\":\"microsoft.security/apicollections\",\"properties\":{\"provisioningState\":\"Succeeded\",\"displayName\":\"Echo API\",\"discoveredVia\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/apicollectionstests/providers/Microsoft.ApiManagement/service/demoapimservice2\",\"baseUrl\":\"https://demoapimservice2.azure-api.net/echo\",\"numberOfApiEndpoints\":6,\"numberOfInactiveApiEndpoints\":6,\"numberOfUnauthenticatedApiEndpoints\":0,\"numberOfExternalApiEndpoints\":0,\"numberOfApiEndpointsWithSensitiveDataExposed\":0}}]}", + "isContentBase64": false + } + }, + "Get-AzSecurityApiCollection+[NoContext]+GetViaIdentity+$GET+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/apicollectionstests/providers/Microsoft.ApiManagement/service/demoapimservice2/providers/Microsoft.Security/apiCollections/echo-api?api-version=2023-11-15+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/apicollectionstests/providers/Microsoft.ApiManagement/service/demoapimservice2/providers/Microsoft.Security/apiCollections/echo-api?api-version=2023-11-15", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "5" ], + "x-ms-client-request-id": [ "46c088f4-73b4-4bf1-9a55-b3d8607178a4" ], + "CommandName": [ "Get-AzSecurityApiCollection" ], + "FullCommandName": [ "Get-AzSecurityApiCollection_GetViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "16ab7340-0015-4e20-af12-3baa72ec7b50" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "mise-correlation-id": [ "40bc3ecf-f869-4938-9f39-93674f2ff11a" ], + "traceparent": [ "00-edf093f2f76cea14bcb9821b01731ba4-1028c0b8ec42a4db-00" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "x-ms-correlation-request-id": [ "16ab7340-0015-4e20-af12-3baa72ec7b50" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T020823Z:16ab7340-0015-4e20-af12-3baa72ec7b50" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: D5203F3EE65B46358CC4432F144AB94E Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:08:21Z" ], + "Date": [ "Wed, 14 Feb 2024 02:08:22 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "740" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/apicollectionstests/providers/Microsoft.ApiManagement/service/demoapimservice2/providers/Microsoft.Security/apiCollections/echo-api\",\"name\":\"echo-api\",\"type\":\"microsoft.security/apicollections\",\"properties\":{\"provisioningState\":\"Succeeded\",\"displayName\":\"Echo API\",\"discoveredVia\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/apicollectionstests/providers/Microsoft.ApiManagement/service/demoapimservice2\",\"baseUrl\":\"https://demoapimservice2.azure-api.net/echo\",\"numberOfApiEndpoints\":6,\"numberOfInactiveApiEndpoints\":6,\"numberOfUnauthenticatedApiEndpoints\":0,\"numberOfExternalApiEndpoints\":0,\"numberOfApiEndpointsWithSensitiveDataExposed\":0}}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/test/Get-AzSecurityApiCollection.Tests.ps1 b/src/Security/Security.Autorest/test/Get-AzSecurityApiCollection.Tests.ps1 new file mode 100644 index 000000000000..93d569175f92 --- /dev/null +++ b/src/Security/Security.Autorest/test/Get-AzSecurityApiCollection.Tests.ps1 @@ -0,0 +1,50 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzSecurityApiCollection')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzSecurityApiCollection.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzSecurityApiCollection' { + It 'List' { + $rg = $env.ApiCollectionsResourceGroupName + $collections = Get-AzSecurityApiCollection -ResourceGroupName $rg + $collections.Count | Should -BeGreaterThan 0 + } + + It 'Get' { + $rg = $env.ApiCollectionsResourceGroupName + $collection = Get-AzSecurityApiCollection -ResourceGroup $rg -ServiceName "demoapimservice2" -ApiId "echo-api" + $collection | Should -Not -Be $null + $collection.Name.Contains('echo-api') | Should -Be $true + } + + It 'ListBySubscription' { + $collections = Get-AzSecurityApiCollection + $collections.Count | Should -BeGreaterThan 0 + } + + It 'ListByService' { + $rg = $env.ApiCollectionsResourceGroupName + $collections = Get-AzSecurityApiCollection -ResourceGroup $rg -ServiceName "demoapimservice2" + $collections.Count | Should -BeGreaterThan 0 + } + + It 'GetViaIdentity' { + $rg = $env.ApiCollectionsResourceGroupName + $sid = $env.SubscriptionId + $InputObject = @{Id = "/subscriptions/$sid/resourceGroups/$rg/providers/Microsoft.ApiManagement/service/demoapimservice2/providers/Microsoft.Security/apiCollections/echo-api" } + $collection = Get-AzSecurityApiCollection -InputObject $InputObject + $collection.Count | Should -Be 1 + $collection.Name.Contains('echo-api') | Should -Be $true + } +} diff --git a/src/Security/Security.Autorest/test/Get-AzSecurityConnector.Recording.json b/src/Security/Security.Autorest/test/Get-AzSecurityConnector.Recording.json new file mode 100644 index 000000000000..5ff7d540825b --- /dev/null +++ b/src/Security/Security.Autorest/test/Get-AzSecurityConnector.Recording.json @@ -0,0 +1,174 @@ +{ + "Get-AzSecurityConnector+[NoContext]+List+$GET+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors?api-version=2023-10-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors?api-version=2023-10-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "6" ], + "x-ms-client-request-id": [ "f43a131c-9b98-462d-b4e4-089bd01a6169" ], + "CommandName": [ "Get-AzSecurityConnector" ], + "FullCommandName": [ "Get-AzSecurityConnector_List1" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Vary": [ "Accept-Encoding" ], + "x-ms-ratelimit-remaining-subscription-resource-requests": [ "99" ], + "x-ms-request-id": [ "76073450-227e-4632-be4d-8c59c2c9a5f8" ], + "x-ms-correlation-request-id": [ "76073450-227e-4632-be4d-8c59c2c9a5f8" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T020825Z:76073450-227e-4632-be4d-8c59c2c9a5f8" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: AB597D11544E4C7D80A8E89DDA20D79A Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:08:24Z" ], + "Date": [ "Wed, 14 Feb 2024 02:08:24 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "2420" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"properties\":{\"offerings\":[{\"offeringType\":\"CspmMonitorAzureDevOps\"}],\"environmentName\":\"AzureDevOps\",\"hierarchyIdentifier\":\"4a8eb7f1-f533-48c5-b102-9b09e90906b7\",\"environmentData\":{\"environmentType\":\"AzureDevOpsScope\"}},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourcegroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01\",\"name\":\"dfdsdktests-azdo-01\",\"type\":\"Microsoft.Security/securityconnectors\",\"location\":\"centralus\",\"tags\":{\"pwshsdktest2\":\"true\"},\"systemData\":{\"createdBy\":\"c3d82ccb-fee1-430c-949e-6c0a217c00a8\",\"createdByType\":\"Application\",\"createdAt\":\"2023-12-07T06:38:36.3536844Z\",\"lastModifiedBy\":\"c3d82ccb-fee1-430c-949e-6c0a217c00a8\",\"lastModifiedByType\":\"Application\",\"lastModifiedAt\":\"2024-02-13T23:45:37.7516486Z\"}},{\"properties\":{\"offerings\":[{\"offeringType\":\"CspmMonitorGitLab\"}],\"environmentName\":\"GitLab\",\"hierarchyIdentifier\":\"7a1f4efe-f8c6-48e7-b7ef-1b45994ed602\",\"environmentData\":{\"environmentType\":\"GitlabScope\"}},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourcegroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gl-01\",\"name\":\"dfdsdktests-gl-01\",\"type\":\"Microsoft.Security/securityconnectors\",\"location\":\"centralus\",\"tags\":{},\"systemData\":{\"createdBy\":\"c3d82ccb-fee1-430c-949e-6c0a217c00a8\",\"createdByType\":\"Application\",\"createdAt\":\"2023-12-11T18:52:24.9825323Z\",\"lastModifiedBy\":\"c3d82ccb-fee1-430c-949e-6c0a217c00a8\",\"lastModifiedByType\":\"Application\",\"lastModifiedAt\":\"2023-12-11T19:22:09.7886218Z\"}},{\"properties\":{\"offerings\":[{\"offeringType\":\"CspmMonitorGithub\"}],\"environmentName\":\"Github\",\"hierarchyIdentifier\":\"bc12ba4d-b89c-486e-85e1-d803e7d80525\",\"environmentData\":{\"environmentType\":\"GithubScope\"}},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourcegroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gh-01\",\"name\":\"dfdsdktests-gh-01\",\"type\":\"Microsoft.Security/securityconnectors\",\"location\":\"centralus\",\"tags\":{},\"systemData\":{\"createdBy\":\"c3d82ccb-fee1-430c-949e-6c0a217c00a8\",\"createdByType\":\"Application\",\"createdAt\":\"2023-12-11T19:31:38.6578077Z\",\"lastModifiedBy\":\"c3d82ccb-fee1-430c-949e-6c0a217c00a8\",\"lastModifiedByType\":\"Application\",\"lastModifiedAt\":\"2023-12-11T19:31:38.6578077Z\"}}]}", + "isContentBase64": false + } + }, + "Get-AzSecurityConnector+[NoContext]+ListBySubscription+$GET+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/providers/Microsoft.Security/securityConnectors?api-version=2023-10-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/providers/Microsoft.Security/securityConnectors?api-version=2023-10-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "7" ], + "x-ms-client-request-id": [ "7e512064-64c9-4e6a-8a48-08a571dc88ae" ], + "CommandName": [ "Get-AzSecurityConnector" ], + "FullCommandName": [ "Get-AzSecurityConnector_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Vary": [ "Accept-Encoding" ], + "x-ms-ratelimit-remaining-subscription-resource-requests": [ "99" ], + "x-ms-request-id": [ "1d6f817b-29bc-46fd-b964-b063f14bead0" ], + "x-ms-correlation-request-id": [ "1d6f817b-29bc-46fd-b964-b063f14bead0" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T020825Z:1d6f817b-29bc-46fd-b964-b063f14bead0" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 2E6106F412584E14BD91FBD9110D8B55 Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:08:25Z" ], + "Date": [ "Wed, 14 Feb 2024 02:08:25 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "3363" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"properties\":{\"offerings\":[{\"offeringType\":\"CspmMonitorAzureDevOps\"}],\"environmentName\":\"AzureDevOps\",\"hierarchyIdentifier\":\"4a8eb7f1-f533-48c5-b102-9b09e90906b7\",\"environmentData\":{\"environmentType\":\"AzureDevOpsScope\"}},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourcegroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01\",\"name\":\"dfdsdktests-azdo-01\",\"type\":\"Microsoft.Security/securityconnectors\",\"location\":\"centralus\",\"tags\":{\"pwshsdktest2\":\"true\"},\"systemData\":{\"createdBy\":\"c3d82ccb-fee1-430c-949e-6c0a217c00a8\",\"createdByType\":\"Application\",\"createdAt\":\"2023-12-07T06:38:36.3536844Z\",\"lastModifiedBy\":\"c3d82ccb-fee1-430c-949e-6c0a217c00a8\",\"lastModifiedByType\":\"Application\",\"lastModifiedAt\":\"2024-02-13T23:45:37.7516486Z\"}},{\"properties\":{\"offerings\":[{\"offeringType\":\"CspmMonitorGitLab\"}],\"environmentName\":\"GitLab\",\"hierarchyIdentifier\":\"7a1f4efe-f8c6-48e7-b7ef-1b45994ed602\",\"environmentData\":{\"environmentType\":\"GitlabScope\"}},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourcegroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gl-01\",\"name\":\"dfdsdktests-gl-01\",\"type\":\"Microsoft.Security/securityconnectors\",\"location\":\"centralus\",\"tags\":{},\"systemData\":{\"createdBy\":\"c3d82ccb-fee1-430c-949e-6c0a217c00a8\",\"createdByType\":\"Application\",\"createdAt\":\"2023-12-11T18:52:24.9825323Z\",\"lastModifiedBy\":\"c3d82ccb-fee1-430c-949e-6c0a217c00a8\",\"lastModifiedByType\":\"Application\",\"lastModifiedAt\":\"2023-12-11T19:22:09.7886218Z\"}},{\"properties\":{\"offerings\":[{\"offeringType\":\"CspmMonitorGithub\"}],\"environmentName\":\"Github\",\"hierarchyIdentifier\":\"bc12ba4d-b89c-486e-85e1-d803e7d80525\",\"environmentData\":{\"environmentType\":\"GithubScope\"}},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourcegroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gh-01\",\"name\":\"dfdsdktests-gh-01\",\"type\":\"Microsoft.Security/securityconnectors\",\"location\":\"centralus\",\"tags\":{},\"systemData\":{\"createdBy\":\"c3d82ccb-fee1-430c-949e-6c0a217c00a8\",\"createdByType\":\"Application\",\"createdAt\":\"2023-12-11T19:31:38.6578077Z\",\"lastModifiedBy\":\"c3d82ccb-fee1-430c-949e-6c0a217c00a8\",\"lastModifiedByType\":\"Application\",\"lastModifiedAt\":\"2023-12-11T19:31:38.6578077Z\"}},{\"properties\":{\"offerings\":[{\"offeringType\":\"CspmMonitorGithub\"}],\"environmentName\":\"Github\",\"hierarchyIdentifier\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/securityConnectors-tests/providers/Microsoft.SecurityDevOps/gitHubConnectors/sdk_gh_test\",\"environmentData\":{\"environmentType\":\"GithubScope\"}},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourcegroups/securityconnectors-tests/providers/Microsoft.Security/securityConnectors/sdk_gh_test\",\"name\":\"sdk_gh_test\",\"type\":\"Microsoft.Security/securityconnectors\",\"location\":\"centralus\",\"tags\":{\"tagUpdateFromSdk\":\"ff962732-cf68-4379-87a8-53dc08c06071\"},\"systemData\":{\"createdBy\":\"elgrady@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-08-27T14:55:53.3654737Z\",\"lastModifiedBy\":\"c3d82ccb-fee1-430c-949e-6c0a217c00a8\",\"lastModifiedByType\":\"Application\",\"lastModifiedAt\":\"2023-08-27T15:25:33.5982713Z\"}}]}", + "isContentBase64": false + } + }, + "Get-AzSecurityConnector+[NoContext]+Get+$GET+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01?api-version=2023-10-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01?api-version=2023-10-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "8" ], + "x-ms-client-request-id": [ "1db5a8d4-df1f-4f2b-9605-36d63e88cc98" ], + "CommandName": [ "Get-AzSecurityConnector" ], + "FullCommandName": [ "Get-AzSecurityConnector_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Vary": [ "Accept-Encoding" ], + "x-ms-ratelimit-remaining-subscription-resource-requests": [ "99" ], + "x-ms-request-id": [ "bc81c1c2-bf07-49ec-9610-4eac3773bf33" ], + "x-ms-correlation-request-id": [ "bc81c1c2-bf07-49ec-9610-4eac3773bf33" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T020826Z:bc81c1c2-bf07-49ec-9610-4eac3773bf33" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: C0F90B78D6144B52A06CBE0AAF0F4F2A Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:08:26Z" ], + "Date": [ "Wed, 14 Feb 2024 02:08:26 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "832" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"offerings\":[{\"offeringType\":\"CspmMonitorAzureDevOps\"}],\"environmentName\":\"AzureDevOps\",\"hierarchyIdentifier\":\"4a8eb7f1-f533-48c5-b102-9b09e90906b7\",\"environmentData\":{\"environmentType\":\"AzureDevOpsScope\"}},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourcegroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01\",\"name\":\"dfdsdktests-azdo-01\",\"type\":\"Microsoft.Security/securityconnectors\",\"location\":\"centralus\",\"tags\":{\"pwshsdktest2\":\"true\"},\"systemData\":{\"createdBy\":\"c3d82ccb-fee1-430c-949e-6c0a217c00a8\",\"createdByType\":\"Application\",\"createdAt\":\"2023-12-07T06:38:36.3536844Z\",\"lastModifiedBy\":\"c3d82ccb-fee1-430c-949e-6c0a217c00a8\",\"lastModifiedByType\":\"Application\",\"lastModifiedAt\":\"2024-02-13T23:45:37.7516486Z\"}}", + "isContentBase64": false + } + }, + "Get-AzSecurityConnector+[NoContext]+GetViaIdentity+$GET+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01?api-version=2023-10-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01?api-version=2023-10-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "9" ], + "x-ms-client-request-id": [ "e6290598-2301-4b47-8c7a-38ba9ecbb179" ], + "CommandName": [ "Get-AzSecurityConnector" ], + "FullCommandName": [ "Get-AzSecurityConnector_GetViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Vary": [ "Accept-Encoding" ], + "x-ms-ratelimit-remaining-subscription-resource-requests": [ "99" ], + "x-ms-request-id": [ "5941b780-3816-4a3e-8828-60ac970c6665" ], + "x-ms-correlation-request-id": [ "5941b780-3816-4a3e-8828-60ac970c6665" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T020827Z:5941b780-3816-4a3e-8828-60ac970c6665" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: CC09CFD4D12F4B53B20A8A9295BF101A Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:08:27Z" ], + "Date": [ "Wed, 14 Feb 2024 02:08:27 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "832" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"offerings\":[{\"offeringType\":\"CspmMonitorAzureDevOps\"}],\"environmentName\":\"AzureDevOps\",\"hierarchyIdentifier\":\"4a8eb7f1-f533-48c5-b102-9b09e90906b7\",\"environmentData\":{\"environmentType\":\"AzureDevOpsScope\"}},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourcegroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01\",\"name\":\"dfdsdktests-azdo-01\",\"type\":\"Microsoft.Security/securityconnectors\",\"location\":\"centralus\",\"tags\":{\"pwshsdktest2\":\"true\"},\"systemData\":{\"createdBy\":\"c3d82ccb-fee1-430c-949e-6c0a217c00a8\",\"createdByType\":\"Application\",\"createdAt\":\"2023-12-07T06:38:36.3536844Z\",\"lastModifiedBy\":\"c3d82ccb-fee1-430c-949e-6c0a217c00a8\",\"lastModifiedByType\":\"Application\",\"lastModifiedAt\":\"2024-02-13T23:45:37.7516486Z\"}}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/test/Get-AzSecurityConnector.Tests.ps1 b/src/Security/Security.Autorest/test/Get-AzSecurityConnector.Tests.ps1 new file mode 100644 index 000000000000..a10fb1858e39 --- /dev/null +++ b/src/Security/Security.Autorest/test/Get-AzSecurityConnector.Tests.ps1 @@ -0,0 +1,45 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzSecurityConnector')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzSecurityConnector.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzSecurityConnector' { + It 'List' { + $rg = $env.SecurityConnectorsResourceGroupName + $connectors = Get-AzSecurityConnector -ResourceGroupName $rg + $connectors.Count | Should -BeGreaterThan 0 + } + + It 'ListBySubscription' { + $connectors = Get-AzSecurityConnector + $connectors.Count | Should -BeGreaterThan 0 + } + + It 'Get' { + $rg = $env.SecurityConnectorsResourceGroupName + $sid = $env.SubscriptionId + $connector = Get-AzSecurityConnector -SubscriptionId $sid -ResourceGroupName $rg -Name "dfdsdktests-azdo-01" + $connector | Should -Not -Be $null + $connector.Name.Contains('dfdsdktests-azdo-01') | Should -Be $true + } + + It 'GetViaIdentity' { + $rg = $env.SecurityConnectorsResourceGroupName + $sid = $env.SubscriptionId + $InputObject = @{Id = "/subscriptions/$sid/resourcegroups/$rg/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01" } + $connector = Get-AzSecurityConnector -InputObject $InputObject + $connector.Count | Should -Be 1 + $connector.Name.Contains('dfdsdktests-azdo-01') | Should -Be $true + } +} diff --git a/src/Security/Security.Autorest/test/Get-AzSecurityConnectorAzureDevOpsOrg.Recording.json b/src/Security/Security.Autorest/test/Get-AzSecurityConnectorAzureDevOpsOrg.Recording.json new file mode 100644 index 000000000000..cac85345e107 --- /dev/null +++ b/src/Security/Security.Autorest/test/Get-AzSecurityConnectorAzureDevOpsOrg.Recording.json @@ -0,0 +1,143 @@ +{ + "Get-AzSecurityConnectorAzureDevOpsOrg+[NoContext]+List+$GET+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs?api-version=2023-09-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs?api-version=2023-09-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "10" ], + "x-ms-client-request-id": [ "776a0918-bf64-4796-8062-1eee4275ad8f" ], + "CommandName": [ "Get-AzSecurityConnectorAzureDevOpsOrg" ], + "FullCommandName": [ "Get-AzSecurityConnectorAzureDevOpsOrg_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=14a5c7981ca45a6803ac375748e68dc9b495d4e56b3202b86256249c9784b400;Path=/;HttpOnly;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com", "ARRAffinitySameSite=14a5c7981ca45a6803ac375748e68dc9b495d4e56b3202b86256249c9784b400;Path=/;HttpOnly;SameSite=None;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "Request-Context": [ "appId=cid-v1:b8e19897-bfe4-49ad-ad76-b9526fa18eea" ], + "mise-correlation-id": [ "20cc6c93-cbe4-4b7b-bb42-61f1e9d55a7b" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-request-id": [ "1064b628-fba5-4a18-a8ea-1f78b468f00a" ], + "x-ms-correlation-request-id": [ "1064b628-fba5-4a18-a8ea-1f78b468f00a" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T020829Z:1064b628-fba5-4a18-a8ea-1f78b468f00a" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: DED889D13B854F35835FB3E5FB284245 Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:08:28Z" ], + "Date": [ "Wed, 14 Feb 2024 02:08:28 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "699" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"properties\":{\"onboardingState\":\"Onboarded\",\"actionableRemediation\":{\"state\":\"Enabled\",\"categoryConfigurations\":[{\"minimumSeverityLevel\":\"High\",\"category\":\"IaC\"}],\"branchConfiguration\":{\"branchNames\":[],\"annotateDefaultBranch\":\"Enabled\"},\"inheritFromParentState\":\"Disabled\"},\"provisioningStatusMessage\":\"OK\",\"provisioningStatusUpdateTimeUtc\":\"2024-02-14T00:31:18Z\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests\",\"name\":\"dfdsdktests\",\"type\":\"Microsoft.Security/securityConnectors/devops/azureDevOpsOrgs\"}]}", + "isContentBase64": false + } + }, + "Get-AzSecurityConnectorAzureDevOpsOrg+[NoContext]+Get+$GET+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests?api-version=2023-09-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests?api-version=2023-09-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "11" ], + "x-ms-client-request-id": [ "763f5309-a5a6-44e2-ad3b-12be8f6f35ab" ], + "CommandName": [ "Get-AzSecurityConnectorAzureDevOpsOrg" ], + "FullCommandName": [ "Get-AzSecurityConnectorAzureDevOpsOrg_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=1c6c7a0a18efcd0c1f62ff61ff05f8a61bfe22533cfce5122cfd179979045df0;Path=/;HttpOnly;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com", "ARRAffinitySameSite=1c6c7a0a18efcd0c1f62ff61ff05f8a61bfe22533cfce5122cfd179979045df0;Path=/;HttpOnly;SameSite=None;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "Request-Context": [ "appId=cid-v1:b8e19897-bfe4-49ad-ad76-b9526fa18eea" ], + "mise-correlation-id": [ "142d1c61-12e8-46aa-a425-072e85d8f7f4" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-request-id": [ "f67d706c-4d18-47e0-8ae8-9b9ca7b40a27" ], + "x-ms-correlation-request-id": [ "f67d706c-4d18-47e0-8ae8-9b9ca7b40a27" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T020829Z:f67d706c-4d18-47e0-8ae8-9b9ca7b40a27" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 31E4C8D153B04809BA5F2F24051ECD22 Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:08:29Z" ], + "Date": [ "Wed, 14 Feb 2024 02:08:29 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "687" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"onboardingState\":\"Onboarded\",\"actionableRemediation\":{\"state\":\"Enabled\",\"categoryConfigurations\":[{\"minimumSeverityLevel\":\"High\",\"category\":\"IaC\"}],\"branchConfiguration\":{\"branchNames\":[],\"annotateDefaultBranch\":\"Enabled\"},\"inheritFromParentState\":\"Disabled\"},\"provisioningStatusMessage\":\"OK\",\"provisioningStatusUpdateTimeUtc\":\"2024-02-14T00:31:18Z\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests\",\"name\":\"dfdsdktests\",\"type\":\"Microsoft.Security/securityConnectors/devops/azureDevOpsOrgs\"}", + "isContentBase64": false + } + }, + "Get-AzSecurityConnectorAzureDevOpsOrg+[NoContext]+GetViaIdentity+$GET+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests?api-version=2023-09-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests?api-version=2023-09-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "12" ], + "x-ms-client-request-id": [ "0e35f39f-3533-4076-aae4-fed262201caa" ], + "CommandName": [ "Get-AzSecurityConnectorAzureDevOpsOrg" ], + "FullCommandName": [ "Get-AzSecurityConnectorAzureDevOpsOrg_GetViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=14a5c7981ca45a6803ac375748e68dc9b495d4e56b3202b86256249c9784b400;Path=/;HttpOnly;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com", "ARRAffinitySameSite=14a5c7981ca45a6803ac375748e68dc9b495d4e56b3202b86256249c9784b400;Path=/;HttpOnly;SameSite=None;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "Request-Context": [ "appId=cid-v1:b8e19897-bfe4-49ad-ad76-b9526fa18eea" ], + "mise-correlation-id": [ "8d2beff5-6809-44b0-9d0a-88fe5ef949d9" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-request-id": [ "9413f92c-7a08-4d0e-a2a7-afb1d3a8915b" ], + "x-ms-correlation-request-id": [ "9413f92c-7a08-4d0e-a2a7-afb1d3a8915b" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T020830Z:9413f92c-7a08-4d0e-a2a7-afb1d3a8915b" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: D55FF7CA6A304457B6C28720DE3E554E Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:08:30Z" ], + "Date": [ "Wed, 14 Feb 2024 02:08:29 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "687" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"onboardingState\":\"Onboarded\",\"actionableRemediation\":{\"state\":\"Enabled\",\"categoryConfigurations\":[{\"minimumSeverityLevel\":\"High\",\"category\":\"IaC\"}],\"branchConfiguration\":{\"branchNames\":[],\"annotateDefaultBranch\":\"Enabled\"},\"inheritFromParentState\":\"Disabled\"},\"provisioningStatusMessage\":\"OK\",\"provisioningStatusUpdateTimeUtc\":\"2024-02-14T00:31:18Z\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests\",\"name\":\"dfdsdktests\",\"type\":\"Microsoft.Security/securityConnectors/devops/azureDevOpsOrgs\"}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/test/Get-AzSecurityConnectorAzureDevOpsOrg.Tests.ps1 b/src/Security/Security.Autorest/test/Get-AzSecurityConnectorAzureDevOpsOrg.Tests.ps1 new file mode 100644 index 000000000000..d2dd848ee5ab --- /dev/null +++ b/src/Security/Security.Autorest/test/Get-AzSecurityConnectorAzureDevOpsOrg.Tests.ps1 @@ -0,0 +1,41 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzSecurityConnectorAzureDevOpsOrg')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzSecurityConnectorAzureDevOpsOrg.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzSecurityConnectorAzureDevOpsOrg' { + It 'List' { + $rg = $env.SecurityConnectorsResourceGroupName + $sid = $env.SubscriptionId + $orgs = Get-AzSecurityConnectorAzureDevOpsOrg -SubscriptionId $sid -ResourceGroupName $rg -SecurityConnectorName "dfdsdktests-azdo-01" + $orgs.Count | Should -BeGreaterThan 0 + } + + It 'Get' { + $rg = $env.SecurityConnectorsResourceGroupName + $sid = $env.SubscriptionId + $org = Get-AzSecurityConnectorAzureDevOpsOrg -SubscriptionId $sid -ResourceGroupName $rg -SecurityConnectorName "dfdsdktests-azdo-01" -OrgName "dfdsdktests" + $org | Should -Not -Be $null + $org.Name.Contains('dfdsdktests') | Should -Be $true + } + + It 'GetViaIdentity' { + $rg = $env.SecurityConnectorsResourceGroupName + $sid = $env.SubscriptionId + $InputObject = @{Id = "/subscriptions/$sid/resourcegroups/$rg/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests" } + $org = Get-AzSecurityConnectorAzureDevOpsOrg -InputObject $InputObject + $org.Count | Should -Be 1 + $org.Name.Contains('dfdsdktests') | Should -Be $true + } +} diff --git a/src/Security/Security.Autorest/test/Get-AzSecurityConnectorAzureDevOpsOrgAvailable.Recording.json b/src/Security/Security.Autorest/test/Get-AzSecurityConnectorAzureDevOpsOrgAvailable.Recording.json new file mode 100644 index 000000000000..cdf4b677593a --- /dev/null +++ b/src/Security/Security.Autorest/test/Get-AzSecurityConnectorAzureDevOpsOrgAvailable.Recording.json @@ -0,0 +1,49 @@ +{ + "Get-AzSecurityConnectorAzureDevOpsOrgAvailable+[NoContext]+List+$POST+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/listAvailableAzureDevOpsOrgs?api-version=2023-09-01-preview+1": { + "Request": { + "Method": "POST", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/listAvailableAzureDevOpsOrgs?api-version=2023-09-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "13" ], + "x-ms-client-request-id": [ "e7eedea7-9b07-4739-8daf-8a1816315f9a" ], + "CommandName": [ "Get-AzSecurityConnectorAzureDevOpsOrgAvailable" ], + "FullCommandName": [ "Get-AzSecurityConnectorAzureDevOpsOrgAvailable_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=14a5c7981ca45a6803ac375748e68dc9b495d4e56b3202b86256249c9784b400;Path=/;HttpOnly;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com", "ARRAffinitySameSite=14a5c7981ca45a6803ac375748e68dc9b495d4e56b3202b86256249c9784b400;Path=/;HttpOnly;SameSite=None;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1199" ], + "Request-Context": [ "appId=cid-v1:b8e19897-bfe4-49ad-ad76-b9526fa18eea" ], + "mise-correlation-id": [ "ed236c60-094b-407a-b8bc-4f4245efb171" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-request-id": [ "22bfb24a-c8a1-4f3b-b80e-975960d5fa1b" ], + "x-ms-correlation-request-id": [ "22bfb24a-c8a1-4f3b-b80e-975960d5fa1b" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T020832Z:22bfb24a-c8a1-4f3b-b80e-975960d5fa1b" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 8E234E82511149A58D720AEC836BF9EF Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:08:30Z" ], + "Date": [ "Wed, 14 Feb 2024 02:08:32 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "699" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"properties\":{\"onboardingState\":\"Onboarded\",\"actionableRemediation\":{\"state\":\"Enabled\",\"categoryConfigurations\":[{\"minimumSeverityLevel\":\"High\",\"category\":\"IaC\"}],\"branchConfiguration\":{\"branchNames\":[],\"annotateDefaultBranch\":\"Enabled\"},\"inheritFromParentState\":\"Disabled\"},\"provisioningStatusMessage\":\"OK\",\"provisioningStatusUpdateTimeUtc\":\"2024-02-14T00:31:18Z\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests\",\"name\":\"dfdsdktests\",\"type\":\"Microsoft.Security/securityConnectors/devops/azureDevOpsOrgs\"}]}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/test/Get-AzSecurityConnectorAzureDevOpsOrgAvailable.Tests.ps1 b/src/Security/Security.Autorest/test/Get-AzSecurityConnectorAzureDevOpsOrgAvailable.Tests.ps1 new file mode 100644 index 000000000000..0c4149c22591 --- /dev/null +++ b/src/Security/Security.Autorest/test/Get-AzSecurityConnectorAzureDevOpsOrgAvailable.Tests.ps1 @@ -0,0 +1,24 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzSecurityConnectorAzureDevOpsOrgAvailable')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzSecurityConnectorAzureDevOpsOrgAvailable.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzSecurityConnectorAzureDevOpsOrgAvailable' { + It 'List' { + $rg = $env.SecurityConnectorsResourceGroupName + $sid = $env.SubscriptionId + $orgs = Get-AzSecurityConnectorAzureDevOpsOrgAvailable -SubscriptionId $sid -ResourceGroupName $rg -SecurityConnectorName "dfdsdktests-azdo-01" + $orgs.Count | Should -BeGreaterThan 0 + } +} diff --git a/src/Security/Security.Autorest/test/Get-AzSecurityConnectorAzureDevOpsProject.Recording.json b/src/Security/Security.Autorest/test/Get-AzSecurityConnectorAzureDevOpsProject.Recording.json new file mode 100644 index 000000000000..cfb103f07c72 --- /dev/null +++ b/src/Security/Security.Autorest/test/Get-AzSecurityConnectorAzureDevOpsProject.Recording.json @@ -0,0 +1,143 @@ +{ + "Get-AzSecurityConnectorAzureDevOpsProject+[NoContext]+List+$GET+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests/projects?api-version=2023-09-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests/projects?api-version=2023-09-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "14" ], + "x-ms-client-request-id": [ "d653caa3-a460-401f-8e57-20c63e529982" ], + "CommandName": [ "Get-AzSecurityConnectorAzureDevOpsProject" ], + "FullCommandName": [ "Get-AzSecurityConnectorAzureDevOpsProject_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=b0d653e3d2c4fba6e75578139341b84b35dee63a8a317f007b2447d8196b79e5;Path=/;HttpOnly;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com", "ARRAffinitySameSite=b0d653e3d2c4fba6e75578139341b84b35dee63a8a317f007b2447d8196b79e5;Path=/;HttpOnly;SameSite=None;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "Request-Context": [ "appId=cid-v1:b8e19897-bfe4-49ad-ad76-b9526fa18eea" ], + "mise-correlation-id": [ "7886f7b4-a957-4e94-9157-2c22153a727c" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-request-id": [ "43a50eae-bebe-4910-aa0b-f7ba214d6711" ], + "x-ms-correlation-request-id": [ "43a50eae-bebe-4910-aa0b-f7ba214d6711" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T020833Z:43a50eae-bebe-4910-aa0b-f7ba214d6711" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: DEA863CCD3F94022A81D4B84C67AB687 Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:08:33Z" ], + "Date": [ "Wed, 14 Feb 2024 02:08:32 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1625" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"properties\":{\"parentOrgName\":\"dfdsdktests\",\"projectId\":\"161fb6f6-f2fe-4616-a627-293b788ff583\",\"onboardingState\":\"Onboarded\",\"actionableRemediation\":{\"state\":\"Enabled\",\"categoryConfigurations\":[{\"minimumSeverityLevel\":\"High\",\"category\":\"IaC\"}],\"branchConfiguration\":{\"branchNames\":[],\"annotateDefaultBranch\":\"Enabled\"},\"inheritFromParentState\":\"Disabled\"},\"provisioningStatusMessage\":\"OK\",\"provisioningStatusUpdateTimeUtc\":\"2024-02-14T00:34:19Z\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests/projects/ContosoSDKDfd\",\"name\":\"ContosoSDKDfd\",\"type\":\"Microsoft.Security/securityConnectors/devops/azureDevOpsOrgs/projects\"},{\"properties\":{\"parentOrgName\":\"dfdsdktests\",\"projectId\":\"d68aef73-e155-400d-a60f-617fb8b54773\",\"onboardingState\":\"Onboarded\",\"actionableRemediation\":{\"state\":\"Enabled\",\"categoryConfigurations\":[{\"minimumSeverityLevel\":\"High\",\"category\":\"IaC\"}],\"branchConfiguration\":{\"branchNames\":[],\"annotateDefaultBranch\":\"Enabled\"},\"inheritFromParentState\":\"Disabled\"},\"provisioningStatusMessage\":\"OK\",\"provisioningStatusUpdateTimeUtc\":\"2024-02-14T00:34:19Z\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests/projects/ContosoEnterprise\",\"name\":\"ContosoEnterprise\",\"type\":\"Microsoft.Security/securityConnectors/devops/azureDevOpsOrgs/projects\"}]}", + "isContentBase64": false + } + }, + "Get-AzSecurityConnectorAzureDevOpsProject+[NoContext]+Get+$GET+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests/projects/ContosoSDKDfd?api-version=2023-09-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests/projects/ContosoSDKDfd?api-version=2023-09-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "15" ], + "x-ms-client-request-id": [ "2e0acc90-e3cd-4fa6-9eb9-fe94e884966d" ], + "CommandName": [ "Get-AzSecurityConnectorAzureDevOpsProject" ], + "FullCommandName": [ "Get-AzSecurityConnectorAzureDevOpsProject_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=1c6c7a0a18efcd0c1f62ff61ff05f8a61bfe22533cfce5122cfd179979045df0;Path=/;HttpOnly;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com", "ARRAffinitySameSite=1c6c7a0a18efcd0c1f62ff61ff05f8a61bfe22533cfce5122cfd179979045df0;Path=/;HttpOnly;SameSite=None;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "Request-Context": [ "appId=cid-v1:b8e19897-bfe4-49ad-ad76-b9526fa18eea" ], + "mise-correlation-id": [ "4a2df027-c8c8-4361-a30d-01bc750319c8" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-request-id": [ "ffc6b6b1-84d3-425e-947a-21d0e31c4213" ], + "x-ms-correlation-request-id": [ "ffc6b6b1-84d3-425e-947a-21d0e31c4213" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T020834Z:ffc6b6b1-84d3-425e-947a-21d0e31c4213" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 9BCB9D0E5B8D4F2D9830533E9EE5B179 Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:08:33Z" ], + "Date": [ "Wed, 14 Feb 2024 02:08:34 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "802" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"parentOrgName\":\"dfdsdktests\",\"projectId\":\"161fb6f6-f2fe-4616-a627-293b788ff583\",\"onboardingState\":\"Onboarded\",\"actionableRemediation\":{\"state\":\"Enabled\",\"categoryConfigurations\":[{\"minimumSeverityLevel\":\"High\",\"category\":\"IaC\"}],\"branchConfiguration\":{\"branchNames\":[],\"annotateDefaultBranch\":\"Enabled\"},\"inheritFromParentState\":\"Disabled\"},\"provisioningStatusMessage\":\"OK\",\"provisioningStatusUpdateTimeUtc\":\"2024-02-14T00:34:19Z\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests/projects/ContosoSDKDfd\",\"name\":\"ContosoSDKDfd\",\"type\":\"Microsoft.Security/securityConnectors/devops/azureDevOpsOrgs/projects\"}", + "isContentBase64": false + } + }, + "Get-AzSecurityConnectorAzureDevOpsProject+[NoContext]+GetViaIdentity+$GET+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests/projects/ContosoSDKDfd?api-version=2023-09-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests/projects/ContosoSDKDfd?api-version=2023-09-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "16" ], + "x-ms-client-request-id": [ "dbdb4e2f-346e-4337-9c8e-ed6334f425a4" ], + "CommandName": [ "Get-AzSecurityConnectorAzureDevOpsProject" ], + "FullCommandName": [ "Get-AzSecurityConnectorAzureDevOpsProject_GetViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=14a5c7981ca45a6803ac375748e68dc9b495d4e56b3202b86256249c9784b400;Path=/;HttpOnly;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com", "ARRAffinitySameSite=14a5c7981ca45a6803ac375748e68dc9b495d4e56b3202b86256249c9784b400;Path=/;HttpOnly;SameSite=None;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "Request-Context": [ "appId=cid-v1:b8e19897-bfe4-49ad-ad76-b9526fa18eea" ], + "mise-correlation-id": [ "288f672b-80bd-478b-a0e2-bedd810c1267" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-request-id": [ "2fefbfc1-d34f-4cd7-9a01-9c2497222be9" ], + "x-ms-correlation-request-id": [ "2fefbfc1-d34f-4cd7-9a01-9c2497222be9" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T020835Z:2fefbfc1-d34f-4cd7-9a01-9c2497222be9" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: B8FCE940576D4A0BA74C0A2D0379D8E4 Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:08:34Z" ], + "Date": [ "Wed, 14 Feb 2024 02:08:34 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "802" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"parentOrgName\":\"dfdsdktests\",\"projectId\":\"161fb6f6-f2fe-4616-a627-293b788ff583\",\"onboardingState\":\"Onboarded\",\"actionableRemediation\":{\"state\":\"Enabled\",\"categoryConfigurations\":[{\"minimumSeverityLevel\":\"High\",\"category\":\"IaC\"}],\"branchConfiguration\":{\"branchNames\":[],\"annotateDefaultBranch\":\"Enabled\"},\"inheritFromParentState\":\"Disabled\"},\"provisioningStatusMessage\":\"OK\",\"provisioningStatusUpdateTimeUtc\":\"2024-02-14T00:34:19Z\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests/projects/ContosoSDKDfd\",\"name\":\"ContosoSDKDfd\",\"type\":\"Microsoft.Security/securityConnectors/devops/azureDevOpsOrgs/projects\"}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/test/Get-AzSecurityConnectorAzureDevOpsProject.Tests.ps1 b/src/Security/Security.Autorest/test/Get-AzSecurityConnectorAzureDevOpsProject.Tests.ps1 new file mode 100644 index 000000000000..6aff01283e05 --- /dev/null +++ b/src/Security/Security.Autorest/test/Get-AzSecurityConnectorAzureDevOpsProject.Tests.ps1 @@ -0,0 +1,41 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzSecurityConnectorAzureDevOpsProject')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzSecurityConnectorAzureDevOpsProject.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzSecurityConnectorAzureDevOpsProject' { + It 'List' { + $rg = $env.SecurityConnectorsResourceGroupName + $sid = $env.SubscriptionId + $projects = Get-AzSecurityConnectorAzureDevOpsProject -SubscriptionId $sid -ResourceGroupName $rg -SecurityConnectorName "dfdsdktests-azdo-01" -OrgName "dfdsdktests" + $projects.Count | Should -BeGreaterThan 0 + } + + It 'Get' { + $rg = $env.SecurityConnectorsResourceGroupName + $sid = $env.SubscriptionId + $project = Get-AzSecurityConnectorAzureDevOpsProject -SubscriptionId $sid -ResourceGroupName $rg -SecurityConnectorName "dfdsdktests-azdo-01" -OrgName "dfdsdktests" -ProjectName "ContosoSDKDfd" + $project | Should -Not -Be $null + $project.Name.Contains('ContosoSDKDfd') | Should -Be $true + } + + It 'GetViaIdentity' { + $rg = $env.SecurityConnectorsResourceGroupName + $sid = $env.SubscriptionId + $InputObject = @{Id = "/subscriptions/$sid/resourcegroups/$rg/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests/projects/ContosoSDKDfd" } + $project = Get-AzSecurityConnectorAzureDevOpsProject -InputObject $InputObject + $project.Count | Should -Be 1 + $project.Name.Contains('ContosoSDKDfd') | Should -Be $true + } +} diff --git a/src/Security/Security.Autorest/test/Get-AzSecurityConnectorAzureDevOpsRepo.Recording.json b/src/Security/Security.Autorest/test/Get-AzSecurityConnectorAzureDevOpsRepo.Recording.json new file mode 100644 index 000000000000..ab3bd08ceeb9 --- /dev/null +++ b/src/Security/Security.Autorest/test/Get-AzSecurityConnectorAzureDevOpsRepo.Recording.json @@ -0,0 +1,190 @@ +{ + "Get-AzSecurityConnectorAzureDevOpsRepo+[NoContext]+List+$GET+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests/projects/ContosoSDKDfd/repos?api-version=2023-09-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests/projects/ContosoSDKDfd/repos?api-version=2023-09-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "17" ], + "x-ms-client-request-id": [ "9558e794-b6e0-4245-ad7e-99a589307e08" ], + "CommandName": [ "Get-AzSecurityConnectorAzureDevOpsRepo" ], + "FullCommandName": [ "Get-AzSecurityConnectorAzureDevOpsRepo_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=b0d653e3d2c4fba6e75578139341b84b35dee63a8a317f007b2447d8196b79e5;Path=/;HttpOnly;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com", "ARRAffinitySameSite=b0d653e3d2c4fba6e75578139341b84b35dee63a8a317f007b2447d8196b79e5;Path=/;HttpOnly;SameSite=None;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "Request-Context": [ "appId=cid-v1:b8e19897-bfe4-49ad-ad76-b9526fa18eea" ], + "mise-correlation-id": [ "1fbff945-4344-4882-b3b9-53d8b84c3ddd" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-request-id": [ "1ad617b3-5ee4-4517-893a-563144994b22" ], + "x-ms-correlation-request-id": [ "1ad617b3-5ee4-4517-893a-563144994b22" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T020836Z:1ad617b3-5ee4-4517-893a-563144994b22" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: BDE645F1B6C24AD0B14DAEE42E58248E Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:08:35Z" ], + "Date": [ "Wed, 14 Feb 2024 02:08:36 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "9840" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"properties\":{\"parentOrgName\":\"dfdsdktests\",\"parentProjectName\":\"ContosoSDKDfd\",\"repoId\":\"22a344e3-8ad3-4a97-88a6-768a4e710777\",\"repoUrl\":\"https://dev.azure.com/dfdsdktests/ContosoSDKDfd/_git/ContosoSDKDfd\",\"onboardingState\":\"Onboarded\",\"actionableRemediation\":{\"state\":\"Enabled\",\"categoryConfigurations\":[{\"minimumSeverityLevel\":\"High\",\"category\":\"IaC\"}],\"branchConfiguration\":{\"branchNames\":[],\"annotateDefaultBranch\":\"Enabled\"},\"inheritFromParentState\":\"Enabled\"},\"provisioningStatusMessage\":\"OK\",\"provisioningStatusUpdateTimeUtc\":\"2024-02-14T00:34:19Z\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests/projects/ContosoSDKDfd/repos/ContosoSDKDfd\",\"name\":\"ContosoSDKDfd\",\"type\":\"Microsoft.Security/securityConnectors/devops/azureDevOpsOrgs/projects/repos\"},{\"properties\":{\"parentOrgName\":\"dfdsdktests\",\"parentProjectName\":\"ContosoSDKDfd\",\"repoId\":\"35cd4811-63c7-4043-8587-f0a9cf37709e\",\"repoUrl\":\"https://dev.azure.com/dfdsdktests/ContosoSDKDfd/_git/TestApp0\",\"onboardingState\":\"Onboarded\",\"actionableRemediation\":{\"state\":\"Enabled\",\"categoryConfigurations\":[{\"minimumSeverityLevel\":\"High\",\"category\":\"IaC\"}],\"branchConfiguration\":{\"branchNames\":[],\"annotateDefaultBranch\":\"Enabled\"},\"inheritFromParentState\":\"Enabled\"},\"provisioningStatusMessage\":\"OK\",\"provisioningStatusUpdateTimeUtc\":\"2024-02-14T00:34:19Z\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests/projects/ContosoSDKDfd/repos/TestApp0\",\"name\":\"TestApp0\",\"type\":\"Microsoft.Security/securityConnectors/devops/azureDevOpsOrgs/projects/repos\"},{\"properties\":{\"parentOrgName\":\"dfdsdktests\",\"parentProjectName\":\"ContosoSDKDfd\",\"repoId\":\"77c1e69a-41a5-4de7-8b9c-0acab45f5bca\",\"repoUrl\":\"https://dev.azure.com/dfdsdktests/ContosoSDKDfd/_git/TestApp2\",\"onboardingState\":\"Onboarded\",\"actionableRemediation\":{\"state\":\"Enabled\",\"categoryConfigurations\":[{\"minimumSeverityLevel\":\"High\",\"category\":\"IaC\"}],\"branchConfiguration\":{\"branchNames\":[],\"annotateDefaultBranch\":\"Enabled\"},\"inheritFromParentState\":\"Enabled\"},\"provisioningStatusMessage\":\"OK\",\"provisioningStatusUpdateTimeUtc\":\"2024-02-14T00:34:19Z\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests/projects/ContosoSDKDfd/repos/TestApp2\",\"name\":\"TestApp2\",\"type\":\"Microsoft.Security/securityConnectors/devops/azureDevOpsOrgs/projects/repos\"},{\"properties\":{\"parentOrgName\":\"dfdsdktests\",\"parentProjectName\":\"ContosoSDKDfd\",\"repoId\":\"e42d18c5-0cef-4f19-9b09-3e2ab58e9be6\",\"repoUrl\":\"https://dev.azure.com/dfdsdktests/ContosoSDKDfd/_git/TestApp5\",\"onboardingState\":\"Onboarded\",\"actionableRemediation\":{\"state\":\"Enabled\",\"categoryConfigurations\":[{\"minimumSeverityLevel\":\"High\",\"category\":\"IaC\"}],\"branchConfiguration\":{\"branchNames\":[],\"annotateDefaultBranch\":\"Enabled\"},\"inheritFromParentState\":\"Enabled\"},\"provisioningStatusMessage\":\"OK\",\"provisioningStatusUpdateTimeUtc\":\"2024-02-14T00:34:19Z\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests/projects/ContosoSDKDfd/repos/TestApp5\",\"name\":\"TestApp5\",\"type\":\"Microsoft.Security/securityConnectors/devops/azureDevOpsOrgs/projects/repos\"},{\"properties\":{\"parentOrgName\":\"dfdsdktests\",\"parentProjectName\":\"ContosoSDKDfd\",\"repoId\":\"0d2570d8-0dfd-480a-93c4-4b945d4bd240\",\"repoUrl\":\"https://dev.azure.com/dfdsdktests/ContosoSDKDfd/_git/TestApp8\",\"onboardingState\":\"Onboarded\",\"actionableRemediation\":{\"state\":\"Enabled\",\"categoryConfigurations\":[{\"minimumSeverityLevel\":\"High\",\"category\":\"IaC\"}],\"branchConfiguration\":{\"branchNames\":[],\"annotateDefaultBranch\":\"Enabled\"},\"inheritFromParentState\":\"Enabled\"},\"provisioningStatusMessage\":\"OK\",\"provisioningStatusUpdateTimeUtc\":\"2024-02-14T00:34:19Z\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests/projects/ContosoSDKDfd/repos/TestApp8\",\"name\":\"TestApp8\",\"type\":\"Microsoft.Security/securityConnectors/devops/azureDevOpsOrgs/projects/repos\"},{\"properties\":{\"parentOrgName\":\"dfdsdktests\",\"parentProjectName\":\"ContosoSDKDfd\",\"repoId\":\"36b0a509-f1d8-4d7a-82f7-66493fbcc766\",\"repoUrl\":\"https://dev.azure.com/dfdsdktests/ContosoSDKDfd/_git/TestApp6\",\"onboardingState\":\"Onboarded\",\"actionableRemediation\":{\"state\":\"Enabled\",\"categoryConfigurations\":[{\"minimumSeverityLevel\":\"High\",\"category\":\"IaC\"}],\"branchConfiguration\":{\"branchNames\":[],\"annotateDefaultBranch\":\"Enabled\"},\"inheritFromParentState\":\"Enabled\"},\"provisioningStatusMessage\":\"OK\",\"provisioningStatusUpdateTimeUtc\":\"2024-02-14T00:34:19Z\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests/projects/ContosoSDKDfd/repos/TestApp6\",\"name\":\"TestApp6\",\"type\":\"Microsoft.Security/securityConnectors/devops/azureDevOpsOrgs/projects/repos\"},{\"properties\":{\"parentOrgName\":\"dfdsdktests\",\"parentProjectName\":\"ContosoSDKDfd\",\"repoId\":\"cece391b-987e-4418-9091-69c009c076a2\",\"repoUrl\":\"https://dev.azure.com/dfdsdktests/ContosoSDKDfd/_git/TestApp1\",\"onboardingState\":\"Onboarded\",\"actionableRemediation\":{\"state\":\"Enabled\",\"categoryConfigurations\":[{\"minimumSeverityLevel\":\"High\",\"category\":\"IaC\"}],\"branchConfiguration\":{\"branchNames\":[],\"annotateDefaultBranch\":\"Enabled\"},\"inheritFromParentState\":\"Enabled\"},\"provisioningStatusMessage\":\"OK\",\"provisioningStatusUpdateTimeUtc\":\"2024-02-14T00:34:19Z\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests/projects/ContosoSDKDfd/repos/TestApp1\",\"name\":\"TestApp1\",\"type\":\"Microsoft.Security/securityConnectors/devops/azureDevOpsOrgs/projects/repos\"},{\"properties\":{\"parentOrgName\":\"dfdsdktests\",\"parentProjectName\":\"ContosoSDKDfd\",\"repoId\":\"7b15f005-9985-44b3-b6ef-7c1b50400f1f\",\"repoUrl\":\"https://dev.azure.com/dfdsdktests/ContosoSDKDfd/_git/TestApp9\",\"onboardingState\":\"Onboarded\",\"actionableRemediation\":{\"state\":\"Enabled\",\"categoryConfigurations\":[{\"minimumSeverityLevel\":\"High\",\"category\":\"IaC\"}],\"branchConfiguration\":{\"branchNames\":[],\"annotateDefaultBranch\":\"Enabled\"},\"inheritFromParentState\":\"Enabled\"},\"provisioningStatusMessage\":\"OK\",\"provisioningStatusUpdateTimeUtc\":\"2024-02-14T00:34:19Z\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests/projects/ContosoSDKDfd/repos/TestApp9\",\"name\":\"TestApp9\",\"type\":\"Microsoft.Security/securityConnectors/devops/azureDevOpsOrgs/projects/repos\"},{\"properties\":{\"parentOrgName\":\"dfdsdktests\",\"parentProjectName\":\"ContosoSDKDfd\",\"repoId\":\"e6fdca92-f9f8-4d62-a327-840ed4fa6c54\",\"repoUrl\":\"https://dev.azure.com/dfdsdktests/ContosoSDKDfd/_git/TestApp4\",\"onboardingState\":\"Onboarded\",\"actionableRemediation\":{\"state\":\"Enabled\",\"categoryConfigurations\":[{\"minimumSeverityLevel\":\"High\",\"category\":\"IaC\"}],\"branchConfiguration\":{\"branchNames\":[],\"annotateDefaultBranch\":\"Enabled\"},\"inheritFromParentState\":\"Enabled\"},\"provisioningStatusMessage\":\"OK\",\"provisioningStatusUpdateTimeUtc\":\"2024-02-14T00:34:19Z\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests/projects/ContosoSDKDfd/repos/TestApp4\",\"name\":\"TestApp4\",\"type\":\"Microsoft.Security/securityConnectors/devops/azureDevOpsOrgs/projects/repos\"},{\"properties\":{\"parentOrgName\":\"dfdsdktests\",\"parentProjectName\":\"ContosoSDKDfd\",\"repoId\":\"7ae95dbf-2233-454a-930b-9a23039d9af2\",\"repoUrl\":\"https://dev.azure.com/dfdsdktests/ContosoSDKDfd/_git/TestApp7\",\"onboardingState\":\"Onboarded\",\"actionableRemediation\":{\"state\":\"Enabled\",\"categoryConfigurations\":[{\"minimumSeverityLevel\":\"High\",\"category\":\"IaC\"}],\"branchConfiguration\":{\"branchNames\":[],\"annotateDefaultBranch\":\"Enabled\"},\"inheritFromParentState\":\"Enabled\"},\"provisioningStatusMessage\":\"OK\",\"provisioningStatusUpdateTimeUtc\":\"2024-02-14T00:34:19Z\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests/projects/ContosoSDKDfd/repos/TestApp7\",\"name\":\"TestApp7\",\"type\":\"Microsoft.Security/securityConnectors/devops/azureDevOpsOrgs/projects/repos\"}],\"nextLink\":\"https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests/projects/ContosoSDKDfd/repos?api-version=2023-09-01-preview\\u0026continuation-token=eyJPcHRpbWlzdGljRGlyZWN0RXhlY3V0aW9uVG9rZW4iOnsidG9rZW4iOiIrUklEOn42RElDQUxFR1p5aXZTUVFBQUFBQURBPT0jUlQ6MSNUUkM6MTAjSVNWOjIjSUVPOjY1NTY3I1FDRjo4I0ZQQzpBYTlKQkFBQUFBQU1zVWtFQUFBQUFBdz0iLCJyYW5nZSI6eyJtaW4iOiIwNUMxRTVCNUUzNkY4NiIsIm1heCI6IkZGIn19fQ==\"}", + "isContentBase64": false + } + }, + "Get-AzSecurityConnectorAzureDevOpsRepo+[NoContext]+List+$GET+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests/projects/ContosoSDKDfd/repos?api-version=2023-09-01-preview\u0026continuation-token=eyJPcHRpbWlzdGljRGlyZWN0RXhlY3V0aW9uVG9rZW4iOnsidG9rZW4iOiIrUklEOn42RElDQUxFR1p5aXZTUVFBQUFBQURBPT0jUlQ6MSNUUkM6MTAjSVNWOjIjSUVPOjY1NTY3I1FDRjo4I0ZQQzpBYTlKQkFBQUFBQU1zVWtFQUFBQUFBdz0iLCJyYW5nZSI6eyJtaW4iOiIwNUMxRTVCNUUzNkY4NiIsIm1heCI6IkZGIn19fQ==+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests/projects/ContosoSDKDfd/repos?api-version=2023-09-01-preview\u0026continuation-token=eyJPcHRpbWlzdGljRGlyZWN0RXhlY3V0aW9uVG9rZW4iOnsidG9rZW4iOiIrUklEOn42RElDQUxFR1p5aXZTUVFBQUFBQURBPT0jUlQ6MSNUUkM6MTAjSVNWOjIjSUVPOjY1NTY3I1FDRjo4I0ZQQzpBYTlKQkFBQUFBQU1zVWtFQUFBQUFBdz0iLCJyYW5nZSI6eyJtaW4iOiIwNUMxRTVCNUUzNkY4NiIsIm1heCI6IkZGIn19fQ==", + "Content": null, + "isContentBase64": false, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "18" ], + "x-ms-client-request-id": [ "9558e794-b6e0-4245-ad7e-99a589307e08" ], + "CommandName": [ "Get-AzSecurityConnectorAzureDevOpsRepo" ], + "FullCommandName": [ "Get-AzSecurityConnectorAzureDevOpsRepo_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=ca594a79766484e25889904bf326227201e6905138dd325ca221b8b7af91ccae;Path=/;HttpOnly;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com", "ARRAffinitySameSite=ca594a79766484e25889904bf326227201e6905138dd325ca221b8b7af91ccae;Path=/;HttpOnly;SameSite=None;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "Request-Context": [ "appId=cid-v1:b8e19897-bfe4-49ad-ad76-b9526fa18eea" ], + "mise-correlation-id": [ "b27f6e6b-b7d6-4466-aa84-48797b8c2b28" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-request-id": [ "5f49fd83-75aa-44ad-baeb-4a444c354297" ], + "x-ms-correlation-request-id": [ "5f49fd83-75aa-44ad-baeb-4a444c354297" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T020837Z:5f49fd83-75aa-44ad-baeb-4a444c354297" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 8EDF57E486E3420F8C90623CC06F9586 Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:08:36Z" ], + "Date": [ "Wed, 14 Feb 2024 02:08:36 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1864" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"properties\":{\"parentOrgName\":\"dfdsdktests\",\"parentProjectName\":\"ContosoSDKDfd\",\"repoId\":\"c52cd770-0ef6-44c1-8d7f-a631dda6f3d6\",\"repoUrl\":\"https://dev.azure.com/dfdsdktests/ContosoSDKDfd/_git/TestApp10\",\"onboardingState\":\"Onboarded\",\"actionableRemediation\":{\"state\":\"Enabled\",\"categoryConfigurations\":[{\"minimumSeverityLevel\":\"High\",\"category\":\"IaC\"}],\"branchConfiguration\":{\"branchNames\":[],\"annotateDefaultBranch\":\"Enabled\"},\"inheritFromParentState\":\"Enabled\"},\"provisioningStatusMessage\":\"OK\",\"provisioningStatusUpdateTimeUtc\":\"2024-02-14T00:34:19Z\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests/projects/ContosoSDKDfd/repos/TestApp10\",\"name\":\"TestApp10\",\"type\":\"Microsoft.Security/securityConnectors/devops/azureDevOpsOrgs/projects/repos\"},{\"properties\":{\"parentOrgName\":\"dfdsdktests\",\"parentProjectName\":\"ContosoSDKDfd\",\"repoId\":\"53065519-b543-47e3-941b-d38608f985fa\",\"repoUrl\":\"https://dev.azure.com/dfdsdktests/ContosoSDKDfd/_git/TestApp3\",\"onboardingState\":\"Onboarded\",\"actionableRemediation\":{\"state\":\"Enabled\",\"categoryConfigurations\":[{\"minimumSeverityLevel\":\"High\",\"category\":\"IaC\"}],\"branchConfiguration\":{\"branchNames\":[],\"annotateDefaultBranch\":\"Enabled\"},\"inheritFromParentState\":\"Enabled\"},\"provisioningStatusMessage\":\"OK\",\"provisioningStatusUpdateTimeUtc\":\"2024-02-14T00:34:19Z\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests/projects/ContosoSDKDfd/repos/TestApp3\",\"name\":\"TestApp3\",\"type\":\"Microsoft.Security/securityConnectors/devops/azureDevOpsOrgs/projects/repos\"}]}", + "isContentBase64": false + } + }, + "Get-AzSecurityConnectorAzureDevOpsRepo+[NoContext]+Get+$GET+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests/projects/ContosoSDKDfd/repos/TestApp0?api-version=2023-09-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests/projects/ContosoSDKDfd/repos/TestApp0?api-version=2023-09-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "19" ], + "x-ms-client-request-id": [ "3223d8d7-87de-4cee-a462-648f52998337" ], + "CommandName": [ "Get-AzSecurityConnectorAzureDevOpsRepo" ], + "FullCommandName": [ "Get-AzSecurityConnectorAzureDevOpsRepo_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=b0d653e3d2c4fba6e75578139341b84b35dee63a8a317f007b2447d8196b79e5;Path=/;HttpOnly;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com", "ARRAffinitySameSite=b0d653e3d2c4fba6e75578139341b84b35dee63a8a317f007b2447d8196b79e5;Path=/;HttpOnly;SameSite=None;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "Request-Context": [ "appId=cid-v1:b8e19897-bfe4-49ad-ad76-b9526fa18eea" ], + "mise-correlation-id": [ "db269018-e974-4168-9579-7140d44ba837" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-request-id": [ "b649ac04-deb1-4c8f-a040-29035fb7ecb2" ], + "x-ms-correlation-request-id": [ "b649ac04-deb1-4c8f-a040-29035fb7ecb2" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T020837Z:b649ac04-deb1-4c8f-a040-29035fb7ecb2" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: DE7C8835191B429B974044F2E25BB777 Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:08:37Z" ], + "Date": [ "Wed, 14 Feb 2024 02:08:37 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "924" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"parentOrgName\":\"dfdsdktests\",\"parentProjectName\":\"ContosoSDKDfd\",\"repoId\":\"35cd4811-63c7-4043-8587-f0a9cf37709e\",\"repoUrl\":\"https://dev.azure.com/dfdsdktests/ContosoSDKDfd/_git/TestApp0\",\"onboardingState\":\"Onboarded\",\"actionableRemediation\":{\"state\":\"Enabled\",\"categoryConfigurations\":[{\"minimumSeverityLevel\":\"High\",\"category\":\"IaC\"}],\"branchConfiguration\":{\"branchNames\":[],\"annotateDefaultBranch\":\"Enabled\"},\"inheritFromParentState\":\"Enabled\"},\"provisioningStatusMessage\":\"OK\",\"provisioningStatusUpdateTimeUtc\":\"2024-02-14T00:34:19Z\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests/projects/ContosoSDKDfd/repos/TestApp0\",\"name\":\"TestApp0\",\"type\":\"Microsoft.Security/securityConnectors/devops/azureDevOpsOrgs/projects/repos\"}", + "isContentBase64": false + } + }, + "Get-AzSecurityConnectorAzureDevOpsRepo+[NoContext]+GetViaIdentity+$GET+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests/projects/ContosoSDKDfd/repos/TestApp0?api-version=2023-09-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests/projects/ContosoSDKDfd/repos/TestApp0?api-version=2023-09-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "20" ], + "x-ms-client-request-id": [ "498be2d4-1043-4996-8b49-c5aef8aa16aa" ], + "CommandName": [ "Get-AzSecurityConnectorAzureDevOpsRepo" ], + "FullCommandName": [ "Get-AzSecurityConnectorAzureDevOpsRepo_GetViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=1c6c7a0a18efcd0c1f62ff61ff05f8a61bfe22533cfce5122cfd179979045df0;Path=/;HttpOnly;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com", "ARRAffinitySameSite=1c6c7a0a18efcd0c1f62ff61ff05f8a61bfe22533cfce5122cfd179979045df0;Path=/;HttpOnly;SameSite=None;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "Request-Context": [ "appId=cid-v1:b8e19897-bfe4-49ad-ad76-b9526fa18eea" ], + "mise-correlation-id": [ "3e730443-a62d-467f-989b-566f227246d9" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-request-id": [ "3c473061-a47d-4996-acd5-ec99c7ab4e9b" ], + "x-ms-correlation-request-id": [ "3c473061-a47d-4996-acd5-ec99c7ab4e9b" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T020838Z:3c473061-a47d-4996-acd5-ec99c7ab4e9b" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 23DFD558EB204ACD918BB7C84157092A Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:08:38Z" ], + "Date": [ "Wed, 14 Feb 2024 02:08:37 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "924" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"parentOrgName\":\"dfdsdktests\",\"parentProjectName\":\"ContosoSDKDfd\",\"repoId\":\"35cd4811-63c7-4043-8587-f0a9cf37709e\",\"repoUrl\":\"https://dev.azure.com/dfdsdktests/ContosoSDKDfd/_git/TestApp0\",\"onboardingState\":\"Onboarded\",\"actionableRemediation\":{\"state\":\"Enabled\",\"categoryConfigurations\":[{\"minimumSeverityLevel\":\"High\",\"category\":\"IaC\"}],\"branchConfiguration\":{\"branchNames\":[],\"annotateDefaultBranch\":\"Enabled\"},\"inheritFromParentState\":\"Enabled\"},\"provisioningStatusMessage\":\"OK\",\"provisioningStatusUpdateTimeUtc\":\"2024-02-14T00:34:19Z\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests/projects/ContosoSDKDfd/repos/TestApp0\",\"name\":\"TestApp0\",\"type\":\"Microsoft.Security/securityConnectors/devops/azureDevOpsOrgs/projects/repos\"}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/test/Get-AzSecurityConnectorAzureDevOpsRepo.Tests.ps1 b/src/Security/Security.Autorest/test/Get-AzSecurityConnectorAzureDevOpsRepo.Tests.ps1 new file mode 100644 index 000000000000..8a1089caa682 --- /dev/null +++ b/src/Security/Security.Autorest/test/Get-AzSecurityConnectorAzureDevOpsRepo.Tests.ps1 @@ -0,0 +1,41 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzSecurityConnectorAzureDevOpsRepo')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzSecurityConnectorAzureDevOpsRepo.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzSecurityConnectorAzureDevOpsRepo' { + It 'List' { + $rg = $env.SecurityConnectorsResourceGroupName + $sid = $env.SubscriptionId + $repos = Get-AzSecurityConnectorAzureDevOpsRepo -SubscriptionId $sid -ResourceGroupName $rg -SecurityConnectorName "dfdsdktests-azdo-01" -OrgName "dfdsdktests" -ProjectName "ContosoSDKDfd" + $repos.Count | Should -BeGreaterThan 0 + } + + It 'Get' { + $rg = $env.SecurityConnectorsResourceGroupName + $sid = $env.SubscriptionId + $repo = Get-AzSecurityConnectorAzureDevOpsRepo -SubscriptionId $sid -ResourceGroupName $rg -SecurityConnectorName "dfdsdktests-azdo-01" -OrgName "dfdsdktests" -ProjectName "ContosoSDKDfd" -RepoName "TestApp0" + $repo | Should -Not -Be $null + $repo.Name.Contains('TestApp0') | Should -Be $true + } + + It 'GetViaIdentity' { + $rg = $env.SecurityConnectorsResourceGroupName + $sid = $env.SubscriptionId + $InputObject = @{Id = "/subscriptions/$sid/resourcegroups/$rg/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests/projects/ContosoSDKDfd/repos/TestApp0" } + $project = Get-AzSecurityConnectorAzureDevOpsRepo -InputObject $InputObject + $project.Count | Should -Be 1 + $project.Name.Contains('TestApp0') | Should -Be $true + } +} diff --git a/src/Security/Security.Autorest/test/Get-AzSecurityConnectorDevOpsConfiguration.Recording.json b/src/Security/Security.Autorest/test/Get-AzSecurityConnectorDevOpsConfiguration.Recording.json new file mode 100644 index 000000000000..99a2ab626fad --- /dev/null +++ b/src/Security/Security.Autorest/test/Get-AzSecurityConnectorDevOpsConfiguration.Recording.json @@ -0,0 +1,143 @@ +{ + "Get-AzSecurityConnectorDevOpsConfiguration+[NoContext]+Get+$GET+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default?api-version=2023-09-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default?api-version=2023-09-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "21" ], + "x-ms-client-request-id": [ "786be468-9989-4ec6-97cb-4b2d0ac3fa17" ], + "CommandName": [ "Get-AzSecurityConnectorDevOpsConfiguration" ], + "FullCommandName": [ "Get-AzSecurityConnectorDevOpsConfiguration_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=ca594a79766484e25889904bf326227201e6905138dd325ca221b8b7af91ccae;Path=/;HttpOnly;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com", "ARRAffinitySameSite=ca594a79766484e25889904bf326227201e6905138dd325ca221b8b7af91ccae;Path=/;HttpOnly;SameSite=None;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "Request-Context": [ "appId=cid-v1:b8e19897-bfe4-49ad-ad76-b9526fa18eea" ], + "mise-correlation-id": [ "d6c15dd8-18cf-49cb-87eb-2ecc6b9e669c" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-request-id": [ "0ce78bb5-382d-4b3d-8e4d-b336c49275e2" ], + "x-ms-correlation-request-id": [ "0ce78bb5-382d-4b3d-8e4d-b336c49275e2" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T020839Z:0ce78bb5-382d-4b3d-8e4d-b336c49275e2" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: FCC7FAE5694B4D748E166E15319F8548 Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:08:38Z" ], + "Date": [ "Wed, 14 Feb 2024 02:08:38 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "408" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"centralus\",\"tags\":{},\"properties\":{\"autoDiscovery\":\"Disabled\",\"provisioningStatusMessage\":\"Resource creation successful.\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default\",\"name\":\"default\",\"type\":\"Microsoft.Security/securityConnectors/devops\"}", + "isContentBase64": false + } + }, + "Get-AzSecurityConnectorDevOpsConfiguration+[NoContext]+List+$GET+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default?api-version=2023-09-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default?api-version=2023-09-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "22" ], + "x-ms-client-request-id": [ "4e79af91-9539-40ec-b628-41732bbabf92" ], + "CommandName": [ "Get-AzSecurityConnectorDevOpsConfiguration" ], + "FullCommandName": [ "Get-AzSecurityConnectorDevOpsConfiguration_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=14a5c7981ca45a6803ac375748e68dc9b495d4e56b3202b86256249c9784b400;Path=/;HttpOnly;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com", "ARRAffinitySameSite=14a5c7981ca45a6803ac375748e68dc9b495d4e56b3202b86256249c9784b400;Path=/;HttpOnly;SameSite=None;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "Request-Context": [ "appId=cid-v1:b8e19897-bfe4-49ad-ad76-b9526fa18eea" ], + "mise-correlation-id": [ "adcb04de-5670-4a01-9001-5cd2e9b66ee6" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-request-id": [ "0afe3dce-1959-418b-bcc6-723af2ee3275" ], + "x-ms-correlation-request-id": [ "0afe3dce-1959-418b-bcc6-723af2ee3275" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T020839Z:0afe3dce-1959-418b-bcc6-723af2ee3275" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: AAC45D14196744FA8E19DA847155887A Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:08:39Z" ], + "Date": [ "Wed, 14 Feb 2024 02:08:39 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "408" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"centralus\",\"tags\":{},\"properties\":{\"autoDiscovery\":\"Disabled\",\"provisioningStatusMessage\":\"Resource creation successful.\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default\",\"name\":\"default\",\"type\":\"Microsoft.Security/securityConnectors/devops\"}", + "isContentBase64": false + } + }, + "Get-AzSecurityConnectorDevOpsConfiguration+[NoContext]+GetViaIdentity+$GET+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default?api-version=2023-09-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default?api-version=2023-09-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "23" ], + "x-ms-client-request-id": [ "1d2e7b2e-a616-40c4-89b9-5e0d2a92492d" ], + "CommandName": [ "Get-AzSecurityConnectorDevOpsConfiguration" ], + "FullCommandName": [ "Get-AzSecurityConnectorDevOpsConfiguration_GetViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=14a5c7981ca45a6803ac375748e68dc9b495d4e56b3202b86256249c9784b400;Path=/;HttpOnly;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com", "ARRAffinitySameSite=14a5c7981ca45a6803ac375748e68dc9b495d4e56b3202b86256249c9784b400;Path=/;HttpOnly;SameSite=None;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "Request-Context": [ "appId=cid-v1:b8e19897-bfe4-49ad-ad76-b9526fa18eea" ], + "mise-correlation-id": [ "e2413a97-70b0-4201-a6ec-febe6753945e" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-request-id": [ "ed2008e5-327d-4c73-a7f1-232debe43399" ], + "x-ms-correlation-request-id": [ "ed2008e5-327d-4c73-a7f1-232debe43399" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T020840Z:ed2008e5-327d-4c73-a7f1-232debe43399" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 6E97898179F44FA68F2115743983816D Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:08:40Z" ], + "Date": [ "Wed, 14 Feb 2024 02:08:39 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "408" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"centralus\",\"tags\":{},\"properties\":{\"autoDiscovery\":\"Disabled\",\"provisioningStatusMessage\":\"Resource creation successful.\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default\",\"name\":\"default\",\"type\":\"Microsoft.Security/securityConnectors/devops\"}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/test/Get-AzSecurityConnectorDevOpsConfiguration.Tests.ps1 b/src/Security/Security.Autorest/test/Get-AzSecurityConnectorDevOpsConfiguration.Tests.ps1 new file mode 100644 index 000000000000..7a2a8b0cd5b2 --- /dev/null +++ b/src/Security/Security.Autorest/test/Get-AzSecurityConnectorDevOpsConfiguration.Tests.ps1 @@ -0,0 +1,40 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzSecurityConnectorDevOpsConfiguration')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzSecurityConnectorDevOpsConfiguration.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzSecurityConnectorDevOpsConfiguration' { + It 'Get' { + $rg = $env.SecurityConnectorsResourceGroupName + $sid = $env.SubscriptionId + $config = Get-AzSecurityConnectorDevOpsConfiguration -SubscriptionId $sid -ResourceGroupName $rg -SecurityConnectorName "dfdsdktests-azdo-01" + $config.Count | Should -Be 1 + } + + It 'List' { + $rg = $env.SecurityConnectorsResourceGroupName + $sid = $env.SubscriptionId + $configs = Get-AzSecurityConnectorDevOpsConfiguration -SubscriptionId $sid -ResourceGroupName $rg -SecurityConnectorName "dfdsdktests-azdo-01" + $configs.Count | Should -Be 1 + } + + It 'GetViaIdentity' { + $rg = $env.SecurityConnectorsResourceGroupName + $sid = $env.SubscriptionId + $InputObject = @{Id = "/subscriptions/$sid/resourcegroups/$rg/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default" } + $config = Get-AzSecurityConnectorDevOpsConfiguration -InputObject $InputObject + $config.Count | Should -Be 1 + $config.Name.Contains('default') | Should -Be $true + } +} diff --git a/src/Security/Security.Autorest/test/Get-AzSecurityConnectorGitHubOwner.Recording.json b/src/Security/Security.Autorest/test/Get-AzSecurityConnectorGitHubOwner.Recording.json new file mode 100644 index 000000000000..549788a92dc5 --- /dev/null +++ b/src/Security/Security.Autorest/test/Get-AzSecurityConnectorGitHubOwner.Recording.json @@ -0,0 +1,143 @@ +{ + "Get-AzSecurityConnectorGitHubOwner+[NoContext]+List+$GET+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gh-01/devops/default/gitHubOwners?api-version=2023-09-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gh-01/devops/default/gitHubOwners?api-version=2023-09-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "24" ], + "x-ms-client-request-id": [ "1605b0bb-3ae8-4959-8c29-bdfa840a2349" ], + "CommandName": [ "Get-AzSecurityConnectorGitHubOwner" ], + "FullCommandName": [ "Get-AzSecurityConnectorGitHubOwner_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=b0d653e3d2c4fba6e75578139341b84b35dee63a8a317f007b2447d8196b79e5;Path=/;HttpOnly;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com", "ARRAffinitySameSite=b0d653e3d2c4fba6e75578139341b84b35dee63a8a317f007b2447d8196b79e5;Path=/;HttpOnly;SameSite=None;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "Request-Context": [ "appId=cid-v1:b8e19897-bfe4-49ad-ad76-b9526fa18eea" ], + "mise-correlation-id": [ "df48bf02-bd4b-4319-9c42-5438bdb20655" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-request-id": [ "5f8d2462-a6a4-49e5-9dfc-ab2e244cc215" ], + "x-ms-correlation-request-id": [ "5f8d2462-a6a4-49e5-9dfc-ab2e244cc215" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T020841Z:5f8d2462-a6a4-49e5-9dfc-ab2e244cc215" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: D7334E88A666404289230B7B1E21DB5B Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:08:40Z" ], + "Date": [ "Wed, 14 Feb 2024 02:08:40 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "573" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"properties\":{\"ownerUrl\":\"https://github.com/dfdsdktests\",\"gitHubInternalId\":\"45003365\",\"onboardingState\":\"Onboarded\",\"provisioningStatusMessage\":\"Beginning provisioning of GitHub connector.\",\"provisioningStatusUpdateTimeUtc\":\"2024-02-14T00:45:48Z\",\"provisioningState\":\"Pending\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gh-01/devops/default/gitHubOwners/dfdsdktests\",\"name\":\"dfdsdktests\",\"type\":\"Microsoft.Security/securityConnectors/devops/gitHubOwners\"}]}", + "isContentBase64": false + } + }, + "Get-AzSecurityConnectorGitHubOwner+[NoContext]+Get+$GET+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gh-01/devops/default/gitHubOwners/dfdsdktests?api-version=2023-09-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gh-01/devops/default/gitHubOwners/dfdsdktests?api-version=2023-09-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "25" ], + "x-ms-client-request-id": [ "6e8580a6-5f91-4f6e-82d4-9c89bcb4e450" ], + "CommandName": [ "Get-AzSecurityConnectorGitHubOwner" ], + "FullCommandName": [ "Get-AzSecurityConnectorGitHubOwner_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=1c6c7a0a18efcd0c1f62ff61ff05f8a61bfe22533cfce5122cfd179979045df0;Path=/;HttpOnly;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com", "ARRAffinitySameSite=1c6c7a0a18efcd0c1f62ff61ff05f8a61bfe22533cfce5122cfd179979045df0;Path=/;HttpOnly;SameSite=None;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "Request-Context": [ "appId=cid-v1:b8e19897-bfe4-49ad-ad76-b9526fa18eea" ], + "mise-correlation-id": [ "23c6cb43-b8fc-4e31-ab7e-83470f7a0ad2" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-request-id": [ "d60acabf-2cfc-4ec4-958c-33bc7c1911af" ], + "x-ms-correlation-request-id": [ "d60acabf-2cfc-4ec4-958c-33bc7c1911af" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T020841Z:d60acabf-2cfc-4ec4-958c-33bc7c1911af" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 0AFF8CED07D14154A5FDBD716F3AE93B Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:08:41Z" ], + "Date": [ "Wed, 14 Feb 2024 02:08:41 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "561" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"ownerUrl\":\"https://github.com/dfdsdktests\",\"gitHubInternalId\":\"45003365\",\"onboardingState\":\"Onboarded\",\"provisioningStatusMessage\":\"Beginning provisioning of GitHub connector.\",\"provisioningStatusUpdateTimeUtc\":\"2024-02-14T00:45:48Z\",\"provisioningState\":\"Pending\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gh-01/devops/default/gitHubOwners/dfdsdktests\",\"name\":\"dfdsdktests\",\"type\":\"Microsoft.Security/securityConnectors/devops/gitHubOwners\"}", + "isContentBase64": false + } + }, + "Get-AzSecurityConnectorGitHubOwner+[NoContext]+GetViaIdentity+$GET+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gh-01/devops/default/gitHubOwners/dfdsdktests?api-version=2023-09-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gh-01/devops/default/gitHubOwners/dfdsdktests?api-version=2023-09-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "26" ], + "x-ms-client-request-id": [ "dc5dc0f1-c845-4a37-a638-f47a7979c278" ], + "CommandName": [ "Get-AzSecurityConnectorGitHubOwner" ], + "FullCommandName": [ "Get-AzSecurityConnectorGitHubOwner_GetViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=14a5c7981ca45a6803ac375748e68dc9b495d4e56b3202b86256249c9784b400;Path=/;HttpOnly;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com", "ARRAffinitySameSite=14a5c7981ca45a6803ac375748e68dc9b495d4e56b3202b86256249c9784b400;Path=/;HttpOnly;SameSite=None;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "Request-Context": [ "appId=cid-v1:b8e19897-bfe4-49ad-ad76-b9526fa18eea" ], + "mise-correlation-id": [ "6794c628-3114-4b9b-aad6-21e2d72114d2" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-request-id": [ "ea6ac78d-856e-41ac-92eb-ac0ee0c4e33c" ], + "x-ms-correlation-request-id": [ "ea6ac78d-856e-41ac-92eb-ac0ee0c4e33c" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T020842Z:ea6ac78d-856e-41ac-92eb-ac0ee0c4e33c" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 72C71A62CD3F4D419AB28C0979C9FB83 Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:08:41Z" ], + "Date": [ "Wed, 14 Feb 2024 02:08:42 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "561" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"ownerUrl\":\"https://github.com/dfdsdktests\",\"gitHubInternalId\":\"45003365\",\"onboardingState\":\"Onboarded\",\"provisioningStatusMessage\":\"Beginning provisioning of GitHub connector.\",\"provisioningStatusUpdateTimeUtc\":\"2024-02-14T00:45:48Z\",\"provisioningState\":\"Pending\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gh-01/devops/default/gitHubOwners/dfdsdktests\",\"name\":\"dfdsdktests\",\"type\":\"Microsoft.Security/securityConnectors/devops/gitHubOwners\"}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/test/Get-AzSecurityConnectorGitHubOwner.Tests.ps1 b/src/Security/Security.Autorest/test/Get-AzSecurityConnectorGitHubOwner.Tests.ps1 new file mode 100644 index 000000000000..5b207d49a499 --- /dev/null +++ b/src/Security/Security.Autorest/test/Get-AzSecurityConnectorGitHubOwner.Tests.ps1 @@ -0,0 +1,41 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzSecurityConnectorGitHubOwner')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzSecurityConnectorGitHubOwner.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzSecurityConnectorGitHubOwner' { + It 'List' { + $rg = $env.SecurityConnectorsResourceGroupName + $sid = $env.SubscriptionId + $owners = Get-AzSecurityConnectorGitHubOwner -SubscriptionId $sid -ResourceGroupName $rg -SecurityConnectorName "dfdsdktests-gh-01" + $owners.Count | Should -BeGreaterThan 0 + } + + It 'Get' { + $rg = $env.SecurityConnectorsResourceGroupName + $sid = $env.SubscriptionId + $owner = Get-AzSecurityConnectorGitHubOwner -SubscriptionId $sid -ResourceGroupName $rg -SecurityConnectorName "dfdsdktests-gh-01" -OwnerName "dfdsdktests" + $owner | Should -Not -Be $null + $owner.Name.Contains('dfdsdktests') | Should -Be $true + } + + It 'GetViaIdentity' { + $rg = $env.SecurityConnectorsResourceGroupName + $sid = $env.SubscriptionId + $InputObject = @{Id = "/subscriptions/$sid/resourcegroups/$rg/providers/Microsoft.Security/securityConnectors/dfdsdktests-gh-01/devops/default/githubOwners/dfdsdktests" } + $owner = Get-AzSecurityConnectorGitHubOwner -InputObject $InputObject + $owner.Count | Should -Be 1 + $owner.Name.Contains('dfdsdktests') | Should -Be $true + } +} diff --git a/src/Security/Security.Autorest/test/Get-AzSecurityConnectorGitHubOwnerAvailable.Recording.json b/src/Security/Security.Autorest/test/Get-AzSecurityConnectorGitHubOwnerAvailable.Recording.json new file mode 100644 index 000000000000..a87d819e754e --- /dev/null +++ b/src/Security/Security.Autorest/test/Get-AzSecurityConnectorGitHubOwnerAvailable.Recording.json @@ -0,0 +1,49 @@ +{ + "Get-AzSecurityConnectorGitHubOwnerAvailable+[NoContext]+List+$POST+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gh-01/devops/default/listAvailableGitHubOwners?api-version=2023-09-01-preview+1": { + "Request": { + "Method": "POST", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gh-01/devops/default/listAvailableGitHubOwners?api-version=2023-09-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "27" ], + "x-ms-client-request-id": [ "bb013683-1db2-4598-b02d-9f613acfa976" ], + "CommandName": [ "Get-AzSecurityConnectorGitHubOwnerAvailable" ], + "FullCommandName": [ "Get-AzSecurityConnectorGitHubOwnerAvailable_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=1c6c7a0a18efcd0c1f62ff61ff05f8a61bfe22533cfce5122cfd179979045df0;Path=/;HttpOnly;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com", "ARRAffinitySameSite=1c6c7a0a18efcd0c1f62ff61ff05f8a61bfe22533cfce5122cfd179979045df0;Path=/;HttpOnly;SameSite=None;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1199" ], + "Request-Context": [ "appId=cid-v1:b8e19897-bfe4-49ad-ad76-b9526fa18eea" ], + "mise-correlation-id": [ "372c1421-7e8c-4697-93c3-4233845f6130" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-request-id": [ "060e30fb-6fbb-4620-abe3-98bf1bfc62fb" ], + "x-ms-correlation-request-id": [ "060e30fb-6fbb-4620-abe3-98bf1bfc62fb" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T020845Z:060e30fb-6fbb-4620-abe3-98bf1bfc62fb" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: F6C2469A5C3E412CA7E1973A9F556389 Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:08:43Z" ], + "Date": [ "Wed, 14 Feb 2024 02:08:44 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "573" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"properties\":{\"ownerUrl\":\"https://github.com/dfdsdktests\",\"gitHubInternalId\":\"45003365\",\"onboardingState\":\"Onboarded\",\"provisioningStatusMessage\":\"Beginning provisioning of GitHub connector.\",\"provisioningStatusUpdateTimeUtc\":\"2024-02-14T00:45:48Z\",\"provisioningState\":\"Pending\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gh-01/devops/default/gitHubOwners/dfdsdktests\",\"name\":\"dfdsdktests\",\"type\":\"Microsoft.Security/securityConnectors/devops/gitHubOwners\"}]}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/test/Get-AzSecurityConnectorGitHubOwnerAvailable.Tests.ps1 b/src/Security/Security.Autorest/test/Get-AzSecurityConnectorGitHubOwnerAvailable.Tests.ps1 new file mode 100644 index 000000000000..a73f798d30d3 --- /dev/null +++ b/src/Security/Security.Autorest/test/Get-AzSecurityConnectorGitHubOwnerAvailable.Tests.ps1 @@ -0,0 +1,24 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzSecurityConnectorGitHubOwnerAvailable')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzSecurityConnectorGitHubOwnerAvailable.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzSecurityConnectorGitHubOwnerAvailable' { + It 'List' { + $rg = $env.SecurityConnectorsResourceGroupName + $sid = $env.SubscriptionId + $owners = Get-AzSecurityConnectorGitHubOwnerAvailable -SubscriptionId $sid -ResourceGroupName $rg -SecurityConnectorName "dfdsdktests-gh-01" + $owners.Count | Should -BeGreaterThan 0 + } +} diff --git a/src/Security/Security.Autorest/test/Get-AzSecurityConnectorGitHubRepo.Recording.json b/src/Security/Security.Autorest/test/Get-AzSecurityConnectorGitHubRepo.Recording.json new file mode 100644 index 000000000000..3751dc33f076 --- /dev/null +++ b/src/Security/Security.Autorest/test/Get-AzSecurityConnectorGitHubRepo.Recording.json @@ -0,0 +1,143 @@ +{ + "Get-AzSecurityConnectorGitHubRepo+[NoContext]+List+$GET+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gh-01/devops/default/gitHubOwners/dfdsdktests/repos?api-version=2023-09-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gh-01/devops/default/gitHubOwners/dfdsdktests/repos?api-version=2023-09-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "28" ], + "x-ms-client-request-id": [ "b066c6a2-4127-409a-8535-12ef197d7d2e" ], + "CommandName": [ "Get-AzSecurityConnectorGitHubRepo" ], + "FullCommandName": [ "Get-AzSecurityConnectorGitHubRepo_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=b0d653e3d2c4fba6e75578139341b84b35dee63a8a317f007b2447d8196b79e5;Path=/;HttpOnly;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com", "ARRAffinitySameSite=b0d653e3d2c4fba6e75578139341b84b35dee63a8a317f007b2447d8196b79e5;Path=/;HttpOnly;SameSite=None;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11998" ], + "Request-Context": [ "appId=cid-v1:b8e19897-bfe4-49ad-ad76-b9526fa18eea" ], + "mise-correlation-id": [ "3cf6587e-ee6c-4b40-9901-8715a016f4a5" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-request-id": [ "dd17ff24-43ba-4a85-af3e-ee570419e0da" ], + "x-ms-correlation-request-id": [ "dd17ff24-43ba-4a85-af3e-ee570419e0da" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T020845Z:dd17ff24-43ba-4a85-af3e-ee570419e0da" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 0397E2F5BE364499B47BF69A8E8A4181 Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:08:45Z" ], + "Date": [ "Wed, 14 Feb 2024 02:08:45 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "6367" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"properties\":{\"repoId\":\"728418798\",\"repoName\":\"TestApp0\",\"onboardingState\":\"Onboarded\",\"repoUrl\":\"https://github.com/dfdsdktests/TestApp0\",\"parentOwnerName\":\"dfdsdktests\",\"provisioningStatusUpdateTimeUtc\":\"2024-02-14T00:45:48Z\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gh-01/devops/default/gitHubOwners/dfdsdktests/repos/TestApp0\",\"name\":\"TestApp0\",\"type\":\"Microsoft.Security/securityConnectors/devops/gitHubOwners/repos\"},{\"properties\":{\"repoId\":\"730346643\",\"repoName\":\"TestApp1\",\"onboardingState\":\"Onboarded\",\"repoUrl\":\"https://github.com/dfdsdktests/TestApp1\",\"parentOwnerName\":\"dfdsdktests\",\"provisioningStatusUpdateTimeUtc\":\"2024-02-14T00:45:48Z\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gh-01/devops/default/gitHubOwners/dfdsdktests/repos/TestApp1\",\"name\":\"TestApp1\",\"type\":\"Microsoft.Security/securityConnectors/devops/gitHubOwners/repos\"},{\"properties\":{\"repoId\":\"730347967\",\"repoName\":\"TestApp10\",\"onboardingState\":\"Onboarded\",\"repoUrl\":\"https://github.com/dfdsdktests/TestApp10\",\"parentOwnerName\":\"dfdsdktests\",\"provisioningStatusUpdateTimeUtc\":\"2024-02-14T00:45:48Z\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gh-01/devops/default/gitHubOwners/dfdsdktests/repos/TestApp10\",\"name\":\"TestApp10\",\"type\":\"Microsoft.Security/securityConnectors/devops/gitHubOwners/repos\"},{\"properties\":{\"repoId\":\"730348015\",\"repoName\":\"TestApp11\",\"onboardingState\":\"Onboarded\",\"repoUrl\":\"https://github.com/dfdsdktests/TestApp11\",\"parentOwnerName\":\"dfdsdktests\",\"provisioningStatusUpdateTimeUtc\":\"2024-02-14T00:45:48Z\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gh-01/devops/default/gitHubOwners/dfdsdktests/repos/TestApp11\",\"name\":\"TestApp11\",\"type\":\"Microsoft.Security/securityConnectors/devops/gitHubOwners/repos\"},{\"properties\":{\"repoId\":\"730347309\",\"repoName\":\"TestApp2\",\"onboardingState\":\"Onboarded\",\"repoUrl\":\"https://github.com/dfdsdktests/TestApp2\",\"parentOwnerName\":\"dfdsdktests\",\"provisioningStatusUpdateTimeUtc\":\"2024-02-14T00:45:48Z\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gh-01/devops/default/gitHubOwners/dfdsdktests/repos/TestApp2\",\"name\":\"TestApp2\",\"type\":\"Microsoft.Security/securityConnectors/devops/gitHubOwners/repos\"},{\"properties\":{\"repoId\":\"730347403\",\"repoName\":\"TestApp3\",\"onboardingState\":\"Onboarded\",\"repoUrl\":\"https://github.com/dfdsdktests/TestApp3\",\"parentOwnerName\":\"dfdsdktests\",\"provisioningStatusUpdateTimeUtc\":\"2024-02-14T00:45:48Z\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gh-01/devops/default/gitHubOwners/dfdsdktests/repos/TestApp3\",\"name\":\"TestApp3\",\"type\":\"Microsoft.Security/securityConnectors/devops/gitHubOwners/repos\"},{\"properties\":{\"repoId\":\"730347478\",\"repoName\":\"TestApp4\",\"onboardingState\":\"Onboarded\",\"repoUrl\":\"https://github.com/dfdsdktests/TestApp4\",\"parentOwnerName\":\"dfdsdktests\",\"provisioningStatusUpdateTimeUtc\":\"2024-02-14T00:45:48Z\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gh-01/devops/default/gitHubOwners/dfdsdktests/repos/TestApp4\",\"name\":\"TestApp4\",\"type\":\"Microsoft.Security/securityConnectors/devops/gitHubOwners/repos\"},{\"properties\":{\"repoId\":\"730347536\",\"repoName\":\"TestApp5\",\"onboardingState\":\"Onboarded\",\"repoUrl\":\"https://github.com/dfdsdktests/TestApp5\",\"parentOwnerName\":\"dfdsdktests\",\"provisioningStatusUpdateTimeUtc\":\"2024-02-14T00:45:49Z\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gh-01/devops/default/gitHubOwners/dfdsdktests/repos/TestApp5\",\"name\":\"TestApp5\",\"type\":\"Microsoft.Security/securityConnectors/devops/gitHubOwners/repos\"},{\"properties\":{\"repoId\":\"730347657\",\"repoName\":\"TestApp6\",\"onboardingState\":\"Onboarded\",\"repoUrl\":\"https://github.com/dfdsdktests/TestApp6\",\"parentOwnerName\":\"dfdsdktests\",\"provisioningStatusUpdateTimeUtc\":\"2024-02-14T00:45:49Z\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gh-01/devops/default/gitHubOwners/dfdsdktests/repos/TestApp6\",\"name\":\"TestApp6\",\"type\":\"Microsoft.Security/securityConnectors/devops/gitHubOwners/repos\"},{\"properties\":{\"repoId\":\"730347732\",\"repoName\":\"TestApp7\",\"onboardingState\":\"Onboarded\",\"repoUrl\":\"https://github.com/dfdsdktests/TestApp7\",\"parentOwnerName\":\"dfdsdktests\",\"provisioningStatusUpdateTimeUtc\":\"2024-02-14T00:45:49Z\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gh-01/devops/default/gitHubOwners/dfdsdktests/repos/TestApp7\",\"name\":\"TestApp7\",\"type\":\"Microsoft.Security/securityConnectors/devops/gitHubOwners/repos\"},{\"properties\":{\"repoId\":\"730347823\",\"repoName\":\"TestApp8\",\"onboardingState\":\"Onboarded\",\"repoUrl\":\"https://github.com/dfdsdktests/TestApp8\",\"parentOwnerName\":\"dfdsdktests\",\"provisioningStatusUpdateTimeUtc\":\"2024-02-14T00:45:49Z\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gh-01/devops/default/gitHubOwners/dfdsdktests/repos/TestApp8\",\"name\":\"TestApp8\",\"type\":\"Microsoft.Security/securityConnectors/devops/gitHubOwners/repos\"},{\"properties\":{\"repoId\":\"730347901\",\"repoName\":\"TestApp9\",\"onboardingState\":\"Onboarded\",\"repoUrl\":\"https://github.com/dfdsdktests/TestApp9\",\"parentOwnerName\":\"dfdsdktests\",\"provisioningStatusUpdateTimeUtc\":\"2024-02-14T00:45:49Z\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gh-01/devops/default/gitHubOwners/dfdsdktests/repos/TestApp9\",\"name\":\"TestApp9\",\"type\":\"Microsoft.Security/securityConnectors/devops/gitHubOwners/repos\"}]}", + "isContentBase64": false + } + }, + "Get-AzSecurityConnectorGitHubRepo+[NoContext]+Get+$GET+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gh-01/devops/default/gitHubOwners/dfdsdktests/repos/TestApp0?api-version=2023-09-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gh-01/devops/default/gitHubOwners/dfdsdktests/repos/TestApp0?api-version=2023-09-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "29" ], + "x-ms-client-request-id": [ "b45daeeb-68c1-4b7c-bba2-b357b707aa25" ], + "CommandName": [ "Get-AzSecurityConnectorGitHubRepo" ], + "FullCommandName": [ "Get-AzSecurityConnectorGitHubRepo_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=1c6c7a0a18efcd0c1f62ff61ff05f8a61bfe22533cfce5122cfd179979045df0;Path=/;HttpOnly;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com", "ARRAffinitySameSite=1c6c7a0a18efcd0c1f62ff61ff05f8a61bfe22533cfce5122cfd179979045df0;Path=/;HttpOnly;SameSite=None;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "Request-Context": [ "appId=cid-v1:b8e19897-bfe4-49ad-ad76-b9526fa18eea" ], + "mise-correlation-id": [ "411d430d-34b7-46c9-ac52-4c93b652af66" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-request-id": [ "0b23c86a-a491-42d4-8e6a-3e214c6b29c0" ], + "x-ms-correlation-request-id": [ "0b23c86a-a491-42d4-8e6a-3e214c6b29c0" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T020846Z:0b23c86a-a491-42d4-8e6a-3e214c6b29c0" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 39FD4A5897EF449DA82376FCD4C8BFD4 Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:08:46Z" ], + "Date": [ "Wed, 14 Feb 2024 02:08:45 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "528" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"repoId\":\"728418798\",\"repoName\":\"TestApp0\",\"onboardingState\":\"Onboarded\",\"repoUrl\":\"https://github.com/dfdsdktests/TestApp0\",\"parentOwnerName\":\"dfdsdktests\",\"provisioningStatusUpdateTimeUtc\":\"2024-02-14T00:45:48Z\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gh-01/devops/default/gitHubOwners/dfdsdktests/repos/TestApp0\",\"name\":\"TestApp0\",\"type\":\"Microsoft.Security/securityConnectors/devops/gitHubOwners/repos\"}", + "isContentBase64": false + } + }, + "Get-AzSecurityConnectorGitHubRepo+[NoContext]+GetViaIdentity+$GET+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gh-01/devops/default/gitHubOwners/dfdsdktests/repos/TestApp0?api-version=2023-09-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gh-01/devops/default/gitHubOwners/dfdsdktests/repos/TestApp0?api-version=2023-09-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "30" ], + "x-ms-client-request-id": [ "ce2facb8-29c7-4ec0-bce6-165a9084c455" ], + "CommandName": [ "Get-AzSecurityConnectorGitHubRepo" ], + "FullCommandName": [ "Get-AzSecurityConnectorGitHubRepo_GetViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=14a5c7981ca45a6803ac375748e68dc9b495d4e56b3202b86256249c9784b400;Path=/;HttpOnly;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com", "ARRAffinitySameSite=14a5c7981ca45a6803ac375748e68dc9b495d4e56b3202b86256249c9784b400;Path=/;HttpOnly;SameSite=None;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "Request-Context": [ "appId=cid-v1:b8e19897-bfe4-49ad-ad76-b9526fa18eea" ], + "mise-correlation-id": [ "cc274ced-0b47-4a90-a76f-883a6d4d2fbb" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-request-id": [ "31d39d48-b03d-4418-9d05-4248b9a30552" ], + "x-ms-correlation-request-id": [ "31d39d48-b03d-4418-9d05-4248b9a30552" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T020846Z:31d39d48-b03d-4418-9d05-4248b9a30552" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: B7444B4C2DF54EB985A25E8F0000BCC9 Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:08:46Z" ], + "Date": [ "Wed, 14 Feb 2024 02:08:46 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "528" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"repoId\":\"728418798\",\"repoName\":\"TestApp0\",\"onboardingState\":\"Onboarded\",\"repoUrl\":\"https://github.com/dfdsdktests/TestApp0\",\"parentOwnerName\":\"dfdsdktests\",\"provisioningStatusUpdateTimeUtc\":\"2024-02-14T00:45:48Z\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gh-01/devops/default/gitHubOwners/dfdsdktests/repos/TestApp0\",\"name\":\"TestApp0\",\"type\":\"Microsoft.Security/securityConnectors/devops/gitHubOwners/repos\"}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/test/Get-AzSecurityConnectorGitHubRepo.Tests.ps1 b/src/Security/Security.Autorest/test/Get-AzSecurityConnectorGitHubRepo.Tests.ps1 new file mode 100644 index 000000000000..96668c000bfa --- /dev/null +++ b/src/Security/Security.Autorest/test/Get-AzSecurityConnectorGitHubRepo.Tests.ps1 @@ -0,0 +1,41 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzSecurityConnectorGitHubRepo')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzSecurityConnectorGitHubRepo.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzSecurityConnectorGitHubRepo' { + It 'List' { + $rg = $env.SecurityConnectorsResourceGroupName + $sid = $env.SubscriptionId + $repos = Get-AzSecurityConnectorGitHubRepo -SubscriptionId $sid -ResourceGroupName $rg -SecurityConnectorName "dfdsdktests-gh-01" -OwnerName "dfdsdktests" + $repos.Count | Should -BeGreaterThan 0 + } + + It 'Get' { + $rg = $env.SecurityConnectorsResourceGroupName + $sid = $env.SubscriptionId + $repo = Get-AzSecurityConnectorGitHubRepo -SubscriptionId $sid -ResourceGroupName $rg -SecurityConnectorName "dfdsdktests-gh-01" -OwnerName "dfdsdktests" -RepoName "TestApp0" + $repo | Should -Not -Be $null + $repo.Name.Contains('TestApp0') | Should -Be $true + } + + It 'GetViaIdentity' { + $rg = $env.SecurityConnectorsResourceGroupName + $sid = $env.SubscriptionId + $InputObject = @{Id = "/subscriptions/$sid/resourcegroups/$rg/providers/Microsoft.Security/securityConnectors/dfdsdktests-gh-01/devops/default/githubOwners/dfdsdktests/repos/TestApp0" } + $repo = Get-AzSecurityConnectorGitHubRepo -InputObject $InputObject + $repo.Count | Should -Be 1 + $repo.Name.Contains('TestApp0') | Should -Be $true + } +} diff --git a/src/Security/Security.Autorest/test/Get-AzSecurityConnectorGitLabGroup.Recording.json b/src/Security/Security.Autorest/test/Get-AzSecurityConnectorGitLabGroup.Recording.json new file mode 100644 index 000000000000..d07de9cd0189 --- /dev/null +++ b/src/Security/Security.Autorest/test/Get-AzSecurityConnectorGitLabGroup.Recording.json @@ -0,0 +1,143 @@ +{ + "Get-AzSecurityConnectorGitLabGroup+[NoContext]+List+$GET+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gl-01/devops/default/gitLabGroups?api-version=2023-09-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gl-01/devops/default/gitLabGroups?api-version=2023-09-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "31" ], + "x-ms-client-request-id": [ "ff17cbf3-7470-4826-a50c-cb68ab93a1f2" ], + "CommandName": [ "Get-AzSecurityConnectorGitLabGroup" ], + "FullCommandName": [ "Get-AzSecurityConnectorGitLabGroup_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=14a5c7981ca45a6803ac375748e68dc9b495d4e56b3202b86256249c9784b400;Path=/;HttpOnly;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com", "ARRAffinitySameSite=14a5c7981ca45a6803ac375748e68dc9b495d4e56b3202b86256249c9784b400;Path=/;HttpOnly;SameSite=None;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11998" ], + "Request-Context": [ "appId=cid-v1:b8e19897-bfe4-49ad-ad76-b9526fa18eea" ], + "mise-correlation-id": [ "4af8bad2-165b-4ac6-a6b2-f1f759f222b7" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-request-id": [ "914ec50d-0a01-4c7c-b618-8ecfd72f9d63" ], + "x-ms-correlation-request-id": [ "914ec50d-0a01-4c7c-b618-8ecfd72f9d63" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T020847Z:914ec50d-0a01-4c7c-b618-8ecfd72f9d63" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 58A68C9254B345658988AC4B46A2BCEA Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:08:47Z" ], + "Date": [ "Wed, 14 Feb 2024 02:08:47 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "633" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"properties\":{\"fullyQualifiedName\":\"dfdsdktests\",\"fullyQualifiedFriendlyName\":\"Defender for DevOps SDK Tests\",\"url\":\"https://gitlab.com/groups/dfdsdktests\",\"onboardingState\":\"Onboarded\",\"provisioningStatusMessage\":\"Resource modification successful.\",\"provisioningStatusUpdateTimeUtc\":\"2024-02-13T22:41:56Z\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gl-01/devops/default/gitLabGroups/dfdsdktests\",\"name\":\"dfdsdktests\",\"type\":\"Microsoft.Security/securityConnectors/devops/gitLabGroups\"}]}", + "isContentBase64": false + } + }, + "Get-AzSecurityConnectorGitLabGroup+[NoContext]+Get+$GET+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gl-01/devops/default/gitLabGroups/dfdsdktests?api-version=2023-09-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gl-01/devops/default/gitLabGroups/dfdsdktests?api-version=2023-09-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "32" ], + "x-ms-client-request-id": [ "a3974ce8-88e2-444b-83da-40b597d1b2c1" ], + "CommandName": [ "Get-AzSecurityConnectorGitLabGroup" ], + "FullCommandName": [ "Get-AzSecurityConnectorGitLabGroup_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=1c6c7a0a18efcd0c1f62ff61ff05f8a61bfe22533cfce5122cfd179979045df0;Path=/;HttpOnly;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com", "ARRAffinitySameSite=1c6c7a0a18efcd0c1f62ff61ff05f8a61bfe22533cfce5122cfd179979045df0;Path=/;HttpOnly;SameSite=None;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "Request-Context": [ "appId=cid-v1:b8e19897-bfe4-49ad-ad76-b9526fa18eea" ], + "mise-correlation-id": [ "24d02427-61eb-4804-8f05-ce933bd746d1" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-request-id": [ "357f8740-b159-4de4-b0fa-765feef6c9d8" ], + "x-ms-correlation-request-id": [ "357f8740-b159-4de4-b0fa-765feef6c9d8" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T020848Z:357f8740-b159-4de4-b0fa-765feef6c9d8" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 0CD5D80694DF48D3BA2407EFBF06D136 Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:08:47Z" ], + "Date": [ "Wed, 14 Feb 2024 02:08:48 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "621" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"fullyQualifiedName\":\"dfdsdktests\",\"fullyQualifiedFriendlyName\":\"Defender for DevOps SDK Tests\",\"url\":\"https://gitlab.com/groups/dfdsdktests\",\"onboardingState\":\"Onboarded\",\"provisioningStatusMessage\":\"Resource modification successful.\",\"provisioningStatusUpdateTimeUtc\":\"2024-02-13T22:41:56Z\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gl-01/devops/default/gitLabGroups/dfdsdktests\",\"name\":\"dfdsdktests\",\"type\":\"Microsoft.Security/securityConnectors/devops/gitLabGroups\"}", + "isContentBase64": false + } + }, + "Get-AzSecurityConnectorGitLabGroup+[NoContext]+GetViaIdentity+$GET+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gl-01/devops/default/gitLabGroups/dfdsdktests?api-version=2023-09-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gl-01/devops/default/gitLabGroups/dfdsdktests?api-version=2023-09-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "33" ], + "x-ms-client-request-id": [ "73bd0c71-455d-47cb-b449-5f7a42ff0c63" ], + "CommandName": [ "Get-AzSecurityConnectorGitLabGroup" ], + "FullCommandName": [ "Get-AzSecurityConnectorGitLabGroup_GetViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=ca594a79766484e25889904bf326227201e6905138dd325ca221b8b7af91ccae;Path=/;HttpOnly;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com", "ARRAffinitySameSite=ca594a79766484e25889904bf326227201e6905138dd325ca221b8b7af91ccae;Path=/;HttpOnly;SameSite=None;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "Request-Context": [ "appId=cid-v1:b8e19897-bfe4-49ad-ad76-b9526fa18eea" ], + "mise-correlation-id": [ "e8ea92b2-8679-4215-8151-43be4c0799e8" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-request-id": [ "e56352e8-c8d1-4d8c-8331-521db9f89089" ], + "x-ms-correlation-request-id": [ "e56352e8-c8d1-4d8c-8331-521db9f89089" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T020854Z:e56352e8-c8d1-4d8c-8331-521db9f89089" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 05D7C9CF23554F68ACC358492E86FEC6 Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:08:49Z" ], + "Date": [ "Wed, 14 Feb 2024 02:08:54 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "621" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"fullyQualifiedName\":\"dfdsdktests\",\"fullyQualifiedFriendlyName\":\"Defender for DevOps SDK Tests\",\"url\":\"https://gitlab.com/groups/dfdsdktests\",\"onboardingState\":\"Onboarded\",\"provisioningStatusMessage\":\"Resource modification successful.\",\"provisioningStatusUpdateTimeUtc\":\"2024-02-13T22:41:56Z\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gl-01/devops/default/gitLabGroups/dfdsdktests\",\"name\":\"dfdsdktests\",\"type\":\"Microsoft.Security/securityConnectors/devops/gitLabGroups\"}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/test/Get-AzSecurityConnectorGitLabGroup.Tests.ps1 b/src/Security/Security.Autorest/test/Get-AzSecurityConnectorGitLabGroup.Tests.ps1 new file mode 100644 index 000000000000..b2a2989321d2 --- /dev/null +++ b/src/Security/Security.Autorest/test/Get-AzSecurityConnectorGitLabGroup.Tests.ps1 @@ -0,0 +1,41 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzSecurityConnectorGitLabGroup')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzSecurityConnectorGitLabGroup.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzSecurityConnectorGitLabGroup' { + It 'List' { + $rg = $env.SecurityConnectorsResourceGroupName + $sid = $env.SubscriptionId + $groups = Get-AzSecurityConnectorGitLabGroup -SubscriptionId $sid -ResourceGroupName $rg -SecurityConnectorName "dfdsdktests-gl-01" + $groups.Count | Should -BeGreaterThan 0 + } + + It 'Get' { + $rg = $env.SecurityConnectorsResourceGroupName + $sid = $env.SubscriptionId + $group = Get-AzSecurityConnectorGitLabGroup -SubscriptionId $sid -ResourceGroupName $rg -SecurityConnectorName "dfdsdktests-gl-01" -GroupFqName "dfdsdktests" + $group | Should -Not -Be $null + $group.Name.Contains('dfdsdktests') | Should -Be $true + } + + It 'GetViaIdentity' { + $rg = $env.SecurityConnectorsResourceGroupName + $sid = $env.SubscriptionId + $InputObject = @{Id = "/subscriptions/$sid/resourcegroups/$rg/providers/Microsoft.Security/securityConnectors/dfdsdktests-gl-01/devops/default/gitlabgroups/dfdsdktests" } + $group = Get-AzSecurityConnectorGitLabGroup -InputObject $InputObject + $group.Count | Should -Be 1 + $group.Name.Contains('dfdsdktests') | Should -Be $true + } +} diff --git a/src/Security/Security.Autorest/test/Get-AzSecurityConnectorGitLabGroupAvailable.Recording.json b/src/Security/Security.Autorest/test/Get-AzSecurityConnectorGitLabGroupAvailable.Recording.json new file mode 100644 index 000000000000..6316d2b1bb10 --- /dev/null +++ b/src/Security/Security.Autorest/test/Get-AzSecurityConnectorGitLabGroupAvailable.Recording.json @@ -0,0 +1,49 @@ +{ + "Get-AzSecurityConnectorGitLabGroupAvailable+[NoContext]+List+$POST+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gl-01/devops/default/listAvailableGitLabGroups?api-version=2023-09-01-preview+1": { + "Request": { + "Method": "POST", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gl-01/devops/default/listAvailableGitLabGroups?api-version=2023-09-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "34" ], + "x-ms-client-request-id": [ "ffc0acf9-7bde-460f-b3f2-64cdfc5d6b8d" ], + "CommandName": [ "Get-AzSecurityConnectorGitLabGroupAvailable" ], + "FullCommandName": [ "Get-AzSecurityConnectorGitLabGroupAvailable_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=ca594a79766484e25889904bf326227201e6905138dd325ca221b8b7af91ccae;Path=/;HttpOnly;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com", "ARRAffinitySameSite=ca594a79766484e25889904bf326227201e6905138dd325ca221b8b7af91ccae;Path=/;HttpOnly;SameSite=None;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1199" ], + "Request-Context": [ "appId=cid-v1:b8e19897-bfe4-49ad-ad76-b9526fa18eea" ], + "mise-correlation-id": [ "751ce8d5-f4c0-4c2f-97e1-fe9c4abc4728" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-request-id": [ "cb7ad2e3-4d8c-4818-b004-489ca5325f56" ], + "x-ms-correlation-request-id": [ "cb7ad2e3-4d8c-4818-b004-489ca5325f56" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T020856Z:cb7ad2e3-4d8c-4818-b004-489ca5325f56" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: FA6E36051B514B579DD87B1FA7C95D71 Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:08:55Z" ], + "Date": [ "Wed, 14 Feb 2024 02:08:56 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "633" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"properties\":{\"fullyQualifiedName\":\"dfdsdktests\",\"fullyQualifiedFriendlyName\":\"Defender for DevOps SDK Tests\",\"url\":\"https://gitlab.com/groups/dfdsdktests\",\"onboardingState\":\"Onboarded\",\"provisioningStatusMessage\":\"Resource modification successful.\",\"provisioningStatusUpdateTimeUtc\":\"2024-02-13T22:41:56Z\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gl-01/devops/default/gitLabGroups/dfdsdktests\",\"name\":\"dfdsdktests\",\"type\":\"Microsoft.Security/securityConnectors/devops/gitLabGroups\"}]}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/test/Get-AzSecurityConnectorGitLabGroupAvailable.Tests.ps1 b/src/Security/Security.Autorest/test/Get-AzSecurityConnectorGitLabGroupAvailable.Tests.ps1 new file mode 100644 index 000000000000..8ed1797be799 --- /dev/null +++ b/src/Security/Security.Autorest/test/Get-AzSecurityConnectorGitLabGroupAvailable.Tests.ps1 @@ -0,0 +1,24 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzSecurityConnectorGitLabGroupAvailable')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzSecurityConnectorGitLabGroupAvailable.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzSecurityConnectorGitLabGroupAvailable' { + It 'List' { + $rg = $env.SecurityConnectorsResourceGroupName + $sid = $env.SubscriptionId + $groups = Get-AzSecurityConnectorGitLabGroupAvailable -SubscriptionId $sid -ResourceGroupName $rg -SecurityConnectorName "dfdsdktests-gl-01" + $groups.Count | Should -BeGreaterThan 0 + } +} diff --git a/src/Security/Security.Autorest/test/Get-AzSecurityConnectorGitLabProject.Recording.json b/src/Security/Security.Autorest/test/Get-AzSecurityConnectorGitLabProject.Recording.json new file mode 100644 index 000000000000..500fa426661c --- /dev/null +++ b/src/Security/Security.Autorest/test/Get-AzSecurityConnectorGitLabProject.Recording.json @@ -0,0 +1,190 @@ +{ + "Get-AzSecurityConnectorGitLabProject+[NoContext]+List+$GET+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gl-01/devops/default/gitLabGroups/dfdsdktests/projects?api-version=2023-09-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gl-01/devops/default/gitLabGroups/dfdsdktests/projects?api-version=2023-09-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "35" ], + "x-ms-client-request-id": [ "a29940e4-8bf1-4bef-ade6-37ce73bf8121" ], + "CommandName": [ "Get-AzSecurityConnectorGitLabProject" ], + "FullCommandName": [ "Get-AzSecurityConnectorGitLabProject_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=1c6c7a0a18efcd0c1f62ff61ff05f8a61bfe22533cfce5122cfd179979045df0;Path=/;HttpOnly;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com", "ARRAffinitySameSite=1c6c7a0a18efcd0c1f62ff61ff05f8a61bfe22533cfce5122cfd179979045df0;Path=/;HttpOnly;SameSite=None;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "Request-Context": [ "appId=cid-v1:b8e19897-bfe4-49ad-ad76-b9526fa18eea" ], + "mise-correlation-id": [ "32b7bbe6-aea4-437f-918d-913b1d470ce1" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-request-id": [ "b8676673-79e1-4cdf-9a99-ce698f91342a" ], + "x-ms-correlation-request-id": [ "b8676673-79e1-4cdf-9a99-ce698f91342a" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T020858Z:b8676673-79e1-4cdf-9a99-ce698f91342a" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 87D3D777C6D749F297C41B21762A5DD8 Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:08:57Z" ], + "Date": [ "Wed, 14 Feb 2024 02:08:58 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "7700" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"properties\":{\"fullyQualifiedName\":\"dfdsdktests$testapp10\",\"fullyQualifiedFriendlyName\":\"Defender for DevOps SDK Tests / TestApp10\",\"fullyQualifiedParentGroupName\":\"dfdsdktests\",\"url\":\"https://gitlab.com/dfdsdktests/testapp10\",\"onboardingState\":\"Onboarded\",\"provisioningStatusMessage\":\"Resource modification successful.\",\"provisioningStatusUpdateTimeUtc\":\"1970-01-01T00:00:00Z\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gl-01/devops/default/gitLabGroups/dfdsdktests/projects/testapp10\",\"name\":\"testapp10\",\"type\":\"Microsoft.Security/securityConnectors/devops/gitLabGroups/projects\"},{\"properties\":{\"fullyQualifiedName\":\"dfdsdktests$testapp11\",\"fullyQualifiedFriendlyName\":\"Defender for DevOps SDK Tests / TestApp11\",\"fullyQualifiedParentGroupName\":\"dfdsdktests\",\"url\":\"https://gitlab.com/dfdsdktests/testapp11\",\"onboardingState\":\"Onboarded\",\"provisioningStatusMessage\":\"Resource modification successful.\",\"provisioningStatusUpdateTimeUtc\":\"1970-01-01T00:00:00Z\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gl-01/devops/default/gitLabGroups/dfdsdktests/projects/testapp11\",\"name\":\"testapp11\",\"type\":\"Microsoft.Security/securityConnectors/devops/gitLabGroups/projects\"},{\"properties\":{\"fullyQualifiedName\":\"dfdsdktests$testapp0\",\"fullyQualifiedFriendlyName\":\"Defender for DevOps SDK Tests / TestApp0\",\"fullyQualifiedParentGroupName\":\"dfdsdktests\",\"url\":\"https://gitlab.com/dfdsdktests/testapp0\",\"onboardingState\":\"Onboarded\",\"provisioningStatusMessage\":\"Resource modification successful.\",\"provisioningStatusUpdateTimeUtc\":\"1970-01-01T00:00:00Z\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gl-01/devops/default/gitLabGroups/dfdsdktests/projects/testapp0\",\"name\":\"testapp0\",\"type\":\"Microsoft.Security/securityConnectors/devops/gitLabGroups/projects\"},{\"properties\":{\"fullyQualifiedName\":\"dfdsdktests$testapp9\",\"fullyQualifiedFriendlyName\":\"Defender for DevOps SDK Tests / TestApp9\",\"fullyQualifiedParentGroupName\":\"dfdsdktests\",\"url\":\"https://gitlab.com/dfdsdktests/testapp9\",\"onboardingState\":\"Onboarded\",\"provisioningStatusMessage\":\"Resource modification successful.\",\"provisioningStatusUpdateTimeUtc\":\"1970-01-01T00:00:00Z\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gl-01/devops/default/gitLabGroups/dfdsdktests/projects/testapp9\",\"name\":\"testapp9\",\"type\":\"Microsoft.Security/securityConnectors/devops/gitLabGroups/projects\"},{\"properties\":{\"fullyQualifiedName\":\"dfdsdktests$testapp8\",\"fullyQualifiedFriendlyName\":\"Defender for DevOps SDK Tests / TestApp8\",\"fullyQualifiedParentGroupName\":\"dfdsdktests\",\"url\":\"https://gitlab.com/dfdsdktests/testapp8\",\"onboardingState\":\"Onboarded\",\"provisioningStatusMessage\":\"Resource modification successful.\",\"provisioningStatusUpdateTimeUtc\":\"1970-01-01T00:00:00Z\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gl-01/devops/default/gitLabGroups/dfdsdktests/projects/testapp8\",\"name\":\"testapp8\",\"type\":\"Microsoft.Security/securityConnectors/devops/gitLabGroups/projects\"},{\"properties\":{\"fullyQualifiedName\":\"dfdsdktests$testapp6\",\"fullyQualifiedFriendlyName\":\"Defender for DevOps SDK Tests / TestApp6\",\"fullyQualifiedParentGroupName\":\"dfdsdktests\",\"url\":\"https://gitlab.com/dfdsdktests/testapp6\",\"onboardingState\":\"Onboarded\",\"provisioningStatusMessage\":\"Resource modification successful.\",\"provisioningStatusUpdateTimeUtc\":\"1970-01-01T00:00:00Z\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gl-01/devops/default/gitLabGroups/dfdsdktests/projects/testapp6\",\"name\":\"testapp6\",\"type\":\"Microsoft.Security/securityConnectors/devops/gitLabGroups/projects\"},{\"properties\":{\"fullyQualifiedName\":\"dfdsdktests$testapp7\",\"fullyQualifiedFriendlyName\":\"Defender for DevOps SDK Tests / TestApp7\",\"fullyQualifiedParentGroupName\":\"dfdsdktests\",\"url\":\"https://gitlab.com/dfdsdktests/testapp7\",\"onboardingState\":\"Onboarded\",\"provisioningStatusMessage\":\"Resource modification successful.\",\"provisioningStatusUpdateTimeUtc\":\"1970-01-01T00:00:00Z\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gl-01/devops/default/gitLabGroups/dfdsdktests/projects/testapp7\",\"name\":\"testapp7\",\"type\":\"Microsoft.Security/securityConnectors/devops/gitLabGroups/projects\"},{\"properties\":{\"fullyQualifiedName\":\"dfdsdktests$testapp5\",\"fullyQualifiedFriendlyName\":\"Defender for DevOps SDK Tests / TestApp5\",\"fullyQualifiedParentGroupName\":\"dfdsdktests\",\"url\":\"https://gitlab.com/dfdsdktests/testapp5\",\"onboardingState\":\"Onboarded\",\"provisioningStatusMessage\":\"Resource modification successful.\",\"provisioningStatusUpdateTimeUtc\":\"1970-01-01T00:00:00Z\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gl-01/devops/default/gitLabGroups/dfdsdktests/projects/testapp5\",\"name\":\"testapp5\",\"type\":\"Microsoft.Security/securityConnectors/devops/gitLabGroups/projects\"},{\"properties\":{\"fullyQualifiedName\":\"dfdsdktests$testapp4\",\"fullyQualifiedFriendlyName\":\"Defender for DevOps SDK Tests / TestApp4\",\"fullyQualifiedParentGroupName\":\"dfdsdktests\",\"url\":\"https://gitlab.com/dfdsdktests/testapp4\",\"onboardingState\":\"Onboarded\",\"provisioningStatusMessage\":\"Resource modification successful.\",\"provisioningStatusUpdateTimeUtc\":\"1970-01-01T00:00:00Z\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gl-01/devops/default/gitLabGroups/dfdsdktests/projects/testapp4\",\"name\":\"testapp4\",\"type\":\"Microsoft.Security/securityConnectors/devops/gitLabGroups/projects\"},{\"properties\":{\"fullyQualifiedName\":\"dfdsdktests$testapp3\",\"fullyQualifiedFriendlyName\":\"Defender for DevOps SDK Tests / TestApp3\",\"fullyQualifiedParentGroupName\":\"dfdsdktests\",\"url\":\"https://gitlab.com/dfdsdktests/testapp3\",\"onboardingState\":\"Onboarded\",\"provisioningStatusMessage\":\"Resource modification successful.\",\"provisioningStatusUpdateTimeUtc\":\"1970-01-01T00:00:00Z\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gl-01/devops/default/gitLabGroups/dfdsdktests/projects/testapp3\",\"name\":\"testapp3\",\"type\":\"Microsoft.Security/securityConnectors/devops/gitLabGroups/projects\"}],\"nextLink\":\"https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gl-01/devops/default/gitLabGroups/dfdsdktests/projects?api-version=2023-09-01-preview\\u0026continuation-token=eyJPcHRpbWlzdGljRGlyZWN0RXhlY3V0aW9uVG9rZW4iOnsidG9rZW4iOiIrUklEOn42RElDQUxFR1p5alNnQVFBQUFBQURBPT0jUlQ6MSNUUkM6MTAjSVNWOjIjSUVPOjY1NTY3I1FDRjo4I0ZQQzpBZEtBQkFBQUFBQU0xSUFFQUFBQUFBdz0iLCJyYW5nZSI6eyJtaW4iOiIwNUMxRTVCNUUzNkY4NiIsIm1heCI6IkZGIn19fQ==\"}", + "isContentBase64": false + } + }, + "Get-AzSecurityConnectorGitLabProject+[NoContext]+List+$GET+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gl-01/devops/default/gitLabGroups/dfdsdktests/projects?api-version=2023-09-01-preview\u0026continuation-token=eyJPcHRpbWlzdGljRGlyZWN0RXhlY3V0aW9uVG9rZW4iOnsidG9rZW4iOiIrUklEOn42RElDQUxFR1p5alNnQVFBQUFBQURBPT0jUlQ6MSNUUkM6MTAjSVNWOjIjSUVPOjY1NTY3I1FDRjo4I0ZQQzpBZEtBQkFBQUFBQU0xSUFFQUFBQUFBdz0iLCJyYW5nZSI6eyJtaW4iOiIwNUMxRTVCNUUzNkY4NiIsIm1heCI6IkZGIn19fQ==+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gl-01/devops/default/gitLabGroups/dfdsdktests/projects?api-version=2023-09-01-preview\u0026continuation-token=eyJPcHRpbWlzdGljRGlyZWN0RXhlY3V0aW9uVG9rZW4iOnsidG9rZW4iOiIrUklEOn42RElDQUxFR1p5alNnQVFBQUFBQURBPT0jUlQ6MSNUUkM6MTAjSVNWOjIjSUVPOjY1NTY3I1FDRjo4I0ZQQzpBZEtBQkFBQUFBQU0xSUFFQUFBQUFBdz0iLCJyYW5nZSI6eyJtaW4iOiIwNUMxRTVCNUUzNkY4NiIsIm1heCI6IkZGIn19fQ==", + "Content": null, + "isContentBase64": false, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "36" ], + "x-ms-client-request-id": [ "a29940e4-8bf1-4bef-ade6-37ce73bf8121" ], + "CommandName": [ "Get-AzSecurityConnectorGitLabProject" ], + "FullCommandName": [ "Get-AzSecurityConnectorGitLabProject_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=1c6c7a0a18efcd0c1f62ff61ff05f8a61bfe22533cfce5122cfd179979045df0;Path=/;HttpOnly;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com", "ARRAffinitySameSite=1c6c7a0a18efcd0c1f62ff61ff05f8a61bfe22533cfce5122cfd179979045df0;Path=/;HttpOnly;SameSite=None;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11998" ], + "Request-Context": [ "appId=cid-v1:b8e19897-bfe4-49ad-ad76-b9526fa18eea" ], + "mise-correlation-id": [ "727b3bf1-2ed8-490f-b0ec-bf895687a53e" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-request-id": [ "cc9c0c12-d9e1-4da4-b999-f47fb679f4ad" ], + "x-ms-correlation-request-id": [ "cc9c0c12-d9e1-4da4-b999-f47fb679f4ad" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T020858Z:cc9c0c12-d9e1-4da4-b999-f47fb679f4ad" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 32DFCA31A5354AF0BE178D89D33EC2D5 Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:08:58Z" ], + "Date": [ "Wed, 14 Feb 2024 02:08:58 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1439" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"properties\":{\"fullyQualifiedName\":\"dfdsdktests$testapp2\",\"fullyQualifiedFriendlyName\":\"Defender for DevOps SDK Tests / TestApp2\",\"fullyQualifiedParentGroupName\":\"dfdsdktests\",\"url\":\"https://gitlab.com/dfdsdktests/testapp2\",\"onboardingState\":\"Onboarded\",\"provisioningStatusMessage\":\"Resource modification successful.\",\"provisioningStatusUpdateTimeUtc\":\"1970-01-01T00:00:00Z\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gl-01/devops/default/gitLabGroups/dfdsdktests/projects/testapp2\",\"name\":\"testapp2\",\"type\":\"Microsoft.Security/securityConnectors/devops/gitLabGroups/projects\"},{\"properties\":{\"fullyQualifiedName\":\"dfdsdktests$testapp1\",\"fullyQualifiedFriendlyName\":\"Defender for DevOps SDK Tests / TestApp1\",\"fullyQualifiedParentGroupName\":\"dfdsdktests\",\"url\":\"https://gitlab.com/dfdsdktests/testapp1\",\"onboardingState\":\"Onboarded\",\"provisioningStatusMessage\":\"Resource modification successful.\",\"provisioningStatusUpdateTimeUtc\":\"1970-01-01T00:00:00Z\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gl-01/devops/default/gitLabGroups/dfdsdktests/projects/testapp1\",\"name\":\"testapp1\",\"type\":\"Microsoft.Security/securityConnectors/devops/gitLabGroups/projects\"}]}", + "isContentBase64": false + } + }, + "Get-AzSecurityConnectorGitLabProject+[NoContext]+Get+$GET+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gl-01/devops/default/gitLabGroups/dfdsdktests/projects/testapp0?api-version=2023-09-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gl-01/devops/default/gitLabGroups/dfdsdktests/projects/testapp0?api-version=2023-09-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "37" ], + "x-ms-client-request-id": [ "90396b5b-461c-4189-826d-b056461d4b60" ], + "CommandName": [ "Get-AzSecurityConnectorGitLabProject" ], + "FullCommandName": [ "Get-AzSecurityConnectorGitLabProject_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=ca594a79766484e25889904bf326227201e6905138dd325ca221b8b7af91ccae;Path=/;HttpOnly;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com", "ARRAffinitySameSite=ca594a79766484e25889904bf326227201e6905138dd325ca221b8b7af91ccae;Path=/;HttpOnly;SameSite=None;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11997" ], + "Request-Context": [ "appId=cid-v1:b8e19897-bfe4-49ad-ad76-b9526fa18eea" ], + "mise-correlation-id": [ "0dcfa3e6-c6f2-47e4-bf9c-6f7d2a2b5d9e" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-request-id": [ "3f9f1402-1af9-4b61-a638-a75dddc7bd73" ], + "x-ms-correlation-request-id": [ "3f9f1402-1af9-4b61-a638-a75dddc7bd73" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T020859Z:3f9f1402-1af9-4b61-a638-a75dddc7bd73" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 009BBB2BD7594A85BC9D71436C3CB195 Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:08:59Z" ], + "Date": [ "Wed, 14 Feb 2024 02:08:59 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "713" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"fullyQualifiedName\":\"dfdsdktests$testapp0\",\"fullyQualifiedFriendlyName\":\"Defender for DevOps SDK Tests / TestApp0\",\"fullyQualifiedParentGroupName\":\"dfdsdktests\",\"url\":\"https://gitlab.com/dfdsdktests/testapp0\",\"onboardingState\":\"Onboarded\",\"provisioningStatusMessage\":\"Resource modification successful.\",\"provisioningStatusUpdateTimeUtc\":\"1970-01-01T00:00:00Z\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gl-01/devops/default/gitLabGroups/dfdsdktests/projects/testapp0\",\"name\":\"testapp0\",\"type\":\"Microsoft.Security/securityConnectors/devops/gitLabGroups/projects\"}", + "isContentBase64": false + } + }, + "Get-AzSecurityConnectorGitLabProject+[NoContext]+GetViaIdentity+$GET+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gl-01/devops/default/gitLabGroups/dfdsdktests/projects/testapp0?api-version=2023-09-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gl-01/devops/default/gitLabGroups/dfdsdktests/projects/testapp0?api-version=2023-09-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "38" ], + "x-ms-client-request-id": [ "f5066c4e-88d9-46ff-977e-984d9554c0fb" ], + "CommandName": [ "Get-AzSecurityConnectorGitLabProject" ], + "FullCommandName": [ "Get-AzSecurityConnectorGitLabProject_GetViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=14a5c7981ca45a6803ac375748e68dc9b495d4e56b3202b86256249c9784b400;Path=/;HttpOnly;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com", "ARRAffinitySameSite=14a5c7981ca45a6803ac375748e68dc9b495d4e56b3202b86256249c9784b400;Path=/;HttpOnly;SameSite=None;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "Request-Context": [ "appId=cid-v1:b8e19897-bfe4-49ad-ad76-b9526fa18eea" ], + "mise-correlation-id": [ "5f72c7c7-3e69-4f9e-bc41-217830ca279a" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-request-id": [ "b361ded5-3315-4d4e-a20a-7b469127aa23" ], + "x-ms-correlation-request-id": [ "b361ded5-3315-4d4e-a20a-7b469127aa23" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T020900Z:b361ded5-3315-4d4e-a20a-7b469127aa23" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 949C6A2BC36E4F469DFC6AACEF151864 Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:09:00Z" ], + "Date": [ "Wed, 14 Feb 2024 02:08:59 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "713" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"fullyQualifiedName\":\"dfdsdktests$testapp0\",\"fullyQualifiedFriendlyName\":\"Defender for DevOps SDK Tests / TestApp0\",\"fullyQualifiedParentGroupName\":\"dfdsdktests\",\"url\":\"https://gitlab.com/dfdsdktests/testapp0\",\"onboardingState\":\"Onboarded\",\"provisioningStatusMessage\":\"Resource modification successful.\",\"provisioningStatusUpdateTimeUtc\":\"1970-01-01T00:00:00Z\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gl-01/devops/default/gitLabGroups/dfdsdktests/projects/testapp0\",\"name\":\"testapp0\",\"type\":\"Microsoft.Security/securityConnectors/devops/gitLabGroups/projects\"}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/test/Get-AzSecurityConnectorGitLabProject.Tests.ps1 b/src/Security/Security.Autorest/test/Get-AzSecurityConnectorGitLabProject.Tests.ps1 new file mode 100644 index 000000000000..0ad21825dbcc --- /dev/null +++ b/src/Security/Security.Autorest/test/Get-AzSecurityConnectorGitLabProject.Tests.ps1 @@ -0,0 +1,41 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzSecurityConnectorGitLabProject')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzSecurityConnectorGitLabProject.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzSecurityConnectorGitLabProject' { + It 'List' { + $rg = $env.SecurityConnectorsResourceGroupName + $sid = $env.SubscriptionId + $projects = Get-AzSecurityConnectorGitLabProject -SubscriptionId $sid -ResourceGroupName $rg -SecurityConnectorName "dfdsdktests-gl-01" -GroupFqName "dfdsdktests" + $projects.Count | Should -BeGreaterThan 0 + } + + It 'Get' { + $rg = $env.SecurityConnectorsResourceGroupName + $sid = $env.SubscriptionId + $project = Get-AzSecurityConnectorGitLabProject -SubscriptionId $sid -ResourceGroupName $rg -SecurityConnectorName "dfdsdktests-gl-01" -GroupFqName "dfdsdktests" -ProjectName "testapp0" + $project | Should -Not -Be $null + $project.Name.Contains('testapp0') | Should -Be $true + } + + It 'GetViaIdentity' { + $rg = $env.SecurityConnectorsResourceGroupName + $sid = $env.SubscriptionId + $InputObject = @{Id = "/subscriptions/$sid/resourcegroups/$rg/providers/Microsoft.Security/securityConnectors/dfdsdktests-gl-01/devops/default/gitlabgroups/dfdsdktests/projects/testapp0" } + $project = Get-AzSecurityConnectorGitLabProject -InputObject $InputObject + $project.Count | Should -Be 1 + $project.Name.Contains('testapp0') | Should -Be $true + } +} diff --git a/src/Security/Security.Autorest/test/Get-AzSecurityConnectorGitLabSubgroup.Recording.json b/src/Security/Security.Autorest/test/Get-AzSecurityConnectorGitLabSubgroup.Recording.json new file mode 100644 index 000000000000..9bc7379cd715 --- /dev/null +++ b/src/Security/Security.Autorest/test/Get-AzSecurityConnectorGitLabSubgroup.Recording.json @@ -0,0 +1,49 @@ +{ + "Get-AzSecurityConnectorGitLabSubgroup+[NoContext]+List+$POST+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gl-01/devops/default/gitLabGroups/dfdsdktests/listSubgroups?api-version=2023-09-01-preview+1": { + "Request": { + "Method": "POST", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gl-01/devops/default/gitLabGroups/dfdsdktests/listSubgroups?api-version=2023-09-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "39" ], + "x-ms-client-request-id": [ "e2983c2d-6dae-40e6-abde-8ad40e76a198" ], + "CommandName": [ "Get-AzSecurityConnectorGitLabSubgroup" ], + "FullCommandName": [ "Get-AzSecurityConnectorGitLabSubgroup_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=1c6c7a0a18efcd0c1f62ff61ff05f8a61bfe22533cfce5122cfd179979045df0;Path=/;HttpOnly;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com", "ARRAffinitySameSite=1c6c7a0a18efcd0c1f62ff61ff05f8a61bfe22533cfce5122cfd179979045df0;Path=/;HttpOnly;SameSite=None;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1199" ], + "Request-Context": [ "appId=cid-v1:b8e19897-bfe4-49ad-ad76-b9526fa18eea" ], + "mise-correlation-id": [ "6dc6ad2e-1dc0-4b55-bc54-92b7d8cb172a" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-request-id": [ "dbde1bfc-3f58-414c-a410-c8723efb0087" ], + "x-ms-correlation-request-id": [ "dbde1bfc-3f58-414c-a410-c8723efb0087" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T020901Z:dbde1bfc-3f58-414c-a410-c8723efb0087" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: E0899C9AD3CD454984F0712A343DD447 Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:09:00Z" ], + "Date": [ "Wed, 14 Feb 2024 02:09:00 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1491" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"properties\":{\"fullyQualifiedName\":\"dfdsdktests$testsubgroup1$testsubgroupNested\",\"fullyQualifiedFriendlyName\":\"Defender for DevOps SDK Tests / testsubgroup1 / Test Subgroup\",\"url\":\"https://gitlab.com/groups/dfdsdktests/testsubgroup1/testsubgroupNested\",\"onboardingState\":\"Onboarded\",\"provisioningStatusMessage\":\"Resource modification successful.\",\"provisioningStatusUpdateTimeUtc\":\"2024-02-13T22:42:12Z\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gl-01/devops/default/gitLabGroups/dfdsdktests$testsubgroup1$testsubgroupNested\",\"name\":\"dfdsdktests$testsubgroup1$testsubgroupNested\",\"type\":\"Microsoft.Security/securityConnectors/devops/gitLabGroups\"},{\"properties\":{\"fullyQualifiedName\":\"dfdsdktests$testsubgroup1\",\"fullyQualifiedFriendlyName\":\"Defender for DevOps SDK Tests / testsubgroup1\",\"url\":\"https://gitlab.com/groups/dfdsdktests/testsubgroup1\",\"onboardingState\":\"Onboarded\",\"provisioningStatusMessage\":\"Resource modification successful.\",\"provisioningStatusUpdateTimeUtc\":\"2024-02-13T22:42:14Z\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-gl-01/devops/default/gitLabGroups/dfdsdktests$testsubgroup1\",\"name\":\"dfdsdktests$testsubgroup1\",\"type\":\"Microsoft.Security/securityConnectors/devops/gitLabGroups\"}]}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/test/Get-AzSecurityConnectorGitLabSubgroup.Tests.ps1 b/src/Security/Security.Autorest/test/Get-AzSecurityConnectorGitLabSubgroup.Tests.ps1 new file mode 100644 index 000000000000..0618076aeaf6 --- /dev/null +++ b/src/Security/Security.Autorest/test/Get-AzSecurityConnectorGitLabSubgroup.Tests.ps1 @@ -0,0 +1,24 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzSecurityConnectorGitLabSubgroup')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzSecurityConnectorGitLabSubgroup.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzSecurityConnectorGitLabSubgroup' { + It 'List' { + $rg = $env.SecurityConnectorsResourceGroupName + $sid = $env.SubscriptionId + $groups = Get-AzSecurityConnectorGitLabSubgroup -SubscriptionId $sid -ResourceGroupName $rg -SecurityConnectorName "dfdsdktests-gl-01" -GroupFqName "dfdsdktests" + $groups.Count | Should -BeGreaterThan 0 + } +} diff --git a/src/Security/Security.Autorest/test/Invoke-AzSecurityApiCollectionApimOffboard.Tests.ps1 b/src/Security/Security.Autorest/test/Invoke-AzSecurityApiCollectionApimOffboard.Tests.ps1 new file mode 100644 index 000000000000..24f2fb36ccc6 --- /dev/null +++ b/src/Security/Security.Autorest/test/Invoke-AzSecurityApiCollectionApimOffboard.Tests.ps1 @@ -0,0 +1,25 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Invoke-AzSecurityApiCollectionApimOffboard')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Invoke-AzSecurityApiCollectionApimOffboard.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Invoke-AzSecurityApiCollectionApimOffboard' { + It 'Delete' { + "Covered in Invoke-AzSecurityApiCollectionApimOnboard Tests" | Should -Not -BeNullOrEmpty + } + + It 'DeleteViaIdentity' { + "Covered in Invoke-AzSecurityApiCollectionApimOnboard Tests" | Should -Not -BeNullOrEmpty + } +} diff --git a/src/Security/Security.Autorest/test/Invoke-AzSecurityApiCollectionApimOnboard.Recording.json b/src/Security/Security.Autorest/test/Invoke-AzSecurityApiCollectionApimOnboard.Recording.json new file mode 100644 index 000000000000..5fd84af5f0bd --- /dev/null +++ b/src/Security/Security.Autorest/test/Invoke-AzSecurityApiCollectionApimOnboard.Recording.json @@ -0,0 +1,358 @@ +{ + "Invoke-AzSecurityApiCollectionApimOnboard+[NoContext]+Azure+$PUT+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/apicollectionstests/providers/Microsoft.ApiManagement/service/demoapimservice2/providers/Microsoft.Security/apiCollections/echo-api-2?api-version=2023-11-15+1": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/apicollectionstests/providers/Microsoft.ApiManagement/service/demoapimservice2/providers/Microsoft.Security/apiCollections/echo-api-2?api-version=2023-11-15", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "1" ], + "x-ms-client-request-id": [ "2fe1279f-53f8-4bdd-bc38-bc5353582689" ], + "CommandName": [ "Invoke-AzSecurityApiCollectionApimOnboard" ], + "FullCommandName": [ "Invoke-AzSecurityApiCollectionApimOnboard_Azure" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 201, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/apicollectionstests/providers/Microsoft.ApiManagement/service/demoapimservice2/providers/Microsoft.Security/apiCollections/echo-api-2?api-version=2023-11-15\u0026$asyncScope=eyJSZXRyeVVudGlsVGlja3MiOjYzODQzNDUyMzA1MDEwMTc0M30=" ], + "Retry-After": [ "20" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1199" ], + "mise-correlation-id": [ "ce27aa27-f856-48de-9c02-b0d69082a1ee" ], + "traceparent": [ "00-114f19a6f84d03d60196659b12a97c1d-2bd3fb8c8fe6b11a-01" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "x-ms-request-id": [ "e450ade5-ae6e-4be2-bd82-4843b076fa7f" ], + "x-ms-correlation-request-id": [ "e450ade5-ae6e-4be2-bd82-4843b076fa7f" ], + "x-ms-routing-request-id": [ "WESTUS2:20240213T201625Z:e450ade5-ae6e-4be2-bd82-4843b076fa7f" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 34079D6565E04D06B3440F2855943378 Ref B: CO6AA3150217033 Ref C: 2024-02-13T20:16:22Z" ], + "Date": [ "Tue, 13 Feb 2024 20:16:24 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "320" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/apicollectionstests/providers/Microsoft.ApiManagement/service/demoapimservice2/providers/Microsoft.Security/apiCollections/echo-api-2\",\"name\":\"echo-api-2\",\"type\":\"Microsoft.Security/apiCollections\",\"properties\":{\"provisioningState\":\"InProgress\"}}", + "isContentBase64": false + } + }, + "Invoke-AzSecurityApiCollectionApimOnboard+[NoContext]+Azure+$GET+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/apicollectionstests/providers/Microsoft.ApiManagement/service/demoapimservice2/providers/Microsoft.Security/apiCollections/echo-api-2?api-version=2023-11-15\u0026$asyncScope=eyJSZXRyeVVudGlsVGlja3MiOjYzODQzNDUyMzA1MDEwMTc0M30=+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/apicollectionstests/providers/Microsoft.ApiManagement/service/demoapimservice2/providers/Microsoft.Security/apiCollections/echo-api-2?api-version=2023-11-15\u0026$asyncScope=eyJSZXRyeVVudGlsVGlja3MiOjYzODQzNDUyMzA1MDEwMTc0M30=", + "Content": null, + "isContentBase64": false, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "2" ], + "x-ms-client-request-id": [ "2fe1279f-53f8-4bdd-bc38-bc5353582689" ], + "CommandName": [ "Invoke-AzSecurityApiCollectionApimOnboard" ], + "FullCommandName": [ "Invoke-AzSecurityApiCollectionApimOnboard_Azure" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "f8dc273f-35ab-4002-9a44-4c2dd13e7b61" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "mise-correlation-id": [ "15876140-5f0d-4296-8897-536c1e2aa276" ], + "traceparent": [ "00-78ebf7dfff3c871973be1dc322116137-8a8928fa61a84bca-00" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "x-ms-correlation-request-id": [ "f8dc273f-35ab-4002-9a44-4c2dd13e7b61" ], + "x-ms-routing-request-id": [ "WESTUS2:20240213T201646Z:f8dc273f-35ab-4002-9a44-4c2dd13e7b61" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 87DB9B9B6FB94F4591A52F43171F5512 Ref B: CO6AA3150217033 Ref C: 2024-02-13T20:16:45Z" ], + "Date": [ "Tue, 13 Feb 2024 20:16:45 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "741" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/apicollectionstests/providers/Microsoft.ApiManagement/service/demoapimservice2/providers/Microsoft.Security/apiCollections/echo-api-2\",\"name\":\"echo-api-2\",\"type\":\"microsoft.security/apicollections\",\"properties\":{\"provisioningState\":\"Succeeded\",\"displayName\":\"Echo API 2\",\"discoveredVia\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/apicollectionstests/providers/Microsoft.ApiManagement/service/demoapimservice2\",\"baseUrl\":\"https://demoapimservice2.azure-api.net\",\"numberOfApiEndpoints\":0,\"numberOfInactiveApiEndpoints\":0,\"numberOfUnauthenticatedApiEndpoints\":0,\"numberOfExternalApiEndpoints\":0,\"numberOfApiEndpointsWithSensitiveDataExposed\":0}}", + "isContentBase64": false + } + }, + "Invoke-AzSecurityApiCollectionApimOnboard+[NoContext]+Azure+$GET+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/apicollectionstests/providers/Microsoft.ApiManagement/service/demoapimservice2/providers/Microsoft.Security/apiCollections/echo-api-2?api-version=2023-11-15\u0026$asyncScope=eyJSZXRyeVVudGlsVGlja3MiOjYzODQzNDUyMzA1MDEwMTc0M30=+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/apicollectionstests/providers/Microsoft.ApiManagement/service/demoapimservice2/providers/Microsoft.Security/apiCollections/echo-api-2?api-version=2023-11-15\u0026$asyncScope=eyJSZXRyeVVudGlsVGlja3MiOjYzODQzNDUyMzA1MDEwMTc0M30=", + "Content": null, + "isContentBase64": false, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "3" ], + "x-ms-client-request-id": [ "2fe1279f-53f8-4bdd-bc38-bc5353582689" ], + "CommandName": [ "Invoke-AzSecurityApiCollectionApimOnboard" ], + "FullCommandName": [ "Invoke-AzSecurityApiCollectionApimOnboard_Azure" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "8660a1ee-7660-4b0f-a554-c0473f3bc7e8" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "mise-correlation-id": [ "e6ebd49b-338c-4250-82c0-bda0bc6d4541" ], + "traceparent": [ "00-2024a3a57497f0f2a93e8689acf697ad-2b5260abf73af707-00" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "x-ms-correlation-request-id": [ "8660a1ee-7660-4b0f-a554-c0473f3bc7e8" ], + "x-ms-routing-request-id": [ "WESTUS2:20240213T201646Z:8660a1ee-7660-4b0f-a554-c0473f3bc7e8" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 920ACC77E31E4F8FB12F431DE9680B21 Ref B: CO6AA3150217033 Ref C: 2024-02-13T20:16:46Z" ], + "Date": [ "Tue, 13 Feb 2024 20:16:46 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "741" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/apicollectionstests/providers/Microsoft.ApiManagement/service/demoapimservice2/providers/Microsoft.Security/apiCollections/echo-api-2\",\"name\":\"echo-api-2\",\"type\":\"microsoft.security/apicollections\",\"properties\":{\"provisioningState\":\"Succeeded\",\"displayName\":\"Echo API 2\",\"discoveredVia\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/apicollectionstests/providers/Microsoft.ApiManagement/service/demoapimservice2\",\"baseUrl\":\"https://demoapimservice2.azure-api.net\",\"numberOfApiEndpoints\":0,\"numberOfInactiveApiEndpoints\":0,\"numberOfUnauthenticatedApiEndpoints\":0,\"numberOfExternalApiEndpoints\":0,\"numberOfApiEndpointsWithSensitiveDataExposed\":0}}", + "isContentBase64": false + } + }, + "Invoke-AzSecurityApiCollectionApimOnboard+[NoContext]+Azure+$DELETE+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/apicollectionstests/providers/Microsoft.ApiManagement/service/demoapimservice2/providers/Microsoft.Security/apiCollections/echo-api-2?api-version=2023-11-15+4": { + "Request": { + "Method": "DELETE", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/apicollectionstests/providers/Microsoft.ApiManagement/service/demoapimservice2/providers/Microsoft.Security/apiCollections/echo-api-2?api-version=2023-11-15", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "4" ], + "x-ms-client-request-id": [ "2b5521a2-bc94-4b73-86bb-de64dd3c46e8" ], + "CommandName": [ "Invoke-AzSecurityApiCollectionApimOffboard" ], + "FullCommandName": [ "Invoke-AzSecurityApiCollectionApimOffboard_Delete" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-deletes": [ "14999" ], + "mise-correlation-id": [ "e305cd8f-8428-4dc5-ba52-5b642341af8d" ], + "traceparent": [ "00-551f8da0e29928bbe473331850c6bad8-6865ffcf23435e11-01" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "x-ms-request-id": [ "8f8e549c-ddf9-4ed2-b03c-be2c4343b825" ], + "x-ms-correlation-request-id": [ "8f8e549c-ddf9-4ed2-b03c-be2c4343b825" ], + "x-ms-routing-request-id": [ "WESTUS2:20240213T201648Z:8f8e549c-ddf9-4ed2-b03c-be2c4343b825" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: FD50DFFFA34C41FA921C6E4A0E0C79DA Ref B: CO6AA3150217033 Ref C: 2024-02-13T20:16:47Z" ], + "Date": [ "Tue, 13 Feb 2024 20:16:48 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "4" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "bnVsbA==", + "isContentBase64": false + } + }, + "Invoke-AzSecurityApiCollectionApimOnboard+[NoContext]+AzureViaIdentity+$PUT+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/apicollectionstests/providers/Microsoft.ApiManagement/service/demoapimservice2/providers/Microsoft.Security/apiCollections/echo-api-2?api-version=2023-11-15+1": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/apicollectionstests/providers/Microsoft.ApiManagement/service/demoapimservice2/providers/Microsoft.Security/apiCollections/echo-api-2?api-version=2023-11-15", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "5" ], + "x-ms-client-request-id": [ "411cbe57-42b5-4fed-ad60-e3baab07e616" ], + "CommandName": [ "Invoke-AzSecurityApiCollectionApimOnboard" ], + "FullCommandName": [ "Invoke-AzSecurityApiCollectionApimOnboard_AzureViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 201, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/apicollectionstests/providers/Microsoft.ApiManagement/service/demoapimservice2/providers/Microsoft.Security/apiCollections/echo-api-2?api-version=2023-11-15\u0026$asyncScope=eyJSZXRyeVVudGlsVGlja3MiOjYzODQzNDUyMzMxNDkyMzMyMX0=" ], + "Retry-After": [ "20" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1199" ], + "mise-correlation-id": [ "a9458c5f-c2cd-4b09-99d8-6655ad6d2fb9" ], + "traceparent": [ "00-a935f4207591378619d58460f7b49701-05e2168590618702-01" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "x-ms-request-id": [ "f8956d77-6c33-4669-a890-75911d75aa66" ], + "x-ms-correlation-request-id": [ "f8956d77-6c33-4669-a890-75911d75aa66" ], + "x-ms-routing-request-id": [ "WESTUS2:20240213T201651Z:f8956d77-6c33-4669-a890-75911d75aa66" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 3FDA5A75EF2242C2B69DA0932B9E075D Ref B: CO6AA3150217033 Ref C: 2024-02-13T20:16:49Z" ], + "Date": [ "Tue, 13 Feb 2024 20:16:51 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "320" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/apicollectionstests/providers/Microsoft.ApiManagement/service/demoapimservice2/providers/Microsoft.Security/apiCollections/echo-api-2\",\"name\":\"echo-api-2\",\"type\":\"Microsoft.Security/apiCollections\",\"properties\":{\"provisioningState\":\"InProgress\"}}", + "isContentBase64": false + } + }, + "Invoke-AzSecurityApiCollectionApimOnboard+[NoContext]+AzureViaIdentity+$GET+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/apicollectionstests/providers/Microsoft.ApiManagement/service/demoapimservice2/providers/Microsoft.Security/apiCollections/echo-api-2?api-version=2023-11-15\u0026$asyncScope=eyJSZXRyeVVudGlsVGlja3MiOjYzODQzNDUyMzMxNDkyMzMyMX0=+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/apicollectionstests/providers/Microsoft.ApiManagement/service/demoapimservice2/providers/Microsoft.Security/apiCollections/echo-api-2?api-version=2023-11-15\u0026$asyncScope=eyJSZXRyeVVudGlsVGlja3MiOjYzODQzNDUyMzMxNDkyMzMyMX0=", + "Content": null, + "isContentBase64": false, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "6" ], + "x-ms-client-request-id": [ "411cbe57-42b5-4fed-ad60-e3baab07e616" ], + "CommandName": [ "Invoke-AzSecurityApiCollectionApimOnboard" ], + "FullCommandName": [ "Invoke-AzSecurityApiCollectionApimOnboard_AzureViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "7878b46d-3b60-42e7-8697-47020b96c81f" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "mise-correlation-id": [ "e58de0cb-cb1f-472f-8d69-487f83e6ed6c" ], + "traceparent": [ "00-524291abe4813a31b252c20273fa823a-9ca028e4a0063d9c-00" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "x-ms-correlation-request-id": [ "7878b46d-3b60-42e7-8697-47020b96c81f" ], + "x-ms-routing-request-id": [ "WESTUS2:20240213T201712Z:7878b46d-3b60-42e7-8697-47020b96c81f" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: F0FC29135DC443548EDD04EBB0650FE4 Ref B: CO6AA3150217033 Ref C: 2024-02-13T20:17:11Z" ], + "Date": [ "Tue, 13 Feb 2024 20:17:12 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "741" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/apicollectionstests/providers/Microsoft.ApiManagement/service/demoapimservice2/providers/Microsoft.Security/apiCollections/echo-api-2\",\"name\":\"echo-api-2\",\"type\":\"microsoft.security/apicollections\",\"properties\":{\"provisioningState\":\"Succeeded\",\"displayName\":\"Echo API 2\",\"discoveredVia\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/apicollectionstests/providers/Microsoft.ApiManagement/service/demoapimservice2\",\"baseUrl\":\"https://demoapimservice2.azure-api.net\",\"numberOfApiEndpoints\":0,\"numberOfInactiveApiEndpoints\":0,\"numberOfUnauthenticatedApiEndpoints\":0,\"numberOfExternalApiEndpoints\":0,\"numberOfApiEndpointsWithSensitiveDataExposed\":0}}", + "isContentBase64": false + } + }, + "Invoke-AzSecurityApiCollectionApimOnboard+[NoContext]+AzureViaIdentity+$GET+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/apicollectionstests/providers/Microsoft.ApiManagement/service/demoapimservice2/providers/Microsoft.Security/apiCollections/echo-api-2?api-version=2023-11-15\u0026$asyncScope=eyJSZXRyeVVudGlsVGlja3MiOjYzODQzNDUyMzMxNDkyMzMyMX0=+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/apicollectionstests/providers/Microsoft.ApiManagement/service/demoapimservice2/providers/Microsoft.Security/apiCollections/echo-api-2?api-version=2023-11-15\u0026$asyncScope=eyJSZXRyeVVudGlsVGlja3MiOjYzODQzNDUyMzMxNDkyMzMyMX0=", + "Content": null, + "isContentBase64": false, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "7" ], + "x-ms-client-request-id": [ "411cbe57-42b5-4fed-ad60-e3baab07e616" ], + "CommandName": [ "Invoke-AzSecurityApiCollectionApimOnboard" ], + "FullCommandName": [ "Invoke-AzSecurityApiCollectionApimOnboard_AzureViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "b509ffc1-ea40-4b04-9100-9115a51b53cf" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "mise-correlation-id": [ "0834e3f5-eed0-4ea1-9a89-0cb7f4aee36b" ], + "traceparent": [ "00-4ab2ba67a76b1ca4d257b3e654548833-db10c145724b7c8c-00" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "x-ms-correlation-request-id": [ "b509ffc1-ea40-4b04-9100-9115a51b53cf" ], + "x-ms-routing-request-id": [ "WESTUS2:20240213T201713Z:b509ffc1-ea40-4b04-9100-9115a51b53cf" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: A7DBC8648C0E47929FD363DA39489B43 Ref B: CO6AA3150217033 Ref C: 2024-02-13T20:17:12Z" ], + "Date": [ "Tue, 13 Feb 2024 20:17:13 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "741" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/apicollectionstests/providers/Microsoft.ApiManagement/service/demoapimservice2/providers/Microsoft.Security/apiCollections/echo-api-2\",\"name\":\"echo-api-2\",\"type\":\"microsoft.security/apicollections\",\"properties\":{\"provisioningState\":\"Succeeded\",\"displayName\":\"Echo API 2\",\"discoveredVia\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/apicollectionstests/providers/Microsoft.ApiManagement/service/demoapimservice2\",\"baseUrl\":\"https://demoapimservice2.azure-api.net\",\"numberOfApiEndpoints\":0,\"numberOfInactiveApiEndpoints\":0,\"numberOfUnauthenticatedApiEndpoints\":0,\"numberOfExternalApiEndpoints\":0,\"numberOfApiEndpointsWithSensitiveDataExposed\":0}}", + "isContentBase64": false + } + }, + "Invoke-AzSecurityApiCollectionApimOnboard+[NoContext]+AzureViaIdentity+$DELETE+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/apicollectionstests/providers/Microsoft.ApiManagement/service/demoapimservice2/providers/Microsoft.Security/apiCollections/echo-api-2?api-version=2023-11-15+4": { + "Request": { + "Method": "DELETE", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/apicollectionstests/providers/Microsoft.ApiManagement/service/demoapimservice2/providers/Microsoft.Security/apiCollections/echo-api-2?api-version=2023-11-15", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "8" ], + "x-ms-client-request-id": [ "1b2b20a6-044f-480b-9bfb-bb7e67524d33" ], + "CommandName": [ "Invoke-AzSecurityApiCollectionApimOffboard" ], + "FullCommandName": [ "Invoke-AzSecurityApiCollectionApimOffboard_DeleteViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-deletes": [ "14999" ], + "mise-correlation-id": [ "2d48893f-4bfc-4e98-b020-341ba635b802" ], + "traceparent": [ "00-7b762f367ce32f9b6336629cb4118180-74a44c6ae38e51d3-01" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "x-ms-request-id": [ "8b00dabc-6eb5-4e28-8b7a-ee17de0d7a58" ], + "x-ms-correlation-request-id": [ "8b00dabc-6eb5-4e28-8b7a-ee17de0d7a58" ], + "x-ms-routing-request-id": [ "WESTUS2:20240213T201714Z:8b00dabc-6eb5-4e28-8b7a-ee17de0d7a58" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 55D54452CA2E4574A21D59BB47A01706 Ref B: CO6AA3150217033 Ref C: 2024-02-13T20:17:14Z" ], + "Date": [ "Tue, 13 Feb 2024 20:17:14 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "4" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "bnVsbA==", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/test/Invoke-AzSecurityApiCollectionApimOnboard.Tests.ps1 b/src/Security/Security.Autorest/test/Invoke-AzSecurityApiCollectionApimOnboard.Tests.ps1 new file mode 100644 index 000000000000..01cc64553f4f --- /dev/null +++ b/src/Security/Security.Autorest/test/Invoke-AzSecurityApiCollectionApimOnboard.Tests.ps1 @@ -0,0 +1,42 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Invoke-AzSecurityApiCollectionApimOnboard')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Invoke-AzSecurityApiCollectionApimOnboard.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Invoke-AzSecurityApiCollectionApimOnboard' { + It 'Azure' { + $rg = $env.ApiCollectionsResourceGroupName + try { + $collection = Invoke-AzSecurityApiCollectionApimOnboard -ResourceGroupName $rg -ServiceName "demoapimservice2" -ApiId "echo-api-2" + $collection.Name | Should -Be "echo-api-2" + $collection.ProvisioningState | Should -Be "Succeeded" + } finally { + Invoke-AzSecurityApiCollectionApimOffboard -ResourceGroupName $rg -ServiceName "demoapimservice2" -ApiId "echo-api-2" + } + } + + It 'AzureViaIdentity' { + $rg = $env.ApiCollectionsResourceGroupName + $sid = $env.SubscriptionId + $InputObject = @{Id = "/subscriptions/$sid/resourceGroups/$rg/providers/Microsoft.ApiManagement/service/demoapimservice2/providers/Microsoft.Security/apiCollections/echo-api-2" } + + try { + $collection = Invoke-AzSecurityApiCollectionApimOnboard -InputObject $InputObject + $collection.Name | Should -Be "echo-api-2" + $collection.ProvisioningState | Should -Be "Succeeded" + } finally { + Invoke-AzSecurityApiCollectionApimOffboard -InputObject $InputObject + } + } +} diff --git a/src/Security/Security.Autorest/test/New-AzSecurityAwsEnvironmentObject.Tests.ps1 b/src/Security/Security.Autorest/test/New-AzSecurityAwsEnvironmentObject.Tests.ps1 new file mode 100644 index 000000000000..38d79888fe04 --- /dev/null +++ b/src/Security/Security.Autorest/test/New-AzSecurityAwsEnvironmentObject.Tests.ps1 @@ -0,0 +1,30 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzSecurityAwsEnvironmentObject')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzSecurityAwsEnvironmentObject.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'New-AzSecurityAwsEnvironmentObject' { + It '__AllParameterSets' { + $organization = New-AzSecurityAwsOrganizationalDataMasterObject -StacksetName "myAwsStackSet" -ExcludedAccountId "123456789012" + $environment = New-AzSecurityAwsEnvironmentObject -Region "Central US" -ScanInterval 24 -OrganizationalData $organization + $environment.EnvironmentType | Should -Be "AwsAccount" + $environment.OrganizationalData.OrganizationMembershipType | Should -Be "Organization" + + $member = New-AzSecurityAwsOrganizationalDataMemberObject -ParentHierarchyId "123" + $environment = New-AzSecurityAwsEnvironmentObject -Region "Central US" -ScanInterval 24 -OrganizationalData $member + + $environment.EnvironmentType | Should -Be "AwsAccount" + $environment.OrganizationalData.OrganizationMembershipType | Should -Be "Member" + } +} diff --git a/src/Security/Security.Autorest/test/New-AzSecurityAwsOrganizationalDataMasterObject.Tests.ps1 b/src/Security/Security.Autorest/test/New-AzSecurityAwsOrganizationalDataMasterObject.Tests.ps1 new file mode 100644 index 000000000000..4b2391fc7062 --- /dev/null +++ b/src/Security/Security.Autorest/test/New-AzSecurityAwsOrganizationalDataMasterObject.Tests.ps1 @@ -0,0 +1,22 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzSecurityAwsOrganizationalDataMasterObject')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzSecurityAwsOrganizationalDataMasterObject.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'New-AzSecurityAwsOrganizationalDataMasterObject' { + It '__AllParameterSets' { + $organization = New-AzSecurityAwsOrganizationalDataMasterObject -StacksetName "myAwsStackSet" -ExcludedAccountId "123456789012" + $organization.OrganizationMembershipType | Should -Be "Organization" + } +} diff --git a/src/Security/Security.Autorest/test/New-AzSecurityAwsOrganizationalDataMemberObject.Tests.ps1 b/src/Security/Security.Autorest/test/New-AzSecurityAwsOrganizationalDataMemberObject.Tests.ps1 new file mode 100644 index 000000000000..6ca96e409c65 --- /dev/null +++ b/src/Security/Security.Autorest/test/New-AzSecurityAwsOrganizationalDataMemberObject.Tests.ps1 @@ -0,0 +1,22 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzSecurityAwsOrganizationalDataMemberObject')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzSecurityAwsOrganizationalDataMemberObject.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'New-AzSecurityAwsOrganizationalDataMemberObject' { + It '__AllParameterSets' { + $member = New-AzSecurityAwsOrganizationalDataMemberObject -ParentHierarchyId "123" + $member.OrganizationMembershipType | Should -Be "Member" + } +} diff --git a/src/Security/Security.Autorest/test/New-AzSecurityAzureDevOpsScopeEnvironmentObject.Tests.ps1 b/src/Security/Security.Autorest/test/New-AzSecurityAzureDevOpsScopeEnvironmentObject.Tests.ps1 new file mode 100644 index 000000000000..ecd328b2f738 --- /dev/null +++ b/src/Security/Security.Autorest/test/New-AzSecurityAzureDevOpsScopeEnvironmentObject.Tests.ps1 @@ -0,0 +1,22 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzSecurityAzureDevOpsScopeEnvironmentObject')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzSecurityAzureDevOpsScopeEnvironmentObject.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'New-AzSecurityAzureDevOpsScopeEnvironmentObject' { + It '__AllParameterSets' { + $scope = New-AzSecurityAzureDevOpsScopeEnvironmentObject + $scope.EnvironmentType | Should -Be "AzureDevOpsScope" + } +} diff --git a/src/Security/Security.Autorest/test/New-AzSecurityConnector.Recording.json b/src/Security/Security.Autorest/test/New-AzSecurityConnector.Recording.json new file mode 100644 index 000000000000..d3f5da0c6a2d --- /dev/null +++ b/src/Security/Security.Autorest/test/New-AzSecurityConnector.Recording.json @@ -0,0 +1,307 @@ +{ + "New-AzSecurityConnector+[NoContext]+CreateExpanded+$PUT+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/securityConnectors-tests/providers/Microsoft.Security/securityConnectors/aws-sdktest01?api-version=2023-10-01-preview+1": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/securityConnectors-tests/providers/Microsoft.Security/securityConnectors/aws-sdktest01?api-version=2023-10-01-preview", + "Content": "{\r\n \"location\": \"CentralUS\",\r\n \"properties\": {\r\n \"hierarchyIdentifier\": \"891376984375\",\r\n \"environmentName\": \"AWS\",\r\n \"offerings\": [\r\n {\r\n \"offeringType\": \"CspmMonitorAws\",\r\n \"nativeCloudConnection\": {\r\n \"cloudRoleArn\": \"arn:aws:iam::891376984375:role/CspmMonitorAws\"\r\n }\r\n },\r\n {\r\n \"offeringType\": \"DefenderCspmAws\",\r\n \"vmScanners\": {\r\n \"configuration\": {\r\n \"cloudRoleArn\": \"arn:aws:iam::891376984375:role/DefenderForCloud-AgentlessScanner\",\r\n \"scanningMode\": \"Default\"\r\n },\r\n \"enabled\": true\r\n },\r\n \"dataSensitivityDiscovery\": {\r\n \"enabled\": true,\r\n \"cloudRoleArn\": \"arn:aws:iam::891376984375:role/SensitiveDataDiscovery\"\r\n },\r\n \"databasesDspm\": {\r\n \"enabled\": true,\r\n \"cloudRoleArn\": \"arn:aws:iam::891376984375:role/DefenderForCloud-DataSecurityPostureDB\"\r\n },\r\n \"ciem\": {\r\n \"ciemDiscovery\": {\r\n \"cloudRoleArn\": \"arn:aws:iam::891376984375:role/DefenderForCloud-Ciem\"\r\n },\r\n \"ciemOidc\": {\r\n \"cloudRoleArn\": \"arn:aws:iam::891376984375:role/DefenderForCloud-OidcCiem\",\r\n \"azureActiveDirectoryAppName\": \"mciem-aws-oidc-connector\"\r\n }\r\n },\r\n \"mdcContainersImageAssessment\": {\r\n \"enabled\": true,\r\n \"cloudRoleArn\": \"arn:aws:iam::891376984375:role/MDCContainersImageAssessmentRole\"\r\n },\r\n \"mdcContainersAgentlessDiscoveryK8s\": {\r\n \"enabled\": true,\r\n \"cloudRoleArn\": \"arn:aws:iam::891376984375:role/MDCContainersAgentlessDiscoveryK8sRole\"\r\n }\r\n },\r\n {\r\n \"offeringType\": \"DefenderForContainersAws\",\r\n \"kubernetesService\": {\r\n \"cloudRoleArn\": \"arn:aws:iam::891376984375:role/DefenderForCloud-Containers-K8s\"\r\n },\r\n \"kubernetesScubaReader\": {\r\n \"cloudRoleArn\": \"arn:aws:iam::891376984375:role/DefenderForCloud-DataCollection\"\r\n },\r\n \"cloudWatchToKinesis\": {\r\n \"cloudRoleArn\": \"arn:aws:iam::891376984375:role/DefenderForCloud-Containers-K8s-cloudwatch-to-kinesis\"\r\n },\r\n \"kinesisToS3\": {\r\n \"cloudRoleArn\": \"arn:aws:iam::891376984375:role/DefenderForCloud-Containers-K8s-kinesis-to-s3\"\r\n },\r\n \"mdcContainersImageAssessment\": {\r\n \"enabled\": true,\r\n \"cloudRoleArn\": \"arn:aws:iam::891376984375:role/MDCContainersImageAssessmentRole\"\r\n },\r\n \"mdcContainersAgentlessDiscoveryK8s\": {\r\n \"enabled\": true,\r\n \"cloudRoleArn\": \"arn:aws:iam::891376984375:role/MDCContainersAgentlessDiscoveryK8sRole\"\r\n },\r\n \"enableContainerVulnerabilityAssessment\": false,\r\n \"autoProvisioning\": true,\r\n \"kubeAuditRetentionTime\": 30,\r\n \"scubaExternalId\": \"a47ae0a2-7bf7-482a-897a-7a139d30736c\"\r\n }\r\n ],\r\n \"environmentData\": {\r\n \"environmentType\": \"AwsAccount\",\r\n \"scanInterval\": 24\r\n }\r\n }\r\n}", + "isContentBase64": false, + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "3012" ] + } + }, + "Response": { + "StatusCode": 400, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-resource-requests": [ "249" ], + "x-ms-request-id": [ "c008130c-14ff-4ce9-9b44-55c21d7c4309" ], + "x-ms-correlation-request-id": [ "c008130c-14ff-4ce9-9b44-55c21d7c4309" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T023654Z:c008130c-14ff-4ce9-9b44-55c21d7c4309" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 936563AD1C4241FBB137D02BFEB3DD58 Ref B: CO6AA3150218037 Ref C: 2024-02-14T02:36:19Z" ], + "Date": [ "Wed, 14 Feb 2024 02:36:54 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "288" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"statusCode\":400,\"errorMessage\":\"error occured for security connector: Identity provider is missing from AWS account/s. Defender for Cloud cannot authenticate without it. Create the identity provider to complete the onboarding.\",\"errorCorrelation\":\"30fb370a-cd29-4275-894e-6336726bd38e\"}", + "isContentBase64": false + } + }, + "New-AzSecurityConnector+[NoContext]+GCP+$PUT+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/securityConnectors-tests/providers/Microsoft.Security/securityConnectors/gcp-sdktest01?api-version=2023-10-01-preview+1": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/securityConnectors-tests/providers/Microsoft.Security/securityConnectors/gcp-sdktest01?api-version=2023-10-01-preview", + "Content": "{\r\n \"location\": \"CentralUS\",\r\n \"properties\": {\r\n \"hierarchyIdentifier\": \"843025268399\",\r\n \"environmentName\": \"GCP\",\r\n \"offerings\": [\r\n {\r\n \"offeringType\": \"CspmMonitorGcp\",\r\n \"nativeCloudConnection\": {\r\n \"workloadIdentityProviderId\": \"cspm\",\r\n \"serviceAccountEmailAddress\": \"microsoft-defender-cspm@myproject.iam.gserviceaccount.com\"\r\n }\r\n },\r\n {\r\n \"offeringType\": \"DefenderCspmGcp\",\r\n \"ciemDiscovery\": {\r\n \"workloadIdentityProviderId\": \"ciem-discovery\",\r\n \"serviceAccountEmailAddress\": \"microsoft-defender-ciem@myproject.iam.gserviceaccount.com\",\r\n \"azureActiveDirectoryAppName\": \"mciem-gcp-oidc-app\"\r\n },\r\n \"vmScanners\": {\r\n \"configuration\": {\r\n \"scanningMode\": \"Default\",\r\n \"exclusionTags\": {\r\n \"key\": \"value\"\r\n }\r\n },\r\n \"enabled\": true\r\n },\r\n \"dataSensitivityDiscovery\": {\r\n \"enabled\": true,\r\n \"workloadIdentityProviderId\": \"data-security-posture-storage\",\r\n \"serviceAccountEmailAddress\": \"mdc-data-sec-posture-storage@myproject.iam.gserviceaccount.com\"\r\n },\r\n \"mdcContainersImageAssessment\": {\r\n \"enabled\": true,\r\n \"workloadIdentityProviderId\": \"containers\",\r\n \"serviceAccountEmailAddress\": \"mdc-containers-artifact-assess@myproject.iam.gserviceaccount.com\"\r\n },\r\n \"mdcContainersAgentlessDiscoveryK8s\": {\r\n \"enabled\": true,\r\n \"workloadIdentityProviderId\": \"containers\",\r\n \"serviceAccountEmailAddress\": \"mdc-containers-k8s-operator@myproject.iam.gserviceaccount.com\"\r\n }\r\n },\r\n {\r\n \"offeringType\": \"DefenderForContainersGcp\",\r\n \"nativeCloudConnection\": {\r\n \"serviceAccountEmailAddress\": \"microsoft-defender-containers@myproject.iam.gserviceaccount.com\",\r\n \"workloadIdentityProviderId\": \"containers\"\r\n },\r\n \"dataPipelineNativeCloudConnection\": {\r\n \"serviceAccountEmailAddress\": \"ms-defender-containers-stream@myproject.iam.gserviceaccount.com\",\r\n \"workloadIdentityProviderId\": \"containers-streams\"\r\n },\r\n \"mdcContainersImageAssessment\": {\r\n \"enabled\": true,\r\n \"workloadIdentityProviderId\": \"containers\",\r\n \"serviceAccountEmailAddress\": \"mdc-containers-artifact-assess@myproject.iam.gserviceaccount.com\"\r\n },\r\n \"mdcContainersAgentlessDiscoveryK8s\": {\r\n \"enabled\": true,\r\n \"workloadIdentityProviderId\": \"containers\",\r\n \"serviceAccountEmailAddress\": \"mdc-containers-k8s-operator@myproject.iam.gserviceaccount.com\"\r\n },\r\n \"auditLogsAutoProvisioningFlag\": true,\r\n \"defenderAgentAutoProvisioningFlag\": true,\r\n \"policyAgentAutoProvisioningFlag\": true\r\n }\r\n ],\r\n \"environmentData\": {\r\n \"environmentType\": \"GcpProject\",\r\n \"projectDetails\": {\r\n \"projectNumber\": \"843025268399\",\r\n \"projectId\": \"asc-sdk-samples\"\r\n },\r\n \"scanInterval\": 24\r\n }\r\n }\r\n}", + "isContentBase64": false, + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "3096" ] + } + }, + "Response": { + "StatusCode": 400, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-resource-requests": [ "249" ], + "x-ms-request-id": [ "e2ca6d46-6fa3-4289-980c-d67533cbfef3" ], + "x-ms-correlation-request-id": [ "e2ca6d46-6fa3-4289-980c-d67533cbfef3" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T023656Z:e2ca6d46-6fa3-4289-980c-d67533cbfef3" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 6163C9E4157E42B0BC5A1CE226DF723A Ref B: CO6AA3150218037 Ref C: 2024-02-14T02:36:55Z" ], + "Date": [ "Wed, 14 Feb 2024 02:36:55 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "278" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"statusCode\":400,\"errorMessage\":\"error occured for security connector: There is a problem with authenticating to your GCP project. Please contact the support with given tracing ID c03b073f-7df8-48a2-8945-fd40ca5b3076.\",\"errorCorrelation\":\"d708e7c4-8856-4e8a-859b-0fd4a03b09f9\"}", + "isContentBase64": false + } + }, + "New-AzSecurityConnector+[NoContext]+AzureDevOps+$PUT+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/securityConnectors-pwsh-tmp/providers/Microsoft.Security/securityConnectors/ado-pwsh-test01?api-version=2023-10-01-preview+1": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/securityConnectors-pwsh-tmp/providers/Microsoft.Security/securityConnectors/ado-pwsh-test01?api-version=2023-10-01-preview", + "Content": "{\r\n \"location\": \"CentralUS\",\r\n \"properties\": {\r\n \"hierarchyIdentifier\": \"de659ead-f948-45b3-9a2c-b75e8914c958\",\r\n \"environmentName\": \"AzureDevOps\",\r\n \"offerings\": [\r\n {\r\n \"offeringType\": \"CspmMonitorAzureDevOps\"\r\n }\r\n ],\r\n \"environmentData\": {\r\n \"environmentType\": \"AzureDevOpsScope\"\r\n }\r\n }\r\n}", + "isContentBase64": false, + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "337" ] + } + }, + "Response": { + "StatusCode": 201, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-resource-requests": [ "249" ], + "x-ms-request-id": [ "18b5ff97-9d9e-4f5a-8ab7-8e72621672f4" ], + "x-ms-correlation-request-id": [ "18b5ff97-9d9e-4f5a-8ab7-8e72621672f4" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T023658Z:18b5ff97-9d9e-4f5a-8ab7-8e72621672f4" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 55307052E2444078A7C9B0F4936C9FF6 Ref B: CO6AA3150218037 Ref C: 2024-02-14T02:36:56Z" ], + "Date": [ "Wed, 14 Feb 2024 02:36:57 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "771" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"offerings\":[{\"offeringType\":\"CspmMonitorAzureDevOps\"}],\"environmentName\":\"AzureDevOps\",\"hierarchyIdentifier\":\"de659ead-f948-45b3-9a2c-b75e8914c958\",\"environmentData\":{\"environmentType\":\"AzureDevOpsScope\"}},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourcegroups/securityconnectors-pwsh-tmp/providers/Microsoft.Security/securityConnectors/ado-pwsh-test01\",\"name\":\"ado-pwsh-test01\",\"type\":\"Microsoft.Security/securityconnectors\",\"location\":\"CentralUS\",\"tags\":{},\"systemData\":{\"createdBy\":\"c3d82ccb-fee1-430c-949e-6c0a217c00a8\",\"createdByType\":\"Application\",\"createdAt\":\"2024-02-14T02:36:57.1659085Z\",\"lastModifiedBy\":\"c3d82ccb-fee1-430c-949e-6c0a217c00a8\",\"lastModifiedByType\":\"Application\",\"lastModifiedAt\":\"2024-02-14T02:36:57.1659085Z\"}}", + "isContentBase64": false + } + }, + "New-AzSecurityConnector+[NoContext]+AzureDevOps+$DELETE+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/securityConnectors-pwsh-tmp/providers/Microsoft.Security/securityConnectors/ado-pwsh-test01?api-version=2023-10-01-preview+2": { + "Request": { + "Method": "DELETE", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/securityConnectors-pwsh-tmp/providers/Microsoft.Security/securityConnectors/ado-pwsh-test01?api-version=2023-10-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "4" ], + "x-ms-client-request-id": [ "576baa68-c3b0-443b-bca0-1fbbea10b8c4" ], + "CommandName": [ "Remove-AzSecurityConnector" ], + "FullCommandName": [ "Remove-AzSecurityConnector_Delete" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 204, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-resource-requests": [ "249" ], + "x-ms-request-id": [ "ef2c1540-6e02-4cfd-97a4-3e762c130390" ], + "x-ms-correlation-request-id": [ "ef2c1540-6e02-4cfd-97a4-3e762c130390" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T023702Z:ef2c1540-6e02-4cfd-97a4-3e762c130390" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 54B2705FC9FD4D34B98A997B3F5EF366 Ref B: CO6AA3150218037 Ref C: 2024-02-14T02:36:58Z" ], + "Date": [ "Wed, 14 Feb 2024 02:37:01 GMT" ] + }, + "ContentHeaders": { + "Expires": [ "-1" ] + }, + "Content": null, + "isContentBase64": false + } + }, + "New-AzSecurityConnector+[NoContext]+GitHub+$PUT+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/securityConnectors-pwsh-tmp/providers/Microsoft.Security/securityConnectors/gh-pwsh-test01?api-version=2023-10-01-preview+1": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/securityConnectors-pwsh-tmp/providers/Microsoft.Security/securityConnectors/gh-pwsh-test01?api-version=2023-10-01-preview", + "Content": "{\r\n \"location\": \"CentralUS\",\r\n \"properties\": {\r\n \"hierarchyIdentifier\": \"2ba1410d-87af-4481-8d45-e9bc26880cec\",\r\n \"environmentName\": \"Github\",\r\n \"offerings\": [\r\n {\r\n \"offeringType\": \"CspmMonitorGithub\"\r\n }\r\n ],\r\n \"environmentData\": {\r\n \"environmentType\": \"GithubScope\"\r\n }\r\n }\r\n}", + "isContentBase64": false, + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "322" ] + } + }, + "Response": { + "StatusCode": 201, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-resource-requests": [ "249" ], + "x-ms-request-id": [ "5b2b9182-fc9c-42b1-880f-6bd135b46153" ], + "x-ms-correlation-request-id": [ "5b2b9182-fc9c-42b1-880f-6bd135b46153" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T023704Z:5b2b9182-fc9c-42b1-880f-6bd135b46153" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 462582CCA1BF47AEA8005D25D8C5F0E2 Ref B: CO6AA3150218037 Ref C: 2024-02-14T02:37:02Z" ], + "Date": [ "Wed, 14 Feb 2024 02:37:03 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "754" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"offerings\":[{\"offeringType\":\"CspmMonitorGithub\"}],\"environmentName\":\"Github\",\"hierarchyIdentifier\":\"2ba1410d-87af-4481-8d45-e9bc26880cec\",\"environmentData\":{\"environmentType\":\"GithubScope\"}},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourcegroups/securityconnectors-pwsh-tmp/providers/Microsoft.Security/securityConnectors/gh-pwsh-test01\",\"name\":\"gh-pwsh-test01\",\"type\":\"Microsoft.Security/securityconnectors\",\"location\":\"CentralUS\",\"tags\":{},\"systemData\":{\"createdBy\":\"c3d82ccb-fee1-430c-949e-6c0a217c00a8\",\"createdByType\":\"Application\",\"createdAt\":\"2024-02-14T02:37:03.3126891Z\",\"lastModifiedBy\":\"c3d82ccb-fee1-430c-949e-6c0a217c00a8\",\"lastModifiedByType\":\"Application\",\"lastModifiedAt\":\"2024-02-14T02:37:03.3126891Z\"}}", + "isContentBase64": false + } + }, + "New-AzSecurityConnector+[NoContext]+GitHub+$DELETE+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/securityConnectors-pwsh-tmp/providers/Microsoft.Security/securityConnectors/gh-pwsh-test01?api-version=2023-10-01-preview+2": { + "Request": { + "Method": "DELETE", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/securityConnectors-pwsh-tmp/providers/Microsoft.Security/securityConnectors/gh-pwsh-test01?api-version=2023-10-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "6" ], + "x-ms-client-request-id": [ "584b8cbe-cc2a-425c-aefe-7ccf64d0ebd0" ], + "CommandName": [ "Remove-AzSecurityConnector" ], + "FullCommandName": [ "Remove-AzSecurityConnector_Delete" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 204, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-resource-requests": [ "249" ], + "x-ms-request-id": [ "570c6d35-7d1b-4de8-b93b-201eecfefda1" ], + "x-ms-correlation-request-id": [ "570c6d35-7d1b-4de8-b93b-201eecfefda1" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T023707Z:570c6d35-7d1b-4de8-b93b-201eecfefda1" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: AFFB00BC0FF645D18186DBC01A3FA34B Ref B: CO6AA3150218037 Ref C: 2024-02-14T02:37:04Z" ], + "Date": [ "Wed, 14 Feb 2024 02:37:06 GMT" ] + }, + "ContentHeaders": { + "Expires": [ "-1" ] + }, + "Content": null, + "isContentBase64": false + } + }, + "New-AzSecurityConnector+[NoContext]+GitLab+$PUT+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/securityConnectors-pwsh-tmp/providers/Microsoft.Security/securityConnectors/gl-pwsh-test01?api-version=2023-10-01-preview+1": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/securityConnectors-pwsh-tmp/providers/Microsoft.Security/securityConnectors/gl-pwsh-test01?api-version=2023-10-01-preview", + "Content": "{\r\n \"location\": \"CentralUS\",\r\n \"properties\": {\r\n \"hierarchyIdentifier\": \"15397162-d8b4-44d1-a5c4-024ca4aabd44\",\r\n \"environmentName\": \"GitLab\",\r\n \"offerings\": [\r\n {\r\n \"offeringType\": \"CspmMonitorGitLab\"\r\n }\r\n ],\r\n \"environmentData\": {\r\n \"environmentType\": \"GitlabScope\"\r\n }\r\n }\r\n}", + "isContentBase64": false, + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "322" ] + } + }, + "Response": { + "StatusCode": 201, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-resource-requests": [ "249" ], + "x-ms-request-id": [ "85f3d0fb-a4d0-4238-858b-34b83152be89" ], + "x-ms-correlation-request-id": [ "85f3d0fb-a4d0-4238-858b-34b83152be89" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T023709Z:85f3d0fb-a4d0-4238-858b-34b83152be89" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 087746C22C2C431D9997F8F7686EDC4D Ref B: CO6AA3150218037 Ref C: 2024-02-14T02:37:07Z" ], + "Date": [ "Wed, 14 Feb 2024 02:37:08 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "754" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"offerings\":[{\"offeringType\":\"CspmMonitorGitLab\"}],\"environmentName\":\"GitLab\",\"hierarchyIdentifier\":\"15397162-d8b4-44d1-a5c4-024ca4aabd44\",\"environmentData\":{\"environmentType\":\"GitlabScope\"}},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourcegroups/securityconnectors-pwsh-tmp/providers/Microsoft.Security/securityConnectors/gl-pwsh-test01\",\"name\":\"gl-pwsh-test01\",\"type\":\"Microsoft.Security/securityconnectors\",\"location\":\"CentralUS\",\"tags\":{},\"systemData\":{\"createdBy\":\"c3d82ccb-fee1-430c-949e-6c0a217c00a8\",\"createdByType\":\"Application\",\"createdAt\":\"2024-02-14T02:37:08.1489183Z\",\"lastModifiedBy\":\"c3d82ccb-fee1-430c-949e-6c0a217c00a8\",\"lastModifiedByType\":\"Application\",\"lastModifiedAt\":\"2024-02-14T02:37:08.1489183Z\"}}", + "isContentBase64": false + } + }, + "New-AzSecurityConnector+[NoContext]+GitLab+$DELETE+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/securityConnectors-pwsh-tmp/providers/Microsoft.Security/securityConnectors/gl-pwsh-test01?api-version=2023-10-01-preview+2": { + "Request": { + "Method": "DELETE", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/securityConnectors-pwsh-tmp/providers/Microsoft.Security/securityConnectors/gl-pwsh-test01?api-version=2023-10-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "8" ], + "x-ms-client-request-id": [ "f76c6a23-8d96-4eaf-a936-a9f414450181" ], + "CommandName": [ "Remove-AzSecurityConnector" ], + "FullCommandName": [ "Remove-AzSecurityConnector_Delete" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 204, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-resource-requests": [ "248" ], + "x-ms-request-id": [ "0549f91e-3ad1-43f7-9499-218e1b2c07e6" ], + "x-ms-correlation-request-id": [ "0549f91e-3ad1-43f7-9499-218e1b2c07e6" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T023711Z:0549f91e-3ad1-43f7-9499-218e1b2c07e6" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: D0593C4AAE944026AEC523A89A91FACB Ref B: CO6AA3150218037 Ref C: 2024-02-14T02:37:09Z" ], + "Date": [ "Wed, 14 Feb 2024 02:37:10 GMT" ] + }, + "ContentHeaders": { + "Expires": [ "-1" ] + }, + "Content": null, + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/test/New-AzSecurityConnector.Tests.ps1 b/src/Security/Security.Autorest/test/New-AzSecurityConnector.Tests.ps1 new file mode 100644 index 000000000000..e1c53e101f96 --- /dev/null +++ b/src/Security/Security.Autorest/test/New-AzSecurityConnector.Tests.ps1 @@ -0,0 +1,156 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzSecurityConnector')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzSecurityConnector.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'New-AzSecurityConnector' { + It 'CreateExpanded' { + $account = "891376984375" + $arnPrefix = "arn:aws:iam::$($account):role" + $cspmMonitorOffering = New-AzSecurityCspmMonitorAwsOfferingObject -NativeCloudConnectionCloudRoleArn "$arnPrefix/CspmMonitorAws" + + $dcspmOffering = New-AzSecurityDefenderCspmAwsOfferingObject ` + -VMScannerEnabled $true -ConfigurationScanningMode Default -ConfigurationCloudRoleArn "$arnPrefix/DefenderForCloud-AgentlessScanner" ` + -DataSensitivityDiscoveryEnabled $true -DataSensitivityDiscoveryCloudRoleArn "$arnPrefix/SensitiveDataDiscovery" ` + -DatabaseDspmEnabled $true -DatabaseDspmCloudRoleArn "$arnPrefix/DefenderForCloud-DataSecurityPostureDB" ` + -CiemDiscoveryCloudRoleArn "$arnPrefix/DefenderForCloud-Ciem" -CiemOidcAzureActiveDirectoryAppName "mciem-aws-oidc-connector" -CiemOidcCloudRoleArn "$arnPrefix/DefenderForCloud-OidcCiem" ` + -MdcContainerImageAssessmentEnabled $true -MdcContainerImageAssessmentCloudRoleArn "$arnPrefix/MDCContainersImageAssessmentRole" ` + -MdcContainerAgentlessDiscoveryK8SEnabled $true -MdcContainerAgentlessDiscoveryK8SCloudRoleArn "$arnPrefix/MDCContainersAgentlessDiscoveryK8sRole" + + $defenderForContainersOffering = New-AzSecurityDefenderForContainersAwsOfferingObject ` + -AutoProvisioning $true -KuberneteServiceCloudRoleArn "$arnPrefix/DefenderForCloud-Containers-K8s" -KuberneteScubaReaderCloudRoleArn "$arnPrefix/DefenderForCloud-DataCollection" ` + -KinesiToS3CloudRoleArn "$arnPrefix/DefenderForCloud-Containers-K8s-kinesis-to-s3" -CloudWatchToKinesiCloudRoleArn "$arnPrefix/DefenderForCloud-Containers-K8s-cloudwatch-to-kinesis" ` + -KubeAuditRetentionTime 30 -ScubaExternalId "a47ae0a2-7bf7-482a-897a-7a139d30736c" ` + -MdcContainerAgentlessDiscoveryK8SEnabled $true -MdcContainerAgentlessDiscoveryK8SCloudRoleArn "$arnPrefix/MDCContainersAgentlessDiscoveryK8sRole" ` + -MdcContainerImageAssessmentEnabled $true -MdcContainerImageAssessmentCloudRoleArn "$arnPrefix/MDCContainersImageAssessmentRole" ` + -EnableContainerVulnerabilityAssessment $false + + # $defenderForDatabasesOffering = New-AzSecurityDefenderForDatabasesAwsOfferingObject ` + # -ArcAutoProvisioningEnabled $true -ArcAutoProvisioningCloudRoleArn "$arnPrefix/DefenderForCloud-ArcAutoProvisioning" ` + # -DatabaseDspmEnabled $true -DatabaseDspmCloudRoleArn "$arnPrefix/DefenderForCloud-DataSecurityPostureDB" + + # $defenderForServersOffering = New-AzSecurityDefenderForServersAwsOfferingObject ` + # -DefenderForServerCloudRoleArn "$arnPrefix/DefenderForCloud-DefenderForServers" ` + # -ArcAutoProvisioningEnabled $true -ArcAutoProvisioningCloudRoleArn "$arnPrefix/DefenderForCloud-ArcAutoProvisioning" ` + # -MdeAutoProvisioningEnabled $false ` + # -VaAutoProvisioningEnabled $true -ConfigurationType TVM ` + # -VMScannerEnabled $true -ConfigurationCloudRoleArn "$arnPrefix/DefenderForCloud-AgentlessScanner" -ConfigurationScanningMode Default + # #-SubPlanType P2 + + $environment = New-AzSecurityAwsEnvironmentObject -ScanInterval 24 + + # Tests require complecated environment setup. For now, validating that resource provider is accepting payload and trying to access AWS + try { + New-AzSecurityConnector -Name "aws-sdktest01" -ResourceGroupName "securityConnectors-tests" -EnvironmentData $environment -EnvironmentName AWS -HierarchyIdentifier "$account" ` + -Offering @($cspmMonitorOffering, $dcspmOffering, $defenderForContainersOffering) -Location "CentralUS" + } catch { + $Error[0] | Should -Match "BadRequest" + $Error[0].Exception.ResponseBody | Should -Match "Identity provider is missing from AWS account" + } + } + + It 'GCP' { + $account = "843025268399" + $emailSuffix = "myproject.iam.gserviceaccount.com" + $cspmMonitorOffering = New-AzSecurityCspmMonitorGcpOfferingObject -NativeCloudConnectionServiceAccountEmailAddress "microsoft-defender-cspm@$emailSuffix" -NativeCloudConnectionWorkloadIdentityProviderId "cspm" + + $dcspmOffering = New-AzSecurityDefenderCspmGcpOfferingObject ` + -VMScannerEnabled $true -ConfigurationScanningMode Default -ConfigurationExclusionTag @{key="value"} ` + -MdcContainerAgentlessDiscoveryK8SEnabled $true -MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress "mdc-containers-k8s-operator@$emailSuffix" -MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId "containers" ` + -MdcContainerImageAssessmentEnabled $true -MdcContainerImageAssessmentServiceAccountEmailAddress "mdc-containers-artifact-assess@$emailSuffix" -MdcContainerImageAssessmentWorkloadIdentityProviderId "containers" ` + -DataSensitivityDiscoveryEnabled $true -DataSensitivityDiscoveryServiceAccountEmailAddress "mdc-data-sec-posture-storage@$emailSuffix" -DataSensitivityDiscoveryWorkloadIdentityProviderId "data-security-posture-storage" ` + -CiemDiscoveryServiceAccountEmailAddress "microsoft-defender-ciem@$emailSuffix" -CiemDiscoveryAzureActiveDirectoryAppName "mciem-gcp-oidc-app" -CiemDiscoveryWorkloadIdentityProviderId "ciem-discovery" + + $defenderForContainersOffering = New-AzSecurityDefenderForContainersGcpOfferingObject ` + -NativeCloudConnectionServiceAccountEmailAddress "microsoft-defender-containers@$emailSuffix" -NativeCloudConnectionWorkloadIdentityProviderId "containers" ` + -DataPipelineNativeCloudConnectionServiceAccountEmailAddress "ms-defender-containers-stream@$emailSuffix" -DataPipelineNativeCloudConnectionWorkloadIdentityProviderId "containers-streams" ` + -AuditLogsAutoProvisioningFlag $true -DefenderAgentAutoProvisioningFlag $true -PolicyAgentAutoProvisioningFlag $true ` + -MdcContainerAgentlessDiscoveryK8SEnabled $true -MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId "containers" -MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress "mdc-containers-k8s-operator@$emailSuffix" ` + -MdcContainerImageAssessmentEnabled $true -MdcContainerImageAssessmentWorkloadIdentityProviderId "containers" -MdcContainerImageAssessmentServiceAccountEmailAddress "mdc-containers-artifact-assess@$emailSuffix" + + # $defenderForDatabasesOffering = New-AzSecurityDefenderForDatabasesGcpOfferingObject ` + # -ArcAutoProvisioningEnabled $true ` + # -DefenderForDatabaseArcAutoProvisioningServiceAccountEmailAddress "microsoft-databases-arc-ap@" -DefenderForDatabaseArcAutoProvisioningWorkloadIdentityProviderId "defender-for-databases-arc-ap" + + # $defenderForServersOffering = New-AzSecurityDefenderForServersGcpOfferingObject ` + # -DefenderForServerServiceAccountEmailAddress "microsoft-defender-for-servers@$emailSuffix" -DefenderForServerWorkloadIdentityProviderId "defender-for-servers" ` + # -ArcAutoProvisioningEnabled $true -MdeAutoProvisioningEnabled $true -VaAutoProvisioningEnabled $true -ConfigurationType TVM ` + # -VMScannerEnabled $true -ConfigurationScanningMode Default + + $environment = New-AzSecurityGcpProjectEnvironmentObject -ScanInterval 24 -ProjectDetailProjectId "asc-sdk-samples" -ProjectDetailProjectNumber "$account" + + # Tests require complecated environment setup. For now, validating that resource provider is accepting payload and trying to access GCP + try { + New-AzSecurityConnector -Name "gcp-sdktest01" -ResourceGroupName "securityConnectors-tests" -EnvironmentData $environment -EnvironmentName GCP -HierarchyIdentifier "$account" ` + -Offering @($cspmMonitorOffering, $dcspmOffering, $defenderForContainersOffering) -Location "CentralUS" + } catch { + $Error[0] | Should -Match "BadRequest" + $Error[0].Exception.ResponseBody | Should -Match "There is a problem with authenticating to your GCP project" + } + } + + It 'AzureDevOps' { + $rg = "securityConnectors-pwsh-tmp" + $sid = $env.SubscriptionId + $connectorName = "ado-pwsh-test01" + $hierarchyIdentifier = "de659ead-f948-45b3-9a2c-b75e8914c958" + try { + $connector = New-AzSecurityConnector -SubscriptionId $sid -ResourceGroupName $rg -Name $connectorName ` + -EnvironmentName AzureDevOps -EnvironmentData (New-AzSecurityAzureDevOpsScopeEnvironmentObject) ` + -HierarchyIdentifier $hierarchyIdentifier -Location "CentralUS" ` + -Offering @(New-AzSecurityCspmMonitorAzureDevOpsOfferingObject) + } finally { + Remove-AzSecurityConnector -SubscriptionId $sid -ResourceGroupName $rg -Name $connectorName + } + + $connector | Should -Not -Be $null + $connector.EnvironmentName | Should -Be "AzureDevOps" + } + + It 'GitHub' { + $rg = "securityConnectors-pwsh-tmp" + $sid = $env.SubscriptionId + $connectorName = "gh-pwsh-test01" + $hierarchyIdentifier = "2ba1410d-87af-4481-8d45-e9bc26880cec" + try { + $connector = New-AzSecurityConnector -SubscriptionId $sid -ResourceGroupName $rg -Name $connectorName ` + -EnvironmentName Github -EnvironmentData (New-AzSecurityGitHubScopeEnvironmentObject) ` + -HierarchyIdentifier $hierarchyIdentifier -Location "CentralUS" ` + -Offering @(New-AzSecurityCspmMonitorGithubOfferingObject) + } finally { + Remove-AzSecurityConnector -SubscriptionId $sid -ResourceGroupName $rg -Name $connectorName + } + + $connector | Should -Not -Be $null + $connector.EnvironmentName | Should -Be "GitHub" + } + + It 'GitLab' { + $rg = "securityConnectors-pwsh-tmp" + $sid = $env.SubscriptionId + $connectorName = "gl-pwsh-test01" + $hierarchyIdentifier = "15397162-d8b4-44d1-a5c4-024ca4aabd44" + try { + $connector = New-AzSecurityConnector -SubscriptionId $sid -ResourceGroupName $rg -Name $connectorName ` + -EnvironmentName GitLab -EnvironmentData (New-AzSecurityGitLabScopeEnvironmentObject) ` + -HierarchyIdentifier $hierarchyIdentifier -Location "CentralUS" ` + -Offering @(New-AzSecurityCspmMonitorGitLabOfferingObject) + } finally { + Remove-AzSecurityConnector -SubscriptionId $sid -ResourceGroupName $rg -Name $connectorName + } + + $connector | Should -Not -Be $null + $connector.EnvironmentName | Should -Be "GitLab" + } +} diff --git a/src/Security/Security.Autorest/test/New-AzSecurityConnectorActionableRemediationObject.Tests.ps1 b/src/Security/Security.Autorest/test/New-AzSecurityConnectorActionableRemediationObject.Tests.ps1 new file mode 100644 index 000000000000..670b86141da1 --- /dev/null +++ b/src/Security/Security.Autorest/test/New-AzSecurityConnectorActionableRemediationObject.Tests.ps1 @@ -0,0 +1,26 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzSecurityConnectorActionableRemediationObject')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzSecurityConnectorActionableRemediationObject.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'New-AzSecurityConnectorActionableRemediationObject' { + It '__AllParameterSets' { + $config = New-AzSecurityConnectorActionableRemediationObject -State Enabled -InheritFromParentState Disabled ` + -BranchConfiguration @{AnnotateDefaultBranch="Enabled"; branchName=@("main", "hotfix")} -CategoryConfiguration @( @{category="First"; minimumSeverityLevel="High"}, @{category="Second"; minimumSeverityLevel="Low"}) + $config.State | Should -Be "Enabled" + $config.InheritFromParentState | Should -Be "Disabled" + $config.CategoryConfiguration.Count | Should -Be 2 + $config.BranchConfiguration.BranchName.Count | Should -Be 2 + } +} diff --git a/src/Security/Security.Autorest/test/New-AzSecurityConnectorDevOpsConfiguration.Recording.json b/src/Security/Security.Autorest/test/New-AzSecurityConnectorDevOpsConfiguration.Recording.json new file mode 100644 index 000000000000..2c9c583d5490 --- /dev/null +++ b/src/Security/Security.Autorest/test/New-AzSecurityConnectorDevOpsConfiguration.Recording.json @@ -0,0 +1,266 @@ +{ + "New-AzSecurityConnectorDevOpsConfiguration+[NoContext]+CreateExpanded+$PUT+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/securityConnectors-pwsh-tmp/providers/Microsoft.Security/securityConnectors/ado-sdk-pwsh-test02?api-version=2023-10-01-preview+1": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/securityConnectors-pwsh-tmp/providers/Microsoft.Security/securityConnectors/ado-sdk-pwsh-test02?api-version=2023-10-01-preview", + "Content": "{\r\n \"location\": \"CentralUS\",\r\n \"properties\": {\r\n \"hierarchyIdentifier\": \"75ebbca5-8b2b-48b2-93e6-d241b2993ed3\",\r\n \"environmentName\": \"AzureDevOps\",\r\n \"offerings\": [\r\n {\r\n \"offeringType\": \"CspmMonitorAzureDevOps\"\r\n }\r\n ],\r\n \"environmentData\": {\r\n \"environmentType\": \"AzureDevOpsScope\"\r\n }\r\n }\r\n}", + "isContentBase64": false, + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "337" ] + } + }, + "Response": { + "StatusCode": 201, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-resource-requests": [ "249" ], + "x-ms-request-id": [ "256fbf3d-8a56-4939-a5bb-86e913bbfd32" ], + "x-ms-correlation-request-id": [ "256fbf3d-8a56-4939-a5bb-86e913bbfd32" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T021048Z:256fbf3d-8a56-4939-a5bb-86e913bbfd32" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: F906DEEB0C8B476A811AC68909AC39E1 Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:10:47Z" ], + "Date": [ "Wed, 14 Feb 2024 02:10:48 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "779" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"offerings\":[{\"offeringType\":\"CspmMonitorAzureDevOps\"}],\"environmentName\":\"AzureDevOps\",\"hierarchyIdentifier\":\"75ebbca5-8b2b-48b2-93e6-d241b2993ed3\",\"environmentData\":{\"environmentType\":\"AzureDevOpsScope\"}},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourcegroups/securityconnectors-pwsh-tmp/providers/Microsoft.Security/securityConnectors/ado-sdk-pwsh-test02\",\"name\":\"ado-sdk-pwsh-test02\",\"type\":\"Microsoft.Security/securityconnectors\",\"location\":\"CentralUS\",\"tags\":{},\"systemData\":{\"createdBy\":\"c3d82ccb-fee1-430c-949e-6c0a217c00a8\",\"createdByType\":\"Application\",\"createdAt\":\"2024-02-14T02:10:47.9139838Z\",\"lastModifiedBy\":\"c3d82ccb-fee1-430c-949e-6c0a217c00a8\",\"lastModifiedByType\":\"Application\",\"lastModifiedAt\":\"2024-02-14T02:10:47.9139838Z\"}}", + "isContentBase64": false + } + }, + "New-AzSecurityConnectorDevOpsConfiguration+[NoContext]+CreateExpanded+$PUT+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/securityConnectors-pwsh-tmp/providers/Microsoft.Security/securityConnectors/ado-sdk-pwsh-test02/devops/default?api-version=2023-09-01-preview+2": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/securityConnectors-pwsh-tmp/providers/Microsoft.Security/securityConnectors/ado-sdk-pwsh-test02/devops/default?api-version=2023-09-01-preview", + "Content": "{\r\n \"properties\": {\r\n \"authorization\": {\r\n \"code\": \"dummyCode\"\r\n },\r\n \"autoDiscovery\": \"Disabled\",\r\n \"topLevelInventoryList\": [ \"abc\", \"def\" ]\r\n }\r\n}", + "isContentBase64": false, + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "168" ] + } + }, + "Response": { + "StatusCode": 201, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Retry-After": [ "20" ], + "Set-Cookie": [ "ARRAffinity=14a5c7981ca45a6803ac375748e68dc9b495d4e56b3202b86256249c9784b400;Path=/;HttpOnly;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com", "ARRAffinitySameSite=14a5c7981ca45a6803ac375748e68dc9b495d4e56b3202b86256249c9784b400;Path=/;HttpOnly;SameSite=None;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1199" ], + "Request-Context": [ "appId=cid-v1:b8e19897-bfe4-49ad-ad76-b9526fa18eea" ], + "mise-correlation-id": [ "a809d42d-a2cc-4bb6-8aab-f6391a828f77" ], + "Azure-AsyncOperation": [ "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/securityConnectors-pwsh-tmp/providers/Microsoft.Security/securityConnectors/ado-sdk-pwsh-test02/devops/default/operationResults/b5d1fdf5-beec-43e1-893c-bd26ebc0b954?api-version=2023-09-01-preview\u0026t=638434734513279119\u0026c=MIIHADCCBeigAwIBAgITfARmPsJdo2ShuN-ImAAABGY-wjANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDUwHhcNMjQwMTMxMjIwNzA5WhcNMjUwMTI1MjIwNzA5WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOVFiSMi9Sg6cKnrBuPHbDk_Zwa1ZNYHwLVPJArEI9N2bLrgd1mU0ZdNVcdf6rtZCkUUuCe3vxnVTGwufpwH9GPWDgJOpJoL9wgKOzUDiHLUeiWPjrK1AoaQVprZgjnzXBIWiZC2tZjbUT9pOI_ixYJJPrsCfLt7HEccnhObROE1mo_hpiPDrtOQDaX-BboNceB8vI1wmSPApGpPRM9hBRQbXgqKFC8094UNsMVkWPCrsPvP5YlMBLARlGf2WTevGKRREjstkApf1Swi7uKnpyhhsidD1yREMU0mWY9wnZfAX0jpEp3p9jKVMPQ3L-m-nSZI4zrtbW0AnI0O3pAEwe0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9DTzFQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA1LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MB0GA1UdDgQWBBT2vcy9ccvhGewsiHI1BQHsz3Wn8zAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBR61hmFKHlscXYeYPjzS--iBUIWHTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBADNBZjhX44bpBtC8kogZJGe4lYeHX95whfZ7X_CMSUuZRbQQ_b6raUpp8V8eF0YUa9b3Oa-DGrs5WfzogCuGcJPeoEVnDYzc1jlKubSIpGw73aGZzhbTjJeNf-Qe-5vTG-GcNzVtIcrwi93YSiK2LSbgrLpTL7T7znjePcGRRkCBjAslrV5SqufcsrpGmqvPAVKXRV-OIOzvXy6qmn9CHmdo0RGBXGIakbLMec_1SIS8NdPsB6i6XPjL2SDjqKTa5car7bVYlXEVsgL-000VF1t6x1II3VBNfsEJ81CdJyxaCJnwvWI6kHtCtJX9QYK3qZab9PfZRBvcetJoPdMFvBU\u0026s=usSIoSYp5NLDL7ddddInM2GZQRUwZiIvmCjTZB3XjNE_q_QdYjEfz_Xf0o-8kwuSaN6GxrcKTGxwLPJh85eWEZlBcXcvUDcvg7XmKArSytjmblRDHBQO4k6Sm_V3nHi6ySbleKpscxaWlmY7jI3JsnZz5ABgbKumvtB41H1lwlnM_3fJoaexe9fFUcRAIK2oGC4esrNSHLRyG51BP_6hcvQoJl4scj-6dE01-BEl8EmLnZRxVgmrftmvCOKcKDvm2cRuajHA-lF1eAjuv-af8owf8n8cdM4xU3HAw1P0BUd9FQSvkh_7UTvXFa__EjC0TEiG4K8f8PlcDnr-7I5HXg\u0026h=5OoXakCfO4X3DCVPJfmiH0eBX52K5zl0KZpSaqkFg_s" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-request-id": [ "11cf66c1-49ed-40a9-8335-2b832ccacde4" ], + "x-ms-correlation-request-id": [ "11cf66c1-49ed-40a9-8335-2b832ccacde4" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T021051Z:11cf66c1-49ed-40a9-8335-2b832ccacde4" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 18553A070F6A48A08E4CFE09B3A8A05B Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:10:48Z" ], + "Date": [ "Wed, 14 Feb 2024 02:10:50 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "405" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"tags\":{},\"properties\":{\"authorization\":{\"code\":\"\"},\"autoDiscovery\":\"Disabled\",\"topLevelInventoryList\":[\"abc\",\"def\"],\"provisioningState\":\"Pending\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/securityConnectors-pwsh-tmp/providers/Microsoft.Security/securityConnectors/ado-sdk-pwsh-test02/devops/default\",\"name\":\"default\",\"type\":\"Microsoft.Security/securityConnectors/devops\"}", + "isContentBase64": false + } + }, + "New-AzSecurityConnectorDevOpsConfiguration+[NoContext]+CreateExpanded+$GET+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/securityConnectors-pwsh-tmp/providers/Microsoft.Security/securityConnectors/ado-sdk-pwsh-test02/devops/default/operationResults/b5d1fdf5-beec-43e1-893c-bd26ebc0b954?api-version=2023-09-01-preview\u0026t=638434734513279119\u0026c=MIIHADCCBeigAwIBAgITfARmPsJdo2ShuN-ImAAABGY-wjANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDUwHhcNMjQwMTMxMjIwNzA5WhcNMjUwMTI1MjIwNzA5WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOVFiSMi9Sg6cKnrBuPHbDk_Zwa1ZNYHwLVPJArEI9N2bLrgd1mU0ZdNVcdf6rtZCkUUuCe3vxnVTGwufpwH9GPWDgJOpJoL9wgKOzUDiHLUeiWPjrK1AoaQVprZgjnzXBIWiZC2tZjbUT9pOI_ixYJJPrsCfLt7HEccnhObROE1mo_hpiPDrtOQDaX-BboNceB8vI1wmSPApGpPRM9hBRQbXgqKFC8094UNsMVkWPCrsPvP5YlMBLARlGf2WTevGKRREjstkApf1Swi7uKnpyhhsidD1yREMU0mWY9wnZfAX0jpEp3p9jKVMPQ3L-m-nSZI4zrtbW0AnI0O3pAEwe0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9DTzFQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA1LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MB0GA1UdDgQWBBT2vcy9ccvhGewsiHI1BQHsz3Wn8zAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBR61hmFKHlscXYeYPjzS--iBUIWHTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBADNBZjhX44bpBtC8kogZJGe4lYeHX95whfZ7X_CMSUuZRbQQ_b6raUpp8V8eF0YUa9b3Oa-DGrs5WfzogCuGcJPeoEVnDYzc1jlKubSIpGw73aGZzhbTjJeNf-Qe-5vTG-GcNzVtIcrwi93YSiK2LSbgrLpTL7T7znjePcGRRkCBjAslrV5SqufcsrpGmqvPAVKXRV-OIOzvXy6qmn9CHmdo0RGBXGIakbLMec_1SIS8NdPsB6i6XPjL2SDjqKTa5car7bVYlXEVsgL-000VF1t6x1II3VBNfsEJ81CdJyxaCJnwvWI6kHtCtJX9QYK3qZab9PfZRBvcetJoPdMFvBU\u0026s=usSIoSYp5NLDL7ddddInM2GZQRUwZiIvmCjTZB3XjNE_q_QdYjEfz_Xf0o-8kwuSaN6GxrcKTGxwLPJh85eWEZlBcXcvUDcvg7XmKArSytjmblRDHBQO4k6Sm_V3nHi6ySbleKpscxaWlmY7jI3JsnZz5ABgbKumvtB41H1lwlnM_3fJoaexe9fFUcRAIK2oGC4esrNSHLRyG51BP_6hcvQoJl4scj-6dE01-BEl8EmLnZRxVgmrftmvCOKcKDvm2cRuajHA-lF1eAjuv-af8owf8n8cdM4xU3HAw1P0BUd9FQSvkh_7UTvXFa__EjC0TEiG4K8f8PlcDnr-7I5HXg\u0026h=5OoXakCfO4X3DCVPJfmiH0eBX52K5zl0KZpSaqkFg_s+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/securityConnectors-pwsh-tmp/providers/Microsoft.Security/securityConnectors/ado-sdk-pwsh-test02/devops/default/operationResults/b5d1fdf5-beec-43e1-893c-bd26ebc0b954?api-version=2023-09-01-preview\u0026t=638434734513279119\u0026c=MIIHADCCBeigAwIBAgITfARmPsJdo2ShuN-ImAAABGY-wjANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDUwHhcNMjQwMTMxMjIwNzA5WhcNMjUwMTI1MjIwNzA5WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOVFiSMi9Sg6cKnrBuPHbDk_Zwa1ZNYHwLVPJArEI9N2bLrgd1mU0ZdNVcdf6rtZCkUUuCe3vxnVTGwufpwH9GPWDgJOpJoL9wgKOzUDiHLUeiWPjrK1AoaQVprZgjnzXBIWiZC2tZjbUT9pOI_ixYJJPrsCfLt7HEccnhObROE1mo_hpiPDrtOQDaX-BboNceB8vI1wmSPApGpPRM9hBRQbXgqKFC8094UNsMVkWPCrsPvP5YlMBLARlGf2WTevGKRREjstkApf1Swi7uKnpyhhsidD1yREMU0mWY9wnZfAX0jpEp3p9jKVMPQ3L-m-nSZI4zrtbW0AnI0O3pAEwe0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9DTzFQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA1LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MB0GA1UdDgQWBBT2vcy9ccvhGewsiHI1BQHsz3Wn8zAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBR61hmFKHlscXYeYPjzS--iBUIWHTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBADNBZjhX44bpBtC8kogZJGe4lYeHX95whfZ7X_CMSUuZRbQQ_b6raUpp8V8eF0YUa9b3Oa-DGrs5WfzogCuGcJPeoEVnDYzc1jlKubSIpGw73aGZzhbTjJeNf-Qe-5vTG-GcNzVtIcrwi93YSiK2LSbgrLpTL7T7znjePcGRRkCBjAslrV5SqufcsrpGmqvPAVKXRV-OIOzvXy6qmn9CHmdo0RGBXGIakbLMec_1SIS8NdPsB6i6XPjL2SDjqKTa5car7bVYlXEVsgL-000VF1t6x1II3VBNfsEJ81CdJyxaCJnwvWI6kHtCtJX9QYK3qZab9PfZRBvcetJoPdMFvBU\u0026s=usSIoSYp5NLDL7ddddInM2GZQRUwZiIvmCjTZB3XjNE_q_QdYjEfz_Xf0o-8kwuSaN6GxrcKTGxwLPJh85eWEZlBcXcvUDcvg7XmKArSytjmblRDHBQO4k6Sm_V3nHi6ySbleKpscxaWlmY7jI3JsnZz5ABgbKumvtB41H1lwlnM_3fJoaexe9fFUcRAIK2oGC4esrNSHLRyG51BP_6hcvQoJl4scj-6dE01-BEl8EmLnZRxVgmrftmvCOKcKDvm2cRuajHA-lF1eAjuv-af8owf8n8cdM4xU3HAw1P0BUd9FQSvkh_7UTvXFa__EjC0TEiG4K8f8PlcDnr-7I5HXg\u0026h=5OoXakCfO4X3DCVPJfmiH0eBX52K5zl0KZpSaqkFg_s", + "Content": null, + "isContentBase64": false, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "57" ], + "x-ms-client-request-id": [ "30bb0587-40f3-43e9-8328-7a0d60f34541" ], + "CommandName": [ "New-AzSecurityConnectorDevOpsConfiguration" ], + "FullCommandName": [ "New-AzSecurityConnectorDevOpsConfiguration_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Retry-After": [ "20" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=1c6c7a0a18efcd0c1f62ff61ff05f8a61bfe22533cfce5122cfd179979045df0;Path=/;HttpOnly;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com", "ARRAffinitySameSite=1c6c7a0a18efcd0c1f62ff61ff05f8a61bfe22533cfce5122cfd179979045df0;Path=/;HttpOnly;SameSite=None;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "Request-Context": [ "appId=cid-v1:b8e19897-bfe4-49ad-ad76-b9526fa18eea" ], + "mise-correlation-id": [ "7ce0cd86-2af9-4de0-8350-c5755ec1ccf0" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-request-id": [ "b503bd4e-f468-4b25-954e-88fef66b6edd" ], + "x-ms-correlation-request-id": [ "b503bd4e-f468-4b25-954e-88fef66b6edd" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T021111Z:b503bd4e-f468-4b25-954e-88fef66b6edd" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 4C1AE0C8194B468C8681E27B74A2571B Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:11:11Z" ], + "Date": [ "Wed, 14 Feb 2024 02:11:11 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "479" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/securityConnectors-pwsh-tmp/providers/Microsoft.Security/securityConnectors/ado-sdk-pwsh-test02/devops/default/operationResults/b5d1fdf5-beec-43e1-893c-bd26ebc0b954\",\"name\":\"b5d1fdf5-beec-43e1-893c-bd26ebc0b954\",\"status\":\"Failed\",\"startTime\":\"2024-02-14T02:10:49.5752881Z\",\"endTime\":\"2024-02-14T02:11:05.5830468Z\",\"error\":{\"code\":\"TokenExchangeFailed\",\"message\":\"AzureDevOps OAuth token exchange failed\"}}", + "isContentBase64": false + } + }, + "New-AzSecurityConnectorDevOpsConfiguration+[NoContext]+CreateExpanded+$DELETE+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/securityConnectors-pwsh-tmp/providers/Microsoft.Security/securityConnectors/ado-sdk-pwsh-test02/devops/default?api-version=2023-09-01-preview+4": { + "Request": { + "Method": "DELETE", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/securityConnectors-pwsh-tmp/providers/Microsoft.Security/securityConnectors/ado-sdk-pwsh-test02/devops/default?api-version=2023-09-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "58" ], + "x-ms-client-request-id": [ "592d513a-5ee1-402b-9b0d-ccae4679b155" ], + "CommandName": [ "Remove-AzSecurityConnectorDevOpsConfiguration" ], + "FullCommandName": [ "Remove-AzSecurityConnectorDevOpsConfiguration_Delete" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Retry-After": [ "20" ], + "Set-Cookie": [ "ARRAffinity=ca594a79766484e25889904bf326227201e6905138dd325ca221b8b7af91ccae;Path=/;HttpOnly;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com", "ARRAffinitySameSite=ca594a79766484e25889904bf326227201e6905138dd325ca221b8b7af91ccae;Path=/;HttpOnly;SameSite=None;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com" ], + "x-ms-ratelimit-remaining-subscription-deletes": [ "14999" ], + "Request-Context": [ "appId=cid-v1:b8e19897-bfe4-49ad-ad76-b9526fa18eea" ], + "mise-correlation-id": [ "b1f73c89-a1d2-4594-86dd-3992fc19ef2b" ], + "Azure-AsyncOperation": [ "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/securityConnectors-pwsh-tmp/providers/Microsoft.Security/securityConnectors/ado-sdk-pwsh-test02/devops/default/operationResults/c200bb06-4204-4a06-9085-41fede78cef2?api-version=2023-09-01-preview\u0026t=638434734726964462\u0026c=MIIHADCCBeigAwIBAgITfARmPsJdo2ShuN-ImAAABGY-wjANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDUwHhcNMjQwMTMxMjIwNzA5WhcNMjUwMTI1MjIwNzA5WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOVFiSMi9Sg6cKnrBuPHbDk_Zwa1ZNYHwLVPJArEI9N2bLrgd1mU0ZdNVcdf6rtZCkUUuCe3vxnVTGwufpwH9GPWDgJOpJoL9wgKOzUDiHLUeiWPjrK1AoaQVprZgjnzXBIWiZC2tZjbUT9pOI_ixYJJPrsCfLt7HEccnhObROE1mo_hpiPDrtOQDaX-BboNceB8vI1wmSPApGpPRM9hBRQbXgqKFC8094UNsMVkWPCrsPvP5YlMBLARlGf2WTevGKRREjstkApf1Swi7uKnpyhhsidD1yREMU0mWY9wnZfAX0jpEp3p9jKVMPQ3L-m-nSZI4zrtbW0AnI0O3pAEwe0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9DTzFQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA1LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MB0GA1UdDgQWBBT2vcy9ccvhGewsiHI1BQHsz3Wn8zAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBR61hmFKHlscXYeYPjzS--iBUIWHTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBADNBZjhX44bpBtC8kogZJGe4lYeHX95whfZ7X_CMSUuZRbQQ_b6raUpp8V8eF0YUa9b3Oa-DGrs5WfzogCuGcJPeoEVnDYzc1jlKubSIpGw73aGZzhbTjJeNf-Qe-5vTG-GcNzVtIcrwi93YSiK2LSbgrLpTL7T7znjePcGRRkCBjAslrV5SqufcsrpGmqvPAVKXRV-OIOzvXy6qmn9CHmdo0RGBXGIakbLMec_1SIS8NdPsB6i6XPjL2SDjqKTa5car7bVYlXEVsgL-000VF1t6x1II3VBNfsEJ81CdJyxaCJnwvWI6kHtCtJX9QYK3qZab9PfZRBvcetJoPdMFvBU\u0026s=UGsK_0AMcS5_W7lB4PudsKl7qCSA4JWWeSNpvocGA4IFrJCX0Ya-9ZB2xVRBKWJnX6c3yxRxIVgJVloB9rlQhIMp6Op5HW5B0WQAMqHa9jGrn7yBaSaaa9Zlf1eKJzz3-1DggGpobLBbrJYbWC_SUml39A0v1r48dE4NZ7htoWCIDJ_5-F4sXSmY5PppjgFLTTiCtffHRMhAq5fp7daNQy0W5P1sZZ-jDfeClorEQgD7O32v4tfjtIhTcKNaxd-ax4bm0DqFn-b11QQuDs6QXX3_i8aeIRetJ5Pgkjdn50IXG4uS6bbS-pENGudxEXxDPzH_u2u9awBQE6oySLo2rQ\u0026h=Jc8eZTvsCKxvcNiCM1c3-BkACrs1-21xY9R-IoYaG58" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-request-id": [ "c469118c-1f5c-4de6-8c60-c6ecf243332f" ], + "x-ms-correlation-request-id": [ "c469118c-1f5c-4de6-8c60-c6ecf243332f" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T021112Z:c469118c-1f5c-4de6-8c60-c6ecf243332f" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 0D10F3A5BCE8490FBB9BA22226B2D794 Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:11:12Z" ], + "Date": [ "Wed, 14 Feb 2024 02:11:12 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "283" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"tags\":{},\"properties\":{},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/securityConnectors-pwsh-tmp/providers/Microsoft.Security/securityConnectors/ado-sdk-pwsh-test02/devops/default\",\"name\":\"default\",\"type\":\"Microsoft.Security/securityConnectors/devops\"}", + "isContentBase64": false + } + }, + "New-AzSecurityConnectorDevOpsConfiguration+[NoContext]+CreateExpanded+$GET+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/securityConnectors-pwsh-tmp/providers/Microsoft.Security/securityConnectors/ado-sdk-pwsh-test02/devops/default/operationResults/c200bb06-4204-4a06-9085-41fede78cef2?api-version=2023-09-01-preview\u0026t=638434734726964462\u0026c=MIIHADCCBeigAwIBAgITfARmPsJdo2ShuN-ImAAABGY-wjANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDUwHhcNMjQwMTMxMjIwNzA5WhcNMjUwMTI1MjIwNzA5WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOVFiSMi9Sg6cKnrBuPHbDk_Zwa1ZNYHwLVPJArEI9N2bLrgd1mU0ZdNVcdf6rtZCkUUuCe3vxnVTGwufpwH9GPWDgJOpJoL9wgKOzUDiHLUeiWPjrK1AoaQVprZgjnzXBIWiZC2tZjbUT9pOI_ixYJJPrsCfLt7HEccnhObROE1mo_hpiPDrtOQDaX-BboNceB8vI1wmSPApGpPRM9hBRQbXgqKFC8094UNsMVkWPCrsPvP5YlMBLARlGf2WTevGKRREjstkApf1Swi7uKnpyhhsidD1yREMU0mWY9wnZfAX0jpEp3p9jKVMPQ3L-m-nSZI4zrtbW0AnI0O3pAEwe0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9DTzFQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA1LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MB0GA1UdDgQWBBT2vcy9ccvhGewsiHI1BQHsz3Wn8zAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBR61hmFKHlscXYeYPjzS--iBUIWHTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBADNBZjhX44bpBtC8kogZJGe4lYeHX95whfZ7X_CMSUuZRbQQ_b6raUpp8V8eF0YUa9b3Oa-DGrs5WfzogCuGcJPeoEVnDYzc1jlKubSIpGw73aGZzhbTjJeNf-Qe-5vTG-GcNzVtIcrwi93YSiK2LSbgrLpTL7T7znjePcGRRkCBjAslrV5SqufcsrpGmqvPAVKXRV-OIOzvXy6qmn9CHmdo0RGBXGIakbLMec_1SIS8NdPsB6i6XPjL2SDjqKTa5car7bVYlXEVsgL-000VF1t6x1II3VBNfsEJ81CdJyxaCJnwvWI6kHtCtJX9QYK3qZab9PfZRBvcetJoPdMFvBU\u0026s=UGsK_0AMcS5_W7lB4PudsKl7qCSA4JWWeSNpvocGA4IFrJCX0Ya-9ZB2xVRBKWJnX6c3yxRxIVgJVloB9rlQhIMp6Op5HW5B0WQAMqHa9jGrn7yBaSaaa9Zlf1eKJzz3-1DggGpobLBbrJYbWC_SUml39A0v1r48dE4NZ7htoWCIDJ_5-F4sXSmY5PppjgFLTTiCtffHRMhAq5fp7daNQy0W5P1sZZ-jDfeClorEQgD7O32v4tfjtIhTcKNaxd-ax4bm0DqFn-b11QQuDs6QXX3_i8aeIRetJ5Pgkjdn50IXG4uS6bbS-pENGudxEXxDPzH_u2u9awBQE6oySLo2rQ\u0026h=Jc8eZTvsCKxvcNiCM1c3-BkACrs1-21xY9R-IoYaG58+5": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/securityConnectors-pwsh-tmp/providers/Microsoft.Security/securityConnectors/ado-sdk-pwsh-test02/devops/default/operationResults/c200bb06-4204-4a06-9085-41fede78cef2?api-version=2023-09-01-preview\u0026t=638434734726964462\u0026c=MIIHADCCBeigAwIBAgITfARmPsJdo2ShuN-ImAAABGY-wjANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDUwHhcNMjQwMTMxMjIwNzA5WhcNMjUwMTI1MjIwNzA5WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOVFiSMi9Sg6cKnrBuPHbDk_Zwa1ZNYHwLVPJArEI9N2bLrgd1mU0ZdNVcdf6rtZCkUUuCe3vxnVTGwufpwH9GPWDgJOpJoL9wgKOzUDiHLUeiWPjrK1AoaQVprZgjnzXBIWiZC2tZjbUT9pOI_ixYJJPrsCfLt7HEccnhObROE1mo_hpiPDrtOQDaX-BboNceB8vI1wmSPApGpPRM9hBRQbXgqKFC8094UNsMVkWPCrsPvP5YlMBLARlGf2WTevGKRREjstkApf1Swi7uKnpyhhsidD1yREMU0mWY9wnZfAX0jpEp3p9jKVMPQ3L-m-nSZI4zrtbW0AnI0O3pAEwe0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9DTzFQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA1LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MB0GA1UdDgQWBBT2vcy9ccvhGewsiHI1BQHsz3Wn8zAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBR61hmFKHlscXYeYPjzS--iBUIWHTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBADNBZjhX44bpBtC8kogZJGe4lYeHX95whfZ7X_CMSUuZRbQQ_b6raUpp8V8eF0YUa9b3Oa-DGrs5WfzogCuGcJPeoEVnDYzc1jlKubSIpGw73aGZzhbTjJeNf-Qe-5vTG-GcNzVtIcrwi93YSiK2LSbgrLpTL7T7znjePcGRRkCBjAslrV5SqufcsrpGmqvPAVKXRV-OIOzvXy6qmn9CHmdo0RGBXGIakbLMec_1SIS8NdPsB6i6XPjL2SDjqKTa5car7bVYlXEVsgL-000VF1t6x1II3VBNfsEJ81CdJyxaCJnwvWI6kHtCtJX9QYK3qZab9PfZRBvcetJoPdMFvBU\u0026s=UGsK_0AMcS5_W7lB4PudsKl7qCSA4JWWeSNpvocGA4IFrJCX0Ya-9ZB2xVRBKWJnX6c3yxRxIVgJVloB9rlQhIMp6Op5HW5B0WQAMqHa9jGrn7yBaSaaa9Zlf1eKJzz3-1DggGpobLBbrJYbWC_SUml39A0v1r48dE4NZ7htoWCIDJ_5-F4sXSmY5PppjgFLTTiCtffHRMhAq5fp7daNQy0W5P1sZZ-jDfeClorEQgD7O32v4tfjtIhTcKNaxd-ax4bm0DqFn-b11QQuDs6QXX3_i8aeIRetJ5Pgkjdn50IXG4uS6bbS-pENGudxEXxDPzH_u2u9awBQE6oySLo2rQ\u0026h=Jc8eZTvsCKxvcNiCM1c3-BkACrs1-21xY9R-IoYaG58", + "Content": null, + "isContentBase64": false, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "59" ], + "x-ms-client-request-id": [ "592d513a-5ee1-402b-9b0d-ccae4679b155" ], + "CommandName": [ "Remove-AzSecurityConnectorDevOpsConfiguration" ], + "FullCommandName": [ "Remove-AzSecurityConnectorDevOpsConfiguration_Delete" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Retry-After": [ "20" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=b0d653e3d2c4fba6e75578139341b84b35dee63a8a317f007b2447d8196b79e5;Path=/;HttpOnly;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com", "ARRAffinitySameSite=b0d653e3d2c4fba6e75578139341b84b35dee63a8a317f007b2447d8196b79e5;Path=/;HttpOnly;SameSite=None;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "Request-Context": [ "appId=cid-v1:b8e19897-bfe4-49ad-ad76-b9526fa18eea" ], + "mise-correlation-id": [ "39ed5d72-802a-4319-be30-b0f52129f129" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-request-id": [ "980a1fba-f8e3-4e06-95ad-0fdc5adeda1f" ], + "x-ms-correlation-request-id": [ "980a1fba-f8e3-4e06-95ad-0fdc5adeda1f" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T021133Z:980a1fba-f8e3-4e06-95ad-0fdc5adeda1f" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 9423D424E0EF4AB18E366CB46721DD1B Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:11:33Z" ], + "Date": [ "Wed, 14 Feb 2024 02:11:32 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "389" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/securityConnectors-pwsh-tmp/providers/Microsoft.Security/securityConnectors/ado-sdk-pwsh-test02/devops/default/operationResults/c200bb06-4204-4a06-9085-41fede78cef2\",\"name\":\"c200bb06-4204-4a06-9085-41fede78cef2\",\"status\":\"Succeeded\",\"startTime\":\"2024-02-14T02:11:12.502874Z\",\"endTime\":\"2024-02-14T02:11:21.740658Z\"}", + "isContentBase64": false + } + }, + "New-AzSecurityConnectorDevOpsConfiguration+[NoContext]+CreateExpanded+$DELETE+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/securityConnectors-pwsh-tmp/providers/Microsoft.Security/securityConnectors/ado-sdk-pwsh-test02?api-version=2023-10-01-preview+6": { + "Request": { + "Method": "DELETE", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/securityConnectors-pwsh-tmp/providers/Microsoft.Security/securityConnectors/ado-sdk-pwsh-test02?api-version=2023-10-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "60" ], + "x-ms-client-request-id": [ "b5675799-81cc-4f7e-8cb7-5669dca79287" ], + "CommandName": [ "Remove-AzSecurityConnector" ], + "FullCommandName": [ "Remove-AzSecurityConnector_Delete" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 204, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-resource-requests": [ "249" ], + "x-ms-request-id": [ "78ed26ee-7a7f-4fec-ab0d-bbf341d5c6d1" ], + "x-ms-correlation-request-id": [ "78ed26ee-7a7f-4fec-ab0d-bbf341d5c6d1" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T021137Z:78ed26ee-7a7f-4fec-ab0d-bbf341d5c6d1" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: BA13D686BC1242DB86CD6DBF9544A773 Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:11:33Z" ], + "Date": [ "Wed, 14 Feb 2024 02:11:36 GMT" ] + }, + "ContentHeaders": { + "Expires": [ "-1" ] + }, + "Content": null, + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/test/New-AzSecurityConnectorDevOpsConfiguration.Tests.ps1 b/src/Security/Security.Autorest/test/New-AzSecurityConnectorDevOpsConfiguration.Tests.ps1 new file mode 100644 index 000000000000..3cc529dca01b --- /dev/null +++ b/src/Security/Security.Autorest/test/New-AzSecurityConnectorDevOpsConfiguration.Tests.ps1 @@ -0,0 +1,37 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzSecurityConnectorDevOpsConfiguration')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzSecurityConnectorDevOpsConfiguration.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'New-AzSecurityConnectorDevOpsConfiguration' { + It 'CreateExpanded' { + $rg = "securityConnectors-pwsh-tmp" + $sid = $env.SubscriptionId + $connectorName = "ado-sdk-pwsh-test02" + $hierarchyIdentifier = "75ebbca5-8b2b-48b2-93e6-d241b2993ed3" + + # Tests require complecated environment setup. For now, validating that resource provider is accepting payload and trying to access DevOps environment + try { + New-AzSecurityConnector -SubscriptionId $sid -ResourceGroupName $rg -Name $connectorName -EnvironmentName AzureDevOps -EnvironmentData (New-AzSecurityAzureDevOpsScopeEnvironmentObject) -HierarchyIdentifier $hierarchyIdentifier -Location "CentralUS" -Offering @(New-AzSecurityCspmMonitorAzureDevOpsOfferingObject) + + New-AzSecurityConnectorDevOpsConfiguration -SubscriptionId $sid -ResourceGroupName $rg -SecurityConnectorName $connectorName -AutoDiscovery Disabled -TopLevelInventoryList @("abc", "def") -AuthorizationCode "dummyCode" + } catch { + $Error[0] | Should -Match "OAuth token exchange failed" + $Error[0].Exception.ResponseBody | Should -Match "TokenExchangeFailed" + } finally { + try { Remove-AzSecurityConnectorDevOpsConfiguration -SubscriptionId $sid -ResourceGroupName $rg -SecurityConnectorName $connectorName } catch {} + try { Remove-AzSecurityConnector -SubscriptionId $sid -ResourceGroupName $rg -Name $connectorName } catch {} + } + } +} diff --git a/src/Security/Security.Autorest/test/New-AzSecurityCspmMonitorAwsOfferingObject.Tests.ps1 b/src/Security/Security.Autorest/test/New-AzSecurityCspmMonitorAwsOfferingObject.Tests.ps1 new file mode 100644 index 000000000000..2c6245c1c3e4 --- /dev/null +++ b/src/Security/Security.Autorest/test/New-AzSecurityCspmMonitorAwsOfferingObject.Tests.ps1 @@ -0,0 +1,22 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzSecurityCspmMonitorAwsOfferingObject')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzSecurityCspmMonitorAwsOfferingObject.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'New-AzSecurityCspmMonitorAwsOfferingObject' { + It '__AllParameterSets' { + $offering = New-AzSecurityCspmMonitorAwsOfferingObject -NativeCloudConnectionCloudRoleArn "arn:aws:iam::123456789012:role/CspmMonitorAws" + $offering.OfferingType | Should -Be "CspmMonitorAws" + } +} diff --git a/src/Security/Security.Autorest/test/New-AzSecurityCspmMonitorAzureDevOpsOfferingObject.Tests.ps1 b/src/Security/Security.Autorest/test/New-AzSecurityCspmMonitorAzureDevOpsOfferingObject.Tests.ps1 new file mode 100644 index 000000000000..485abe547b9a --- /dev/null +++ b/src/Security/Security.Autorest/test/New-AzSecurityCspmMonitorAzureDevOpsOfferingObject.Tests.ps1 @@ -0,0 +1,22 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzSecurityCspmMonitorAzureDevOpsOfferingObject')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzSecurityCspmMonitorAzureDevOpsOfferingObject.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'New-AzSecurityCspmMonitorAzureDevOpsOfferingObject' { + It '__AllParameterSets' { + $offering = New-AzSecurityCspmMonitorAzureDevOpsOfferingObject + $offering.OfferingType | Should -Be "CspmMonitorAzureDevOps" + } +} diff --git a/src/Security/Security.Autorest/test/New-AzSecurityCspmMonitorGcpOfferingObject.Tests.ps1 b/src/Security/Security.Autorest/test/New-AzSecurityCspmMonitorGcpOfferingObject.Tests.ps1 new file mode 100644 index 000000000000..52801384ad3f --- /dev/null +++ b/src/Security/Security.Autorest/test/New-AzSecurityCspmMonitorGcpOfferingObject.Tests.ps1 @@ -0,0 +1,22 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzSecurityCspmMonitorGcpOfferingObject')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzSecurityCspmMonitorGcpOfferingObject.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'New-AzSecurityCspmMonitorGcpOfferingObject' { + It '__AllParameterSets' { + $offering = New-AzSecurityCspmMonitorGcpOfferingObject -NativeCloudConnectionServiceAccountEmailAddress "microsoft-defender-cspm@asc-sdk-samples.iam.gserviceaccount.com" -NativeCloudConnectionWorkloadIdentityProviderId "cspm" + $offering.OfferingType | Should -Be "CspmMonitorGcp" + } +} diff --git a/src/Security/Security.Autorest/test/New-AzSecurityCspmMonitorGitLabOfferingObject.Tests.ps1 b/src/Security/Security.Autorest/test/New-AzSecurityCspmMonitorGitLabOfferingObject.Tests.ps1 new file mode 100644 index 000000000000..e189c411ce91 --- /dev/null +++ b/src/Security/Security.Autorest/test/New-AzSecurityCspmMonitorGitLabOfferingObject.Tests.ps1 @@ -0,0 +1,22 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzSecurityCspmMonitorGitLabOfferingObject')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzSecurityCspmMonitorGitLabOfferingObject.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'New-AzSecurityCspmMonitorGitLabOfferingObject' { + It '__AllParameterSets' { + $offering = New-AzSecurityCspmMonitorGitLabOfferingObject + $offering.OfferingType | Should -Be "CspmMonitorGitLab" + } +} diff --git a/src/Security/Security.Autorest/test/New-AzSecurityCspmMonitorGithubOfferingObject.Tests.ps1 b/src/Security/Security.Autorest/test/New-AzSecurityCspmMonitorGithubOfferingObject.Tests.ps1 new file mode 100644 index 000000000000..ea87f0509920 --- /dev/null +++ b/src/Security/Security.Autorest/test/New-AzSecurityCspmMonitorGithubOfferingObject.Tests.ps1 @@ -0,0 +1,22 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzSecurityCspmMonitorGithubOfferingObject')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzSecurityCspmMonitorGithubOfferingObject.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'New-AzSecurityCspmMonitorGithubOfferingObject' { + It '__AllParameterSets' { + $offering = New-AzSecurityCspmMonitorGithubOfferingObject + $offering.OfferingType | Should -Be "CspmMonitorGitHub" + } +} diff --git a/src/Security/Security.Autorest/test/New-AzSecurityDefenderCspmAwsOfferingObject.Tests.ps1 b/src/Security/Security.Autorest/test/New-AzSecurityDefenderCspmAwsOfferingObject.Tests.ps1 new file mode 100644 index 000000000000..0534bd99fb4f --- /dev/null +++ b/src/Security/Security.Autorest/test/New-AzSecurityDefenderCspmAwsOfferingObject.Tests.ps1 @@ -0,0 +1,30 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzSecurityDefenderCspmAwsOfferingObject')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzSecurityDefenderCspmAwsOfferingObject.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'New-AzSecurityDefenderCspmAwsOfferingObject' { + It '__AllParameterSets' { + $arnPrefix = "arn:aws:iam::123456789012:role" + $offering = New-AzSecurityDefenderCspmAwsOfferingObject ` + -VMScannerEnabled $true -ConfigurationScanningMode Default -ConfigurationCloudRoleArn "$arnPrefix/DefenderForCloud-AgentlessScanner" -ConfigurationExclusionTag @{key="value"} ` + -DataSensitivityDiscoveryEnabled $true -DataSensitivityDiscoveryCloudRoleArn "$arnPrefix/SensitiveDataDiscovery" ` + -DatabaseDspmEnabled $true -DatabaseDspmCloudRoleArn "$arnPrefix/DefenderForCloud-DataSecurityPostureDB" ` + -CiemDiscoveryCloudRoleArn "$arnPrefix/DefenderForCloud-Ciem" -CiemOidcAzureActiveDirectoryAppName "mciem-aws-oidc-connector" -CiemOidcCloudRoleArn "$arnPrefix/DefenderForCloud-OidcCiem" ` + -MdcContainerImageAssessmentEnabled $true -MdcContainerImageAssessmentCloudRoleArn "$arnPrefix/MDCContainersImageAssessmentRole" ` + -MdcContainerAgentlessDiscoveryK8SEnabled $true -MdcContainerAgentlessDiscoveryK8SCloudRoleArn "$arnPrefix/MDCContainersAgentlessDiscoveryK8sRole" + + $offering.OfferingType | Should -Be "DefenderCspmAws" + } +} diff --git a/src/Security/Security.Autorest/test/New-AzSecurityDefenderCspmGcpOfferingObject.Tests.ps1 b/src/Security/Security.Autorest/test/New-AzSecurityDefenderCspmGcpOfferingObject.Tests.ps1 new file mode 100644 index 000000000000..eeea315ca62d --- /dev/null +++ b/src/Security/Security.Autorest/test/New-AzSecurityDefenderCspmGcpOfferingObject.Tests.ps1 @@ -0,0 +1,28 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzSecurityDefenderCspmGcpOfferingObject')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzSecurityDefenderCspmGcpOfferingObject.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'New-AzSecurityDefenderCspmGcpOfferingObject' { + It '__AllParameterSets' { + $emailSuffix = "myproject.iam.gserviceaccount.com" + $offering = New-AzSecurityDefenderCspmGcpOfferingObject ` + -VMScannerEnabled $true -ConfigurationScanningMode Default -ConfigurationExclusionTag @{key="value"} ` + -MdcContainerAgentlessDiscoveryK8SEnabled $true -MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress "mdc-containers-k8s-operator@$emailSuffix" -MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId "containers" ` + -MdcContainerImageAssessmentEnabled $true -MdcContainerImageAssessmentServiceAccountEmailAddress "mdc-containers-artifact-assess@$emailSuffix" -MdcContainerImageAssessmentWorkloadIdentityProviderId "containers" ` + -DataSensitivityDiscoveryEnabled $true -DataSensitivityDiscoveryServiceAccountEmailAddress "mdc-data-sec-posture-storage@$emailSuffix" -DataSensitivityDiscoveryWorkloadIdentityProviderId "data-security-posture-storage" ` + -CiemDiscoveryServiceAccountEmailAddress "microsoft-defender-ciem@$emailSuffix" -CiemDiscoveryAzureActiveDirectoryAppName "mciem-gcp-oidc-app" -CiemDiscoveryWorkloadIdentityProviderId "ciem-discovery" + $offering.OfferingType | Should -Be "DefenderCspmGcp" + } +} diff --git a/src/Security/Security.Autorest/test/New-AzSecurityDefenderForContainersAwsOfferingObject.Tests.ps1 b/src/Security/Security.Autorest/test/New-AzSecurityDefenderForContainersAwsOfferingObject.Tests.ps1 new file mode 100644 index 000000000000..dcf58b92afab --- /dev/null +++ b/src/Security/Security.Autorest/test/New-AzSecurityDefenderForContainersAwsOfferingObject.Tests.ps1 @@ -0,0 +1,30 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzSecurityDefenderForContainersAwsOfferingObject')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzSecurityDefenderForContainersAwsOfferingObject.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'New-AzSecurityDefenderForContainersAwsOfferingObject' { + It '__AllParameterSets' { + $arnPrefix = "arn:aws:iam::123456789012:role" + $offering = New-AzSecurityDefenderForContainersAwsOfferingObject ` + -AutoProvisioning $true -KuberneteServiceCloudRoleArn "$arnPrefix/DefenderForCloud-Containers-K8s" -KuberneteScubaReaderCloudRoleArn "$arnPrefix/DefenderForCloud-DataCollection" ` + -KinesiToS3CloudRoleArn "$arnPrefix/DefenderForCloud-Containers-K8s-kinesis-to-s3" -CloudWatchToKinesiCloudRoleArn "$arnPrefix/DefenderForCloud-Containers-K8s-cloudwatch-to-kinesis" ` + -KubeAuditRetentionTime 30 -ScubaExternalId "a47ae0a2-7bf7-482a-897a-7a139d30736c" ` + -MdcContainerAgentlessDiscoveryK8SEnabled $true -MdcContainerAgentlessDiscoveryK8SCloudRoleArn "$arnPrefix/MDCContainersAgentlessDiscoveryK8sRole" ` + -MdcContainerImageAssessmentEnabled $true -MdcContainerImageAssessmentCloudRoleArn "$arnPrefix/MDCContainersImageAssessmentRole" ` + -EnableContainerVulnerabilityAssessment $false + + $offering.OfferingType | Should -Be "DefenderForContainersAws" + } +} diff --git a/src/Security/Security.Autorest/test/New-AzSecurityDefenderForContainersGcpOfferingObject.Tests.ps1 b/src/Security/Security.Autorest/test/New-AzSecurityDefenderForContainersGcpOfferingObject.Tests.ps1 new file mode 100644 index 000000000000..03920d6c8c61 --- /dev/null +++ b/src/Security/Security.Autorest/test/New-AzSecurityDefenderForContainersGcpOfferingObject.Tests.ps1 @@ -0,0 +1,28 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzSecurityDefenderForContainersGcpOfferingObject')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzSecurityDefenderForContainersGcpOfferingObject.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'New-AzSecurityDefenderForContainersGcpOfferingObject' { + It '__AllParameterSets' { + $emailSuffix = "myproject.iam.gserviceaccount.com" + $offering = New-AzSecurityDefenderForContainersGcpOfferingObject ` + -NativeCloudConnectionServiceAccountEmailAddress "microsoft-defender-containers@$emailSuffix" -NativeCloudConnectionWorkloadIdentityProviderId "containers" ` + -DataPipelineNativeCloudConnectionServiceAccountEmailAddress "ms-defender-containers-stream@$emailSuffix" -DataPipelineNativeCloudConnectionWorkloadIdentityProviderId "containers-streams" ` + -AuditLogsAutoProvisioningFlag $true -DefenderAgentAutoProvisioningFlag $true -PolicyAgentAutoProvisioningFlag $true ` + -MdcContainerAgentlessDiscoveryK8SEnabled $true -MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId "containers" -MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress "mdc-containers-k8s-operator@$emailSuffix" ` + -MdcContainerImageAssessmentEnabled $true -MdcContainerImageAssessmentWorkloadIdentityProviderId "containers" -MdcContainerImageAssessmentServiceAccountEmailAddress "mdc-containers-artifact-assess@$emailSuffix" + $offering.OfferingType | Should -Be "DefenderForContainersGcp" + } +} diff --git a/src/Security/Security.Autorest/test/New-AzSecurityDefenderForDatabasesAwsOfferingObject.Tests.ps1 b/src/Security/Security.Autorest/test/New-AzSecurityDefenderForDatabasesAwsOfferingObject.Tests.ps1 new file mode 100644 index 000000000000..56794a20be49 --- /dev/null +++ b/src/Security/Security.Autorest/test/New-AzSecurityDefenderForDatabasesAwsOfferingObject.Tests.ps1 @@ -0,0 +1,26 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzSecurityDefenderForDatabasesAwsOfferingObject')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzSecurityDefenderForDatabasesAwsOfferingObject.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'New-AzSecurityDefenderForDatabasesAwsOfferingObject' { + It '__AllParameterSets' { + $arnPrefix = "arn:aws:iam::123456789012:role" + $offering = New-AzSecurityDefenderForDatabasesAwsOfferingObject ` + -ArcAutoProvisioningEnabled $true -ArcAutoProvisioningCloudRoleArn "$arnPrefix/DefenderForCloud-ArcAutoProvisioning" ` + -DatabaseDspmEnabled $true -DatabaseDspmCloudRoleArn "$arnPrefix/DefenderForCloud-DataSecurityPostureDB" + + $offering.OfferingType | Should -Be "DefenderForDatabasesAws" + } +} diff --git a/src/Security/Security.Autorest/test/New-AzSecurityDefenderForDatabasesGcpOfferingObject.Tests.ps1 b/src/Security/Security.Autorest/test/New-AzSecurityDefenderForDatabasesGcpOfferingObject.Tests.ps1 new file mode 100644 index 000000000000..cd9077e9f848 --- /dev/null +++ b/src/Security/Security.Autorest/test/New-AzSecurityDefenderForDatabasesGcpOfferingObject.Tests.ps1 @@ -0,0 +1,25 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzSecurityDefenderForDatabasesGcpOfferingObject')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzSecurityDefenderForDatabasesGcpOfferingObject.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'New-AzSecurityDefenderForDatabasesGcpOfferingObject' { + It '__AllParameterSets' { + $emailSuffix = "myproject.iam.gserviceaccount.com" + $offering = New-AzSecurityDefenderForDatabasesGcpOfferingObject ` + -ArcAutoProvisioningEnabled $true ` + -DefenderForDatabaseArcAutoProvisioningServiceAccountEmailAddress "microsoft-databases-arc-ap@" -DefenderForDatabaseArcAutoProvisioningWorkloadIdentityProviderId "defender-for-databases-arc-ap" + $offering.OfferingType | Should -Be "DefenderForDatabasesGcp" + } +} diff --git a/src/Security/Security.Autorest/test/New-AzSecurityDefenderForServersAwsOfferingObject.Tests.ps1 b/src/Security/Security.Autorest/test/New-AzSecurityDefenderForServersAwsOfferingObject.Tests.ps1 new file mode 100644 index 000000000000..d99e5c7ec0da --- /dev/null +++ b/src/Security/Security.Autorest/test/New-AzSecurityDefenderForServersAwsOfferingObject.Tests.ps1 @@ -0,0 +1,30 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzSecurityDefenderForServersAwsOfferingObject')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzSecurityDefenderForServersAwsOfferingObject.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'New-AzSecurityDefenderForServersAwsOfferingObject' { + It '__AllParameterSets' { + $arnPrefix = "arn:aws:iam::123456789012:role" + $offering = New-AzSecurityDefenderForServersAwsOfferingObject ` + -DefenderForServerCloudRoleArn "$arnPrefix/DefenderForCloud-DefenderForServers" ` + -ArcAutoProvisioningEnabled $true -ArcAutoProvisioningCloudRoleArn "$arnPrefix/DefenderForCloud-ArcAutoProvisioning" ` + -MdeAutoProvisioningEnabled $true ` + -VaAutoProvisioningEnabled $true -ConfigurationType TVM ` + -VMScannerEnabled $true -ConfigurationCloudRoleArn "$arnPrefix/DefenderForCloud-AgentlessScanner" -ConfigurationScanningMode Default ` + -SubPlanType P2 + + $offering.OfferingType | Should -Be "DefenderForServersAws" + } +} diff --git a/src/Security/Security.Autorest/test/New-AzSecurityDefenderForServersGcpOfferingObject.Tests.ps1 b/src/Security/Security.Autorest/test/New-AzSecurityDefenderForServersGcpOfferingObject.Tests.ps1 new file mode 100644 index 000000000000..f24ec9a501c2 --- /dev/null +++ b/src/Security/Security.Autorest/test/New-AzSecurityDefenderForServersGcpOfferingObject.Tests.ps1 @@ -0,0 +1,27 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzSecurityDefenderForServersGcpOfferingObject')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzSecurityDefenderForServersGcpOfferingObject.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'New-AzSecurityDefenderForServersGcpOfferingObject' { + It '__AllParameterSets' { + $emailSuffix = "myproject.iam.gserviceaccount.com" + $offering = New-AzSecurityDefenderForServersGcpOfferingObject ` + -DefenderForServerServiceAccountEmailAddress "microsoft-defender-for-servers@$emailSuffix" -DefenderForServerWorkloadIdentityProviderId "defender-for-servers" ` + -ArcAutoProvisioningEnabled $true -MdeAutoProvisioningEnabled $true -VaAutoProvisioningEnabled $true -ConfigurationType TVM ` + -VMScannerEnabled $true -ConfigurationScanningMode Default ` + -SubPlanType P2 + $offering.OfferingType | Should -Be "DefenderForServersGcp" + } +} diff --git a/src/Security/Security.Autorest/test/New-AzSecurityGcpOrganizationalDataMemberObject.Tests.ps1 b/src/Security/Security.Autorest/test/New-AzSecurityGcpOrganizationalDataMemberObject.Tests.ps1 new file mode 100644 index 000000000000..a2a876cd9184 --- /dev/null +++ b/src/Security/Security.Autorest/test/New-AzSecurityGcpOrganizationalDataMemberObject.Tests.ps1 @@ -0,0 +1,22 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzSecurityGcpOrganizationalDataMemberObject')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzSecurityGcpOrganizationalDataMemberObject.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'New-AzSecurityGcpOrganizationalDataMemberObject' { + It '__AllParameterSets' { + $env = New-AzSecurityGcpOrganizationalDataMemberObject -ManagementProjectNumber "12345" -ParentHierarchyId "00000" + $env.OrganizationMembershipType | Should -Be "Member" + } +} diff --git a/src/Security/Security.Autorest/test/New-AzSecurityGcpOrganizationalDataOrganizationObject.Tests.ps1 b/src/Security/Security.Autorest/test/New-AzSecurityGcpOrganizationalDataOrganizationObject.Tests.ps1 new file mode 100644 index 000000000000..5b16f5904dd5 --- /dev/null +++ b/src/Security/Security.Autorest/test/New-AzSecurityGcpOrganizationalDataOrganizationObject.Tests.ps1 @@ -0,0 +1,22 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzSecurityGcpOrganizationalDataOrganizationObject')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzSecurityGcpOrganizationalDataOrganizationObject.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'New-AzSecurityGcpOrganizationalDataOrganizationObject' { + It '__AllParameterSets' { + $env = New-AzSecurityGcpOrganizationalDataOrganizationObject -WorkloadIdentityProviderId "provider" -ServiceAccountEmailAddress "my@email.com" -ExcludedProjectNumber @(1,2) + $env.OrganizationMembershipType | Should -Be "Organization" + } +} diff --git a/src/Security/Security.Autorest/test/New-AzSecurityGcpProjectEnvironmentObject.Tests.ps1 b/src/Security/Security.Autorest/test/New-AzSecurityGcpProjectEnvironmentObject.Tests.ps1 new file mode 100644 index 000000000000..9a7702b25261 --- /dev/null +++ b/src/Security/Security.Autorest/test/New-AzSecurityGcpProjectEnvironmentObject.Tests.ps1 @@ -0,0 +1,23 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzSecurityGcpProjectEnvironmentObject')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzSecurityGcpProjectEnvironmentObject.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'New-AzSecurityGcpProjectEnvironmentObject' { + It '__AllParameterSets' { + $orgData = New-AzSecurityGcpOrganizationalDataOrganizationObject -WorkloadIdentityProviderId "provider" -ServiceAccountEmailAddress "my@email.com" -ExcludedProjectNumber @(1,2) + $environment = New-AzSecurityGcpProjectEnvironmentObject -ProjectDetailProjectId "asc-sdk-samples" -ScanInterval 24 -OrganizationalData $orgData -ProjectDetailProjectNumber "1234" + $environment.EnvironmentType | Should -Be "GcpProject" + } +} diff --git a/src/Security/Security.Autorest/test/New-AzSecurityGitHubScopeEnvironmentObject.Tests.ps1 b/src/Security/Security.Autorest/test/New-AzSecurityGitHubScopeEnvironmentObject.Tests.ps1 new file mode 100644 index 000000000000..47877838fd49 --- /dev/null +++ b/src/Security/Security.Autorest/test/New-AzSecurityGitHubScopeEnvironmentObject.Tests.ps1 @@ -0,0 +1,22 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzSecurityGitHubScopeEnvironmentObject')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzSecurityGitHubScopeEnvironmentObject.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'New-AzSecurityGitHubScopeEnvironmentObject' { + It '__AllParameterSets' { + $scope = New-AzSecurityGitHubScopeEnvironmentObject + $scope.EnvironmentType | Should -Be "GithubScope" + } +} diff --git a/src/Security/Security.Autorest/test/New-AzSecurityGitLabScopeEnvironmentObject.Tests.ps1 b/src/Security/Security.Autorest/test/New-AzSecurityGitLabScopeEnvironmentObject.Tests.ps1 new file mode 100644 index 000000000000..39a20f308e20 --- /dev/null +++ b/src/Security/Security.Autorest/test/New-AzSecurityGitLabScopeEnvironmentObject.Tests.ps1 @@ -0,0 +1,22 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzSecurityGitLabScopeEnvironmentObject')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzSecurityGitLabScopeEnvironmentObject.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'New-AzSecurityGitLabScopeEnvironmentObject' { + It '__AllParameterSets' { + $scope = New-AzSecurityGitLabScopeEnvironmentObject + $scope.EnvironmentType | Should -Be "GitlabScope" + } +} diff --git a/src/Security/Security.Autorest/test/New-AzSecurityInformationProtectionAwsOfferingObject.Tests.ps1 b/src/Security/Security.Autorest/test/New-AzSecurityInformationProtectionAwsOfferingObject.Tests.ps1 new file mode 100644 index 000000000000..2beef0575db2 --- /dev/null +++ b/src/Security/Security.Autorest/test/New-AzSecurityInformationProtectionAwsOfferingObject.Tests.ps1 @@ -0,0 +1,22 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzSecurityInformationProtectionAwsOfferingObject')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzSecurityInformationProtectionAwsOfferingObject.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'New-AzSecurityInformationProtectionAwsOfferingObject' { + It '__AllParameterSets' { + $offering = New-AzSecurityInformationProtectionAwsOfferingObject -InformationProtectionCloudRoleArn "arn:aws:iam::123456789012:role/myRole" + $offering.OfferingType | Should -Be "InformationProtectionAws" + } +} diff --git a/src/Security/Security.Autorest/test/README.md b/src/Security/Security.Autorest/test/README.md new file mode 100644 index 000000000000..7c752b4c8c43 --- /dev/null +++ b/src/Security/Security.Autorest/test/README.md @@ -0,0 +1,17 @@ +# Test +This directory contains the [Pester](https://www.powershellgallery.com/packages/Pester) tests to run for the module. We use Pester as it is the unofficial standard for PowerShell unit testing. Test stubs for custom cmdlets (created in `..\custom`) will be generated into this folder when `build-module.ps1` is ran. These test stubs will fail automatically, to indicate that tests should be written for custom cmdlets. + +## Info +- Modifiable: yes +- Generated: partial +- Committed: yes +- Packaged: no + +## Details +We allow three testing modes: *live*, *record*, and *playback*. These can be selected using the `-Live`, `-Record`, and `-Playback` switches respectively on the `test-module.ps1` script. This script will run through any `.Tests.ps1` scripts in the `test` folder. If you choose the *record* mode, it will create a `.Recording.json` file of the REST calls between the client and server. Then, when you choose *playback* mode, it will use the `.Recording.json` file to mock the communication between server and client. The *live* mode runs the same as the *record* mode; however, it doesn't create the `.Recording.json` file. + +## Purpose +Custom cmdlets generally encompass additional functionality not described in the REST specification, or combines functionality generated from the REST spec. To validate this functionality continues to operate as intended, creating tests that can be ran and re-ran against custom cmdlets is part of the framework. + +## Usage +To execute tests, run the `test-module.ps1`. To write tests, [this example](https://github.com/pester/Pester/blob/8b9cf4248315e44f1ac6673be149f7e0d7f10466/Examples/Planets/Get-Planet.Tests.ps1#L1) from the Pester repository is very useful for getting started. \ No newline at end of file diff --git a/src/Security/Security.Autorest/test/Remove-AzSecurityConnector.Tests.ps1 b/src/Security/Security.Autorest/test/Remove-AzSecurityConnector.Tests.ps1 new file mode 100644 index 000000000000..ed357f5d2915 --- /dev/null +++ b/src/Security/Security.Autorest/test/Remove-AzSecurityConnector.Tests.ps1 @@ -0,0 +1,25 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Remove-AzSecurityConnector')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Remove-AzSecurityConnector.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Remove-AzSecurityConnector' { + It 'Delete' { + "Tested in New-AzSecurityConnector.Tests" | Should -Not -BeNullOrEmpty + } + + It 'DeleteViaIdentity' { + "Tested in New-AzSecurityConnector.Tests" | Should -Not -BeNullOrEmpty + } +} diff --git a/src/Security/Security.Autorest/test/Remove-AzSecurityConnectorDevOpsConfiguration.Tests.ps1 b/src/Security/Security.Autorest/test/Remove-AzSecurityConnectorDevOpsConfiguration.Tests.ps1 new file mode 100644 index 000000000000..2dc8b30682d3 --- /dev/null +++ b/src/Security/Security.Autorest/test/Remove-AzSecurityConnectorDevOpsConfiguration.Tests.ps1 @@ -0,0 +1,24 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Remove-AzSecurityConnectorDevOpsConfiguration')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Remove-AzSecurityConnectorDevOpsConfiguration.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Remove-AzSecurityConnectorDevOpsConfiguration' { + It 'Delete' { + "Tested in New-AzSecurityConnectorDevOpsConfiguration.Tests" | Should -Not -BeNullOrEmpty } + + It 'DeleteViaIdentity' { + "Tested in New-AzSecurityConnectorDevOpsConfiguration.Tests" | Should -Not -BeNullOrEmpty + } +} diff --git a/src/Security/Security.Autorest/test/Update-AzSecurityConnector.Recording.json b/src/Security/Security.Autorest/test/Update-AzSecurityConnector.Recording.json new file mode 100644 index 000000000000..101f36a131f6 --- /dev/null +++ b/src/Security/Security.Autorest/test/Update-AzSecurityConnector.Recording.json @@ -0,0 +1,121 @@ +{ + "Update-AzSecurityConnector+[NoContext]+UpdateExpanded+$PATCH+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01?api-version=2023-10-01-preview+1": { + "Request": { + "Method": "PATCH", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01?api-version=2023-10-01-preview", + "Content": "{\r\n \"tags\": {\r\n \"pwshsdktest\": \"true\"\r\n }\r\n}", + "isContentBase64": false, + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "49" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Vary": [ "Accept-Encoding" ], + "x-ms-ratelimit-remaining-subscription-resource-requests": [ "249" ], + "x-ms-request-id": [ "a914766b-4c53-46cb-ba32-71a1c37492d9" ], + "x-ms-correlation-request-id": [ "a914766b-4c53-46cb-ba32-71a1c37492d9" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T021144Z:a914766b-4c53-46cb-ba32-71a1c37492d9" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 384311590B0945199001A726D3336712 Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:11:43Z" ], + "Date": [ "Wed, 14 Feb 2024 02:11:44 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "831" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"offerings\":[{\"offeringType\":\"CspmMonitorAzureDevOps\"}],\"environmentName\":\"AzureDevOps\",\"hierarchyIdentifier\":\"4a8eb7f1-f533-48c5-b102-9b09e90906b7\",\"environmentData\":{\"environmentType\":\"AzureDevOpsScope\"}},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourcegroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01\",\"name\":\"dfdsdktests-azdo-01\",\"type\":\"Microsoft.Security/securityconnectors\",\"location\":\"centralus\",\"tags\":{\"pwshsdktest\":\"true\"},\"systemData\":{\"createdBy\":\"c3d82ccb-fee1-430c-949e-6c0a217c00a8\",\"createdByType\":\"Application\",\"createdAt\":\"2023-12-07T06:38:36.3536844Z\",\"lastModifiedBy\":\"c3d82ccb-fee1-430c-949e-6c0a217c00a8\",\"lastModifiedByType\":\"Application\",\"lastModifiedAt\":\"2024-02-14T02:11:43.7724172Z\"}}", + "isContentBase64": false + } + }, + "Update-AzSecurityConnector+[NoContext]+UpdateViaIdentityExpanded+$GET+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01?api-version=2023-10-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01?api-version=2023-10-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "62" ], + "x-ms-client-request-id": [ "75ae0af8-b716-44f6-ab63-5ff8bed40b22" ], + "CommandName": [ "Get-AzSecurityConnector" ], + "FullCommandName": [ "Get-AzSecurityConnector_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Vary": [ "Accept-Encoding" ], + "x-ms-ratelimit-remaining-subscription-resource-requests": [ "99" ], + "x-ms-request-id": [ "bd6eaf32-5e58-4895-96a9-72ecd803fc40" ], + "x-ms-correlation-request-id": [ "bd6eaf32-5e58-4895-96a9-72ecd803fc40" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T021145Z:bd6eaf32-5e58-4895-96a9-72ecd803fc40" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: C681319AD792481DAEA4DCC0E132ACAA Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:11:45Z" ], + "Date": [ "Wed, 14 Feb 2024 02:11:45 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "831" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"offerings\":[{\"offeringType\":\"CspmMonitorAzureDevOps\"}],\"environmentName\":\"AzureDevOps\",\"hierarchyIdentifier\":\"4a8eb7f1-f533-48c5-b102-9b09e90906b7\",\"environmentData\":{\"environmentType\":\"AzureDevOpsScope\"}},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourcegroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01\",\"name\":\"dfdsdktests-azdo-01\",\"type\":\"Microsoft.Security/securityconnectors\",\"location\":\"centralus\",\"tags\":{\"pwshsdktest\":\"true\"},\"systemData\":{\"createdBy\":\"c3d82ccb-fee1-430c-949e-6c0a217c00a8\",\"createdByType\":\"Application\",\"createdAt\":\"2023-12-07T06:38:36.3536844Z\",\"lastModifiedBy\":\"c3d82ccb-fee1-430c-949e-6c0a217c00a8\",\"lastModifiedByType\":\"Application\",\"lastModifiedAt\":\"2024-02-14T02:11:43.7724172Z\"}}", + "isContentBase64": false + } + }, + "Update-AzSecurityConnector+[NoContext]+UpdateViaIdentityExpanded+$PATCH+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01?api-version=2023-10-01-preview+2": { + "Request": { + "Method": "PATCH", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01?api-version=2023-10-01-preview", + "Content": "{\r\n \"tags\": {\r\n \"pwshsdktest2\": \"true\"\r\n }\r\n}", + "isContentBase64": false, + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "50" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Vary": [ "Accept-Encoding" ], + "x-ms-ratelimit-remaining-subscription-resource-requests": [ "249" ], + "x-ms-request-id": [ "e2252d28-6673-4f85-ac08-f5075e3ee0c2" ], + "x-ms-correlation-request-id": [ "e2252d28-6673-4f85-ac08-f5075e3ee0c2" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T021147Z:e2252d28-6673-4f85-ac08-f5075e3ee0c2" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 92ABB1C940F449D3ABC0B51680D3680C Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:11:46Z" ], + "Date": [ "Wed, 14 Feb 2024 02:11:46 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "832" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"offerings\":[{\"offeringType\":\"CspmMonitorAzureDevOps\"}],\"environmentName\":\"AzureDevOps\",\"hierarchyIdentifier\":\"4a8eb7f1-f533-48c5-b102-9b09e90906b7\",\"environmentData\":{\"environmentType\":\"AzureDevOpsScope\"}},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourcegroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01\",\"name\":\"dfdsdktests-azdo-01\",\"type\":\"Microsoft.Security/securityconnectors\",\"location\":\"centralus\",\"tags\":{\"pwshsdktest2\":\"true\"},\"systemData\":{\"createdBy\":\"c3d82ccb-fee1-430c-949e-6c0a217c00a8\",\"createdByType\":\"Application\",\"createdAt\":\"2023-12-07T06:38:36.3536844Z\",\"lastModifiedBy\":\"c3d82ccb-fee1-430c-949e-6c0a217c00a8\",\"lastModifiedByType\":\"Application\",\"lastModifiedAt\":\"2024-02-14T02:11:46.3283398Z\"}}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/test/Update-AzSecurityConnector.Tests.ps1 b/src/Security/Security.Autorest/test/Update-AzSecurityConnector.Tests.ps1 new file mode 100644 index 000000000000..f15273c630d0 --- /dev/null +++ b/src/Security/Security.Autorest/test/Update-AzSecurityConnector.Tests.ps1 @@ -0,0 +1,30 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Update-AzSecurityConnector')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Update-AzSecurityConnector.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Update-AzSecurityConnector' { + It 'UpdateExpanded' { + $rg = $env.SecurityConnectorsResourceGroupName + $sid = $env.SubscriptionId + Update-AzSecurityConnector -SubscriptionId $sid -ResourceGroupName $rg -Name "dfdsdktests-azdo-01" -Tag @{ pwshsdktest="true"} + } + + It 'UpdateViaIdentityExpanded' { + $rg = $env.SecurityConnectorsResourceGroupName + $sid = $env.SubscriptionId + $connector = Get-AzSecurityConnector -SubscriptionId $sid -ResourceGroupName $rg -Name "dfdsdktests-azdo-01" + Update-AzSecurityConnector -InputObject $connector -Tag @{ pwshsdktest2="true"} + } +} diff --git a/src/Security/Security.Autorest/test/Update-AzSecurityConnectorAzureDevOpsOrg.Recording.json b/src/Security/Security.Autorest/test/Update-AzSecurityConnectorAzureDevOpsOrg.Recording.json new file mode 100644 index 000000000000..3a917d62ff99 --- /dev/null +++ b/src/Security/Security.Autorest/test/Update-AzSecurityConnectorAzureDevOpsOrg.Recording.json @@ -0,0 +1,421 @@ +{ + "Update-AzSecurityConnectorAzureDevOpsOrg+[NoContext]+UpdateExpanded+$PATCH+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests?api-version=2023-09-01-preview+1": { + "Request": { + "Method": "PATCH", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests?api-version=2023-09-01-preview", + "Content": "{\r\n \"properties\": {\r\n \"actionableRemediation\": {\r\n \"state\": \"Enabled\",\r\n \"categoryConfigurations\": [\r\n {\r\n \"minimumSeverityLevel\": \"High\",\r\n \"category\": \"IaC\"\r\n }\r\n ],\r\n \"inheritFromParentState\": \"Disabled\"\r\n }\r\n }\r\n}", + "isContentBase64": false, + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "277" ] + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Retry-After": [ "20" ], + "Set-Cookie": [ "ARRAffinity=b0d653e3d2c4fba6e75578139341b84b35dee63a8a317f007b2447d8196b79e5;Path=/;HttpOnly;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com", "ARRAffinitySameSite=b0d653e3d2c4fba6e75578139341b84b35dee63a8a317f007b2447d8196b79e5;Path=/;HttpOnly;SameSite=None;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1199" ], + "Request-Context": [ "appId=cid-v1:b8e19897-bfe4-49ad-ad76-b9526fa18eea" ], + "mise-correlation-id": [ "b2346265-5bb6-478f-a3c4-0ac923ee45d6" ], + "Azure-AsyncOperation": [ "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/operationResults/6476c158-4aac-402c-8d77-9079e881cd0e?api-version=2023-09-01-preview\u0026t=638434735091422662\u0026c=MIIHADCCBeigAwIBAgITfARmPsJdo2ShuN-ImAAABGY-wjANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDUwHhcNMjQwMTMxMjIwNzA5WhcNMjUwMTI1MjIwNzA5WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOVFiSMi9Sg6cKnrBuPHbDk_Zwa1ZNYHwLVPJArEI9N2bLrgd1mU0ZdNVcdf6rtZCkUUuCe3vxnVTGwufpwH9GPWDgJOpJoL9wgKOzUDiHLUeiWPjrK1AoaQVprZgjnzXBIWiZC2tZjbUT9pOI_ixYJJPrsCfLt7HEccnhObROE1mo_hpiPDrtOQDaX-BboNceB8vI1wmSPApGpPRM9hBRQbXgqKFC8094UNsMVkWPCrsPvP5YlMBLARlGf2WTevGKRREjstkApf1Swi7uKnpyhhsidD1yREMU0mWY9wnZfAX0jpEp3p9jKVMPQ3L-m-nSZI4zrtbW0AnI0O3pAEwe0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9DTzFQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA1LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MB0GA1UdDgQWBBT2vcy9ccvhGewsiHI1BQHsz3Wn8zAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBR61hmFKHlscXYeYPjzS--iBUIWHTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBADNBZjhX44bpBtC8kogZJGe4lYeHX95whfZ7X_CMSUuZRbQQ_b6raUpp8V8eF0YUa9b3Oa-DGrs5WfzogCuGcJPeoEVnDYzc1jlKubSIpGw73aGZzhbTjJeNf-Qe-5vTG-GcNzVtIcrwi93YSiK2LSbgrLpTL7T7znjePcGRRkCBjAslrV5SqufcsrpGmqvPAVKXRV-OIOzvXy6qmn9CHmdo0RGBXGIakbLMec_1SIS8NdPsB6i6XPjL2SDjqKTa5car7bVYlXEVsgL-000VF1t6x1II3VBNfsEJ81CdJyxaCJnwvWI6kHtCtJX9QYK3qZab9PfZRBvcetJoPdMFvBU\u0026s=HAdcT2RdvtoopHE1BeQ3fjcwibSJiBKJIA0vt4lPe5QnGako9eGjBQD_lVLcwH7Lhi81EMNMJFy3jiCUYnY4VqeC8NYwZ70cEKb1_HynnvOMj3VWxtc9n1pWP6QxuYLLMjldioZ9E1SmqHWQr-FSytwwrwgCt35wAKdO1FNIGmlI9QBfZnn9iwp5OXhQtrUU6Mbw0ErlYHOTgGNNfIrtuLnBpZr5JtfQEbwwpvRPv84F0Y1mvMfGdhq-bR8vBLNxY78q1RDmqeKB3Og3wGPRXshhNja3R-4m9K5VK0210VscSfZSB-5qGS1wjhXRrc4UUqW0PUx8d0J8CP2L7ff29w\u0026h=RreXA_I2ZtEzYKZp7KNnZCDAyPefoXdqQKu4Q1j2_fY" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-request-id": [ "b9ce3e88-cef4-4617-b96e-c24f3fbce2e5" ], + "x-ms-correlation-request-id": [ "b9ce3e88-cef4-4617-b96e-c24f3fbce2e5" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T021149Z:b9ce3e88-cef4-4617-b96e-c24f3fbce2e5" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 988E0142F4DB4E04B2858BA47C79E6D0 Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:11:47Z" ], + "Date": [ "Wed, 14 Feb 2024 02:11:48 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "281" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"onboardingState\":\"NotApplicable\",\"actionableRemediation\":{\"state\":\"Enabled\",\"categoryConfigurations\":[{\"minimumSeverityLevel\":\"High\",\"category\":\"IaC\"}],\"branchConfiguration\":{\"branchNames\":[],\"annotateDefaultBranch\":\"Enabled\"},\"inheritFromParentState\":\"Disabled\"}}}", + "isContentBase64": false + } + }, + "Update-AzSecurityConnectorAzureDevOpsOrg+[NoContext]+UpdateExpanded+$GET+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/operationResults/6476c158-4aac-402c-8d77-9079e881cd0e?api-version=2023-09-01-preview\u0026t=638434735091422662\u0026c=MIIHADCCBeigAwIBAgITfARmPsJdo2ShuN-ImAAABGY-wjANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDUwHhcNMjQwMTMxMjIwNzA5WhcNMjUwMTI1MjIwNzA5WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOVFiSMi9Sg6cKnrBuPHbDk_Zwa1ZNYHwLVPJArEI9N2bLrgd1mU0ZdNVcdf6rtZCkUUuCe3vxnVTGwufpwH9GPWDgJOpJoL9wgKOzUDiHLUeiWPjrK1AoaQVprZgjnzXBIWiZC2tZjbUT9pOI_ixYJJPrsCfLt7HEccnhObROE1mo_hpiPDrtOQDaX-BboNceB8vI1wmSPApGpPRM9hBRQbXgqKFC8094UNsMVkWPCrsPvP5YlMBLARlGf2WTevGKRREjstkApf1Swi7uKnpyhhsidD1yREMU0mWY9wnZfAX0jpEp3p9jKVMPQ3L-m-nSZI4zrtbW0AnI0O3pAEwe0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9DTzFQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA1LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MB0GA1UdDgQWBBT2vcy9ccvhGewsiHI1BQHsz3Wn8zAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBR61hmFKHlscXYeYPjzS--iBUIWHTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBADNBZjhX44bpBtC8kogZJGe4lYeHX95whfZ7X_CMSUuZRbQQ_b6raUpp8V8eF0YUa9b3Oa-DGrs5WfzogCuGcJPeoEVnDYzc1jlKubSIpGw73aGZzhbTjJeNf-Qe-5vTG-GcNzVtIcrwi93YSiK2LSbgrLpTL7T7znjePcGRRkCBjAslrV5SqufcsrpGmqvPAVKXRV-OIOzvXy6qmn9CHmdo0RGBXGIakbLMec_1SIS8NdPsB6i6XPjL2SDjqKTa5car7bVYlXEVsgL-000VF1t6x1II3VBNfsEJ81CdJyxaCJnwvWI6kHtCtJX9QYK3qZab9PfZRBvcetJoPdMFvBU\u0026s=HAdcT2RdvtoopHE1BeQ3fjcwibSJiBKJIA0vt4lPe5QnGako9eGjBQD_lVLcwH7Lhi81EMNMJFy3jiCUYnY4VqeC8NYwZ70cEKb1_HynnvOMj3VWxtc9n1pWP6QxuYLLMjldioZ9E1SmqHWQr-FSytwwrwgCt35wAKdO1FNIGmlI9QBfZnn9iwp5OXhQtrUU6Mbw0ErlYHOTgGNNfIrtuLnBpZr5JtfQEbwwpvRPv84F0Y1mvMfGdhq-bR8vBLNxY78q1RDmqeKB3Og3wGPRXshhNja3R-4m9K5VK0210VscSfZSB-5qGS1wjhXRrc4UUqW0PUx8d0J8CP2L7ff29w\u0026h=RreXA_I2ZtEzYKZp7KNnZCDAyPefoXdqQKu4Q1j2_fY+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/operationResults/6476c158-4aac-402c-8d77-9079e881cd0e?api-version=2023-09-01-preview\u0026t=638434735091422662\u0026c=MIIHADCCBeigAwIBAgITfARmPsJdo2ShuN-ImAAABGY-wjANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDUwHhcNMjQwMTMxMjIwNzA5WhcNMjUwMTI1MjIwNzA5WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOVFiSMi9Sg6cKnrBuPHbDk_Zwa1ZNYHwLVPJArEI9N2bLrgd1mU0ZdNVcdf6rtZCkUUuCe3vxnVTGwufpwH9GPWDgJOpJoL9wgKOzUDiHLUeiWPjrK1AoaQVprZgjnzXBIWiZC2tZjbUT9pOI_ixYJJPrsCfLt7HEccnhObROE1mo_hpiPDrtOQDaX-BboNceB8vI1wmSPApGpPRM9hBRQbXgqKFC8094UNsMVkWPCrsPvP5YlMBLARlGf2WTevGKRREjstkApf1Swi7uKnpyhhsidD1yREMU0mWY9wnZfAX0jpEp3p9jKVMPQ3L-m-nSZI4zrtbW0AnI0O3pAEwe0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9DTzFQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA1LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MB0GA1UdDgQWBBT2vcy9ccvhGewsiHI1BQHsz3Wn8zAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBR61hmFKHlscXYeYPjzS--iBUIWHTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBADNBZjhX44bpBtC8kogZJGe4lYeHX95whfZ7X_CMSUuZRbQQ_b6raUpp8V8eF0YUa9b3Oa-DGrs5WfzogCuGcJPeoEVnDYzc1jlKubSIpGw73aGZzhbTjJeNf-Qe-5vTG-GcNzVtIcrwi93YSiK2LSbgrLpTL7T7znjePcGRRkCBjAslrV5SqufcsrpGmqvPAVKXRV-OIOzvXy6qmn9CHmdo0RGBXGIakbLMec_1SIS8NdPsB6i6XPjL2SDjqKTa5car7bVYlXEVsgL-000VF1t6x1II3VBNfsEJ81CdJyxaCJnwvWI6kHtCtJX9QYK3qZab9PfZRBvcetJoPdMFvBU\u0026s=HAdcT2RdvtoopHE1BeQ3fjcwibSJiBKJIA0vt4lPe5QnGako9eGjBQD_lVLcwH7Lhi81EMNMJFy3jiCUYnY4VqeC8NYwZ70cEKb1_HynnvOMj3VWxtc9n1pWP6QxuYLLMjldioZ9E1SmqHWQr-FSytwwrwgCt35wAKdO1FNIGmlI9QBfZnn9iwp5OXhQtrUU6Mbw0ErlYHOTgGNNfIrtuLnBpZr5JtfQEbwwpvRPv84F0Y1mvMfGdhq-bR8vBLNxY78q1RDmqeKB3Og3wGPRXshhNja3R-4m9K5VK0210VscSfZSB-5qGS1wjhXRrc4UUqW0PUx8d0J8CP2L7ff29w\u0026h=RreXA_I2ZtEzYKZp7KNnZCDAyPefoXdqQKu4Q1j2_fY", + "Content": null, + "isContentBase64": false, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "65" ], + "x-ms-client-request-id": [ "87602f19-7e64-4e27-b7af-1f1a91191662" ], + "CommandName": [ "Update-AzSecurityConnectorAzureDevOpsOrg" ], + "FullCommandName": [ "Update-AzSecurityConnectorAzureDevOpsOrg_UpdateExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Retry-After": [ "20" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=b0d653e3d2c4fba6e75578139341b84b35dee63a8a317f007b2447d8196b79e5;Path=/;HttpOnly;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com", "ARRAffinitySameSite=b0d653e3d2c4fba6e75578139341b84b35dee63a8a317f007b2447d8196b79e5;Path=/;HttpOnly;SameSite=None;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "Request-Context": [ "appId=cid-v1:b8e19897-bfe4-49ad-ad76-b9526fa18eea" ], + "mise-correlation-id": [ "f9465781-c7a6-423c-8756-67f2ead09fb4" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-request-id": [ "d96621b1-d517-4674-8378-5225da20f1ff" ], + "x-ms-correlation-request-id": [ "d96621b1-d517-4674-8378-5225da20f1ff" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T021209Z:d96621b1-d517-4674-8378-5225da20f1ff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 1A1BAA8132BF42388AE5D5091B1CE999 Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:12:09Z" ], + "Date": [ "Wed, 14 Feb 2024 02:12:09 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "333" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/operationResults/6476c158-4aac-402c-8d77-9079e881cd0e\",\"name\":\"6476c158-4aac-402c-8d77-9079e881cd0e\",\"status\":\"Accepted\",\"startTime\":\"2024-02-14T02:11:48.9820006Z\"}", + "isContentBase64": false + } + }, + "Update-AzSecurityConnectorAzureDevOpsOrg+[NoContext]+UpdateExpanded+$GET+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/operationResults/6476c158-4aac-402c-8d77-9079e881cd0e?api-version=2023-09-01-preview\u0026t=638434735091422662\u0026c=MIIHADCCBeigAwIBAgITfARmPsJdo2ShuN-ImAAABGY-wjANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDUwHhcNMjQwMTMxMjIwNzA5WhcNMjUwMTI1MjIwNzA5WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOVFiSMi9Sg6cKnrBuPHbDk_Zwa1ZNYHwLVPJArEI9N2bLrgd1mU0ZdNVcdf6rtZCkUUuCe3vxnVTGwufpwH9GPWDgJOpJoL9wgKOzUDiHLUeiWPjrK1AoaQVprZgjnzXBIWiZC2tZjbUT9pOI_ixYJJPrsCfLt7HEccnhObROE1mo_hpiPDrtOQDaX-BboNceB8vI1wmSPApGpPRM9hBRQbXgqKFC8094UNsMVkWPCrsPvP5YlMBLARlGf2WTevGKRREjstkApf1Swi7uKnpyhhsidD1yREMU0mWY9wnZfAX0jpEp3p9jKVMPQ3L-m-nSZI4zrtbW0AnI0O3pAEwe0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9DTzFQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA1LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MB0GA1UdDgQWBBT2vcy9ccvhGewsiHI1BQHsz3Wn8zAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBR61hmFKHlscXYeYPjzS--iBUIWHTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBADNBZjhX44bpBtC8kogZJGe4lYeHX95whfZ7X_CMSUuZRbQQ_b6raUpp8V8eF0YUa9b3Oa-DGrs5WfzogCuGcJPeoEVnDYzc1jlKubSIpGw73aGZzhbTjJeNf-Qe-5vTG-GcNzVtIcrwi93YSiK2LSbgrLpTL7T7znjePcGRRkCBjAslrV5SqufcsrpGmqvPAVKXRV-OIOzvXy6qmn9CHmdo0RGBXGIakbLMec_1SIS8NdPsB6i6XPjL2SDjqKTa5car7bVYlXEVsgL-000VF1t6x1II3VBNfsEJ81CdJyxaCJnwvWI6kHtCtJX9QYK3qZab9PfZRBvcetJoPdMFvBU\u0026s=HAdcT2RdvtoopHE1BeQ3fjcwibSJiBKJIA0vt4lPe5QnGako9eGjBQD_lVLcwH7Lhi81EMNMJFy3jiCUYnY4VqeC8NYwZ70cEKb1_HynnvOMj3VWxtc9n1pWP6QxuYLLMjldioZ9E1SmqHWQr-FSytwwrwgCt35wAKdO1FNIGmlI9QBfZnn9iwp5OXhQtrUU6Mbw0ErlYHOTgGNNfIrtuLnBpZr5JtfQEbwwpvRPv84F0Y1mvMfGdhq-bR8vBLNxY78q1RDmqeKB3Og3wGPRXshhNja3R-4m9K5VK0210VscSfZSB-5qGS1wjhXRrc4UUqW0PUx8d0J8CP2L7ff29w\u0026h=RreXA_I2ZtEzYKZp7KNnZCDAyPefoXdqQKu4Q1j2_fY+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/operationResults/6476c158-4aac-402c-8d77-9079e881cd0e?api-version=2023-09-01-preview\u0026t=638434735091422662\u0026c=MIIHADCCBeigAwIBAgITfARmPsJdo2ShuN-ImAAABGY-wjANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDUwHhcNMjQwMTMxMjIwNzA5WhcNMjUwMTI1MjIwNzA5WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOVFiSMi9Sg6cKnrBuPHbDk_Zwa1ZNYHwLVPJArEI9N2bLrgd1mU0ZdNVcdf6rtZCkUUuCe3vxnVTGwufpwH9GPWDgJOpJoL9wgKOzUDiHLUeiWPjrK1AoaQVprZgjnzXBIWiZC2tZjbUT9pOI_ixYJJPrsCfLt7HEccnhObROE1mo_hpiPDrtOQDaX-BboNceB8vI1wmSPApGpPRM9hBRQbXgqKFC8094UNsMVkWPCrsPvP5YlMBLARlGf2WTevGKRREjstkApf1Swi7uKnpyhhsidD1yREMU0mWY9wnZfAX0jpEp3p9jKVMPQ3L-m-nSZI4zrtbW0AnI0O3pAEwe0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9DTzFQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA1LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MB0GA1UdDgQWBBT2vcy9ccvhGewsiHI1BQHsz3Wn8zAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBR61hmFKHlscXYeYPjzS--iBUIWHTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBADNBZjhX44bpBtC8kogZJGe4lYeHX95whfZ7X_CMSUuZRbQQ_b6raUpp8V8eF0YUa9b3Oa-DGrs5WfzogCuGcJPeoEVnDYzc1jlKubSIpGw73aGZzhbTjJeNf-Qe-5vTG-GcNzVtIcrwi93YSiK2LSbgrLpTL7T7znjePcGRRkCBjAslrV5SqufcsrpGmqvPAVKXRV-OIOzvXy6qmn9CHmdo0RGBXGIakbLMec_1SIS8NdPsB6i6XPjL2SDjqKTa5car7bVYlXEVsgL-000VF1t6x1II3VBNfsEJ81CdJyxaCJnwvWI6kHtCtJX9QYK3qZab9PfZRBvcetJoPdMFvBU\u0026s=HAdcT2RdvtoopHE1BeQ3fjcwibSJiBKJIA0vt4lPe5QnGako9eGjBQD_lVLcwH7Lhi81EMNMJFy3jiCUYnY4VqeC8NYwZ70cEKb1_HynnvOMj3VWxtc9n1pWP6QxuYLLMjldioZ9E1SmqHWQr-FSytwwrwgCt35wAKdO1FNIGmlI9QBfZnn9iwp5OXhQtrUU6Mbw0ErlYHOTgGNNfIrtuLnBpZr5JtfQEbwwpvRPv84F0Y1mvMfGdhq-bR8vBLNxY78q1RDmqeKB3Og3wGPRXshhNja3R-4m9K5VK0210VscSfZSB-5qGS1wjhXRrc4UUqW0PUx8d0J8CP2L7ff29w\u0026h=RreXA_I2ZtEzYKZp7KNnZCDAyPefoXdqQKu4Q1j2_fY", + "Content": null, + "isContentBase64": false, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "66" ], + "x-ms-client-request-id": [ "87602f19-7e64-4e27-b7af-1f1a91191662" ], + "CommandName": [ "Update-AzSecurityConnectorAzureDevOpsOrg" ], + "FullCommandName": [ "Update-AzSecurityConnectorAzureDevOpsOrg_UpdateExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Retry-After": [ "20" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=14a5c7981ca45a6803ac375748e68dc9b495d4e56b3202b86256249c9784b400;Path=/;HttpOnly;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com", "ARRAffinitySameSite=14a5c7981ca45a6803ac375748e68dc9b495d4e56b3202b86256249c9784b400;Path=/;HttpOnly;SameSite=None;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "Request-Context": [ "appId=cid-v1:b8e19897-bfe4-49ad-ad76-b9526fa18eea" ], + "mise-correlation-id": [ "9d7a1d84-9060-4566-9a6d-d03d69443975" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-request-id": [ "2f6adacf-63f1-4bd5-93de-8e61f1910657" ], + "x-ms-correlation-request-id": [ "2f6adacf-63f1-4bd5-93de-8e61f1910657" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T021230Z:2f6adacf-63f1-4bd5-93de-8e61f1910657" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 69DB977039FD406184C17CE21FE0A51D Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:12:30Z" ], + "Date": [ "Wed, 14 Feb 2024 02:12:29 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "333" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/operationResults/6476c158-4aac-402c-8d77-9079e881cd0e\",\"name\":\"6476c158-4aac-402c-8d77-9079e881cd0e\",\"status\":\"Accepted\",\"startTime\":\"2024-02-14T02:11:48.9820006Z\"}", + "isContentBase64": false + } + }, + "Update-AzSecurityConnectorAzureDevOpsOrg+[NoContext]+UpdateExpanded+$GET+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/operationResults/6476c158-4aac-402c-8d77-9079e881cd0e?api-version=2023-09-01-preview\u0026t=638434735091422662\u0026c=MIIHADCCBeigAwIBAgITfARmPsJdo2ShuN-ImAAABGY-wjANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDUwHhcNMjQwMTMxMjIwNzA5WhcNMjUwMTI1MjIwNzA5WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOVFiSMi9Sg6cKnrBuPHbDk_Zwa1ZNYHwLVPJArEI9N2bLrgd1mU0ZdNVcdf6rtZCkUUuCe3vxnVTGwufpwH9GPWDgJOpJoL9wgKOzUDiHLUeiWPjrK1AoaQVprZgjnzXBIWiZC2tZjbUT9pOI_ixYJJPrsCfLt7HEccnhObROE1mo_hpiPDrtOQDaX-BboNceB8vI1wmSPApGpPRM9hBRQbXgqKFC8094UNsMVkWPCrsPvP5YlMBLARlGf2WTevGKRREjstkApf1Swi7uKnpyhhsidD1yREMU0mWY9wnZfAX0jpEp3p9jKVMPQ3L-m-nSZI4zrtbW0AnI0O3pAEwe0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9DTzFQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA1LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MB0GA1UdDgQWBBT2vcy9ccvhGewsiHI1BQHsz3Wn8zAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBR61hmFKHlscXYeYPjzS--iBUIWHTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBADNBZjhX44bpBtC8kogZJGe4lYeHX95whfZ7X_CMSUuZRbQQ_b6raUpp8V8eF0YUa9b3Oa-DGrs5WfzogCuGcJPeoEVnDYzc1jlKubSIpGw73aGZzhbTjJeNf-Qe-5vTG-GcNzVtIcrwi93YSiK2LSbgrLpTL7T7znjePcGRRkCBjAslrV5SqufcsrpGmqvPAVKXRV-OIOzvXy6qmn9CHmdo0RGBXGIakbLMec_1SIS8NdPsB6i6XPjL2SDjqKTa5car7bVYlXEVsgL-000VF1t6x1II3VBNfsEJ81CdJyxaCJnwvWI6kHtCtJX9QYK3qZab9PfZRBvcetJoPdMFvBU\u0026s=HAdcT2RdvtoopHE1BeQ3fjcwibSJiBKJIA0vt4lPe5QnGako9eGjBQD_lVLcwH7Lhi81EMNMJFy3jiCUYnY4VqeC8NYwZ70cEKb1_HynnvOMj3VWxtc9n1pWP6QxuYLLMjldioZ9E1SmqHWQr-FSytwwrwgCt35wAKdO1FNIGmlI9QBfZnn9iwp5OXhQtrUU6Mbw0ErlYHOTgGNNfIrtuLnBpZr5JtfQEbwwpvRPv84F0Y1mvMfGdhq-bR8vBLNxY78q1RDmqeKB3Og3wGPRXshhNja3R-4m9K5VK0210VscSfZSB-5qGS1wjhXRrc4UUqW0PUx8d0J8CP2L7ff29w\u0026h=RreXA_I2ZtEzYKZp7KNnZCDAyPefoXdqQKu4Q1j2_fY+4": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/operationResults/6476c158-4aac-402c-8d77-9079e881cd0e?api-version=2023-09-01-preview\u0026t=638434735091422662\u0026c=MIIHADCCBeigAwIBAgITfARmPsJdo2ShuN-ImAAABGY-wjANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDUwHhcNMjQwMTMxMjIwNzA5WhcNMjUwMTI1MjIwNzA5WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOVFiSMi9Sg6cKnrBuPHbDk_Zwa1ZNYHwLVPJArEI9N2bLrgd1mU0ZdNVcdf6rtZCkUUuCe3vxnVTGwufpwH9GPWDgJOpJoL9wgKOzUDiHLUeiWPjrK1AoaQVprZgjnzXBIWiZC2tZjbUT9pOI_ixYJJPrsCfLt7HEccnhObROE1mo_hpiPDrtOQDaX-BboNceB8vI1wmSPApGpPRM9hBRQbXgqKFC8094UNsMVkWPCrsPvP5YlMBLARlGf2WTevGKRREjstkApf1Swi7uKnpyhhsidD1yREMU0mWY9wnZfAX0jpEp3p9jKVMPQ3L-m-nSZI4zrtbW0AnI0O3pAEwe0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9DTzFQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA1LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MB0GA1UdDgQWBBT2vcy9ccvhGewsiHI1BQHsz3Wn8zAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBR61hmFKHlscXYeYPjzS--iBUIWHTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBADNBZjhX44bpBtC8kogZJGe4lYeHX95whfZ7X_CMSUuZRbQQ_b6raUpp8V8eF0YUa9b3Oa-DGrs5WfzogCuGcJPeoEVnDYzc1jlKubSIpGw73aGZzhbTjJeNf-Qe-5vTG-GcNzVtIcrwi93YSiK2LSbgrLpTL7T7znjePcGRRkCBjAslrV5SqufcsrpGmqvPAVKXRV-OIOzvXy6qmn9CHmdo0RGBXGIakbLMec_1SIS8NdPsB6i6XPjL2SDjqKTa5car7bVYlXEVsgL-000VF1t6x1II3VBNfsEJ81CdJyxaCJnwvWI6kHtCtJX9QYK3qZab9PfZRBvcetJoPdMFvBU\u0026s=HAdcT2RdvtoopHE1BeQ3fjcwibSJiBKJIA0vt4lPe5QnGako9eGjBQD_lVLcwH7Lhi81EMNMJFy3jiCUYnY4VqeC8NYwZ70cEKb1_HynnvOMj3VWxtc9n1pWP6QxuYLLMjldioZ9E1SmqHWQr-FSytwwrwgCt35wAKdO1FNIGmlI9QBfZnn9iwp5OXhQtrUU6Mbw0ErlYHOTgGNNfIrtuLnBpZr5JtfQEbwwpvRPv84F0Y1mvMfGdhq-bR8vBLNxY78q1RDmqeKB3Og3wGPRXshhNja3R-4m9K5VK0210VscSfZSB-5qGS1wjhXRrc4UUqW0PUx8d0J8CP2L7ff29w\u0026h=RreXA_I2ZtEzYKZp7KNnZCDAyPefoXdqQKu4Q1j2_fY", + "Content": null, + "isContentBase64": false, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "67" ], + "x-ms-client-request-id": [ "87602f19-7e64-4e27-b7af-1f1a91191662" ], + "CommandName": [ "Update-AzSecurityConnectorAzureDevOpsOrg" ], + "FullCommandName": [ "Update-AzSecurityConnectorAzureDevOpsOrg_UpdateExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Retry-After": [ "20" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=b0d653e3d2c4fba6e75578139341b84b35dee63a8a317f007b2447d8196b79e5;Path=/;HttpOnly;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com", "ARRAffinitySameSite=b0d653e3d2c4fba6e75578139341b84b35dee63a8a317f007b2447d8196b79e5;Path=/;HttpOnly;SameSite=None;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "Request-Context": [ "appId=cid-v1:b8e19897-bfe4-49ad-ad76-b9526fa18eea" ], + "mise-correlation-id": [ "3dacc724-34f2-4ac1-868d-a7592110fbd7" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-request-id": [ "fb408887-ca42-4136-8985-8f892c2fae11" ], + "x-ms-correlation-request-id": [ "fb408887-ca42-4136-8985-8f892c2fae11" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T021251Z:fb408887-ca42-4136-8985-8f892c2fae11" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: DE125DC39E134544A91996C6E6F7293B Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:12:50Z" ], + "Date": [ "Wed, 14 Feb 2024 02:12:50 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "375" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/operationResults/6476c158-4aac-402c-8d77-9079e881cd0e\",\"name\":\"6476c158-4aac-402c-8d77-9079e881cd0e\",\"status\":\"Succeeded\",\"startTime\":\"2024-02-14T02:11:48.9820006Z\",\"endTime\":\"2024-02-14T02:12:31.4844247Z\"}", + "isContentBase64": false + } + }, + "Update-AzSecurityConnectorAzureDevOpsOrg+[NoContext]+UpdateExpanded+$GET+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests?api-version=2023-09-01-preview+5": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests?api-version=2023-09-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "68" ], + "x-ms-client-request-id": [ "87602f19-7e64-4e27-b7af-1f1a91191662" ], + "CommandName": [ "Update-AzSecurityConnectorAzureDevOpsOrg" ], + "FullCommandName": [ "Update-AzSecurityConnectorAzureDevOpsOrg_UpdateExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=ca594a79766484e25889904bf326227201e6905138dd325ca221b8b7af91ccae;Path=/;HttpOnly;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com", "ARRAffinitySameSite=ca594a79766484e25889904bf326227201e6905138dd325ca221b8b7af91ccae;Path=/;HttpOnly;SameSite=None;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "Request-Context": [ "appId=cid-v1:b8e19897-bfe4-49ad-ad76-b9526fa18eea" ], + "mise-correlation-id": [ "5f3dfc8a-bbf8-4758-94eb-44c8c91ae6de" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-request-id": [ "86ccb3ab-d053-4396-8096-d58ad9e1165e" ], + "x-ms-correlation-request-id": [ "86ccb3ab-d053-4396-8096-d58ad9e1165e" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T021252Z:86ccb3ab-d053-4396-8096-d58ad9e1165e" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 0DFA39DD42EC4B898A172B8917523000 Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:12:51Z" ], + "Date": [ "Wed, 14 Feb 2024 02:12:51 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "687" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"onboardingState\":\"Onboarded\",\"actionableRemediation\":{\"state\":\"Enabled\",\"categoryConfigurations\":[{\"minimumSeverityLevel\":\"High\",\"category\":\"IaC\"}],\"branchConfiguration\":{\"branchNames\":[],\"annotateDefaultBranch\":\"Enabled\"},\"inheritFromParentState\":\"Disabled\"},\"provisioningStatusMessage\":\"OK\",\"provisioningStatusUpdateTimeUtc\":\"2024-02-14T00:31:18Z\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests\",\"name\":\"dfdsdktests\",\"type\":\"Microsoft.Security/securityConnectors/devops/azureDevOpsOrgs\"}", + "isContentBase64": false + } + }, + "Update-AzSecurityConnectorAzureDevOpsOrg+[NoContext]+UpdateViaIdentityExpanded+$GET+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests?api-version=2023-09-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests?api-version=2023-09-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "69" ], + "x-ms-client-request-id": [ "d67e66d5-a899-45ad-9e05-70fd5f315b53" ], + "CommandName": [ "Get-AzSecurityConnectorAzureDevOpsOrg" ], + "FullCommandName": [ "Get-AzSecurityConnectorAzureDevOpsOrg_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=1c6c7a0a18efcd0c1f62ff61ff05f8a61bfe22533cfce5122cfd179979045df0;Path=/;HttpOnly;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com", "ARRAffinitySameSite=1c6c7a0a18efcd0c1f62ff61ff05f8a61bfe22533cfce5122cfd179979045df0;Path=/;HttpOnly;SameSite=None;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "Request-Context": [ "appId=cid-v1:b8e19897-bfe4-49ad-ad76-b9526fa18eea" ], + "mise-correlation-id": [ "976d7ba2-7b60-453d-9719-8df17854b7e1" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-request-id": [ "ce72034f-abac-453c-b6ca-6202cb84794e" ], + "x-ms-correlation-request-id": [ "ce72034f-abac-453c-b6ca-6202cb84794e" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T021252Z:ce72034f-abac-453c-b6ca-6202cb84794e" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 926C45A90E8C4A5D845165DB19F0E3BF Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:12:52Z" ], + "Date": [ "Wed, 14 Feb 2024 02:12:51 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "687" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"onboardingState\":\"Onboarded\",\"actionableRemediation\":{\"state\":\"Enabled\",\"categoryConfigurations\":[{\"minimumSeverityLevel\":\"High\",\"category\":\"IaC\"}],\"branchConfiguration\":{\"branchNames\":[],\"annotateDefaultBranch\":\"Enabled\"},\"inheritFromParentState\":\"Disabled\"},\"provisioningStatusMessage\":\"OK\",\"provisioningStatusUpdateTimeUtc\":\"2024-02-14T00:31:18Z\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests\",\"name\":\"dfdsdktests\",\"type\":\"Microsoft.Security/securityConnectors/devops/azureDevOpsOrgs\"}", + "isContentBase64": false + } + }, + "Update-AzSecurityConnectorAzureDevOpsOrg+[NoContext]+UpdateViaIdentityExpanded+$PATCH+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests?api-version=2023-09-01-preview+2": { + "Request": { + "Method": "PATCH", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests?api-version=2023-09-01-preview", + "Content": "{\r\n \"properties\": {\r\n \"actionableRemediation\": {\r\n \"state\": \"Enabled\",\r\n \"categoryConfigurations\": [\r\n {\r\n \"minimumSeverityLevel\": \"High\",\r\n \"category\": \"IaC\"\r\n }\r\n ],\r\n \"inheritFromParentState\": \"Disabled\"\r\n }\r\n }\r\n}", + "isContentBase64": false, + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "277" ] + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Retry-After": [ "20" ], + "Set-Cookie": [ "ARRAffinity=1c6c7a0a18efcd0c1f62ff61ff05f8a61bfe22533cfce5122cfd179979045df0;Path=/;HttpOnly;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com", "ARRAffinitySameSite=1c6c7a0a18efcd0c1f62ff61ff05f8a61bfe22533cfce5122cfd179979045df0;Path=/;HttpOnly;SameSite=None;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1199" ], + "Request-Context": [ "appId=cid-v1:b8e19897-bfe4-49ad-ad76-b9526fa18eea" ], + "mise-correlation-id": [ "54757811-cca6-47ff-b7a4-7b483fd51fb4" ], + "Azure-AsyncOperation": [ "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/operationResults/887b62d0-95c1-45b5-8160-6751cc02b7ee?api-version=2023-09-01-preview\u0026t=638434735732829237\u0026c=MIIHADCCBeigAwIBAgITfARmPsJdo2ShuN-ImAAABGY-wjANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDUwHhcNMjQwMTMxMjIwNzA5WhcNMjUwMTI1MjIwNzA5WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOVFiSMi9Sg6cKnrBuPHbDk_Zwa1ZNYHwLVPJArEI9N2bLrgd1mU0ZdNVcdf6rtZCkUUuCe3vxnVTGwufpwH9GPWDgJOpJoL9wgKOzUDiHLUeiWPjrK1AoaQVprZgjnzXBIWiZC2tZjbUT9pOI_ixYJJPrsCfLt7HEccnhObROE1mo_hpiPDrtOQDaX-BboNceB8vI1wmSPApGpPRM9hBRQbXgqKFC8094UNsMVkWPCrsPvP5YlMBLARlGf2WTevGKRREjstkApf1Swi7uKnpyhhsidD1yREMU0mWY9wnZfAX0jpEp3p9jKVMPQ3L-m-nSZI4zrtbW0AnI0O3pAEwe0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9DTzFQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA1LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MB0GA1UdDgQWBBT2vcy9ccvhGewsiHI1BQHsz3Wn8zAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBR61hmFKHlscXYeYPjzS--iBUIWHTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBADNBZjhX44bpBtC8kogZJGe4lYeHX95whfZ7X_CMSUuZRbQQ_b6raUpp8V8eF0YUa9b3Oa-DGrs5WfzogCuGcJPeoEVnDYzc1jlKubSIpGw73aGZzhbTjJeNf-Qe-5vTG-GcNzVtIcrwi93YSiK2LSbgrLpTL7T7znjePcGRRkCBjAslrV5SqufcsrpGmqvPAVKXRV-OIOzvXy6qmn9CHmdo0RGBXGIakbLMec_1SIS8NdPsB6i6XPjL2SDjqKTa5car7bVYlXEVsgL-000VF1t6x1II3VBNfsEJ81CdJyxaCJnwvWI6kHtCtJX9QYK3qZab9PfZRBvcetJoPdMFvBU\u0026s=GUs4-L261Vvs2uspyMgqyh4h828FgKXUht2QlN9oLtScmTlUtaZRw4wlRQ__QJrQQsVMZhXDX5XgNZXqgDlaEmeSMFjkDJYtpxiSvAT2LRpfxIoLgGgoeSnDhyefOJGH-f56FMHsUkctmCZOAhGtQT4ja3DfbhmNEfFLYi2GDzd_qTT7lkCEn9l03QNvAYAW395_JEA9pPd4fl2fRmTWOfdBcfbdzuWhh3QLLWoinRkAeyLfYLGDgsVM4ANGfjyZ3EmlmGmRPG8zqt2ToTSN-Ukox9eZwKGtnUJJ-DWV0okiZawdKFcXe7GJqc_2O5IoxM6paHeIJhv_pYZJ6V32Sw\u0026h=89GpUrozmQmZsJJHDhIyDBOvxqfxlWmPKt-eGG3z3vU" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-request-id": [ "bddd8246-f299-4e18-a70f-f995b77218ef" ], + "x-ms-correlation-request-id": [ "bddd8246-f299-4e18-a70f-f995b77218ef" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T021253Z:bddd8246-f299-4e18-a70f-f995b77218ef" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 54B0A776B4C942A29D28F35395F17F34 Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:12:52Z" ], + "Date": [ "Wed, 14 Feb 2024 02:12:52 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "281" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"onboardingState\":\"NotApplicable\",\"actionableRemediation\":{\"state\":\"Enabled\",\"categoryConfigurations\":[{\"minimumSeverityLevel\":\"High\",\"category\":\"IaC\"}],\"branchConfiguration\":{\"branchNames\":[],\"annotateDefaultBranch\":\"Enabled\"},\"inheritFromParentState\":\"Disabled\"}}}", + "isContentBase64": false + } + }, + "Update-AzSecurityConnectorAzureDevOpsOrg+[NoContext]+UpdateViaIdentityExpanded+$GET+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/operationResults/887b62d0-95c1-45b5-8160-6751cc02b7ee?api-version=2023-09-01-preview\u0026t=638434735732829237\u0026c=MIIHADCCBeigAwIBAgITfARmPsJdo2ShuN-ImAAABGY-wjANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDUwHhcNMjQwMTMxMjIwNzA5WhcNMjUwMTI1MjIwNzA5WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOVFiSMi9Sg6cKnrBuPHbDk_Zwa1ZNYHwLVPJArEI9N2bLrgd1mU0ZdNVcdf6rtZCkUUuCe3vxnVTGwufpwH9GPWDgJOpJoL9wgKOzUDiHLUeiWPjrK1AoaQVprZgjnzXBIWiZC2tZjbUT9pOI_ixYJJPrsCfLt7HEccnhObROE1mo_hpiPDrtOQDaX-BboNceB8vI1wmSPApGpPRM9hBRQbXgqKFC8094UNsMVkWPCrsPvP5YlMBLARlGf2WTevGKRREjstkApf1Swi7uKnpyhhsidD1yREMU0mWY9wnZfAX0jpEp3p9jKVMPQ3L-m-nSZI4zrtbW0AnI0O3pAEwe0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9DTzFQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA1LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MB0GA1UdDgQWBBT2vcy9ccvhGewsiHI1BQHsz3Wn8zAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBR61hmFKHlscXYeYPjzS--iBUIWHTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBADNBZjhX44bpBtC8kogZJGe4lYeHX95whfZ7X_CMSUuZRbQQ_b6raUpp8V8eF0YUa9b3Oa-DGrs5WfzogCuGcJPeoEVnDYzc1jlKubSIpGw73aGZzhbTjJeNf-Qe-5vTG-GcNzVtIcrwi93YSiK2LSbgrLpTL7T7znjePcGRRkCBjAslrV5SqufcsrpGmqvPAVKXRV-OIOzvXy6qmn9CHmdo0RGBXGIakbLMec_1SIS8NdPsB6i6XPjL2SDjqKTa5car7bVYlXEVsgL-000VF1t6x1II3VBNfsEJ81CdJyxaCJnwvWI6kHtCtJX9QYK3qZab9PfZRBvcetJoPdMFvBU\u0026s=GUs4-L261Vvs2uspyMgqyh4h828FgKXUht2QlN9oLtScmTlUtaZRw4wlRQ__QJrQQsVMZhXDX5XgNZXqgDlaEmeSMFjkDJYtpxiSvAT2LRpfxIoLgGgoeSnDhyefOJGH-f56FMHsUkctmCZOAhGtQT4ja3DfbhmNEfFLYi2GDzd_qTT7lkCEn9l03QNvAYAW395_JEA9pPd4fl2fRmTWOfdBcfbdzuWhh3QLLWoinRkAeyLfYLGDgsVM4ANGfjyZ3EmlmGmRPG8zqt2ToTSN-Ukox9eZwKGtnUJJ-DWV0okiZawdKFcXe7GJqc_2O5IoxM6paHeIJhv_pYZJ6V32Sw\u0026h=89GpUrozmQmZsJJHDhIyDBOvxqfxlWmPKt-eGG3z3vU+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/operationResults/887b62d0-95c1-45b5-8160-6751cc02b7ee?api-version=2023-09-01-preview\u0026t=638434735732829237\u0026c=MIIHADCCBeigAwIBAgITfARmPsJdo2ShuN-ImAAABGY-wjANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDUwHhcNMjQwMTMxMjIwNzA5WhcNMjUwMTI1MjIwNzA5WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOVFiSMi9Sg6cKnrBuPHbDk_Zwa1ZNYHwLVPJArEI9N2bLrgd1mU0ZdNVcdf6rtZCkUUuCe3vxnVTGwufpwH9GPWDgJOpJoL9wgKOzUDiHLUeiWPjrK1AoaQVprZgjnzXBIWiZC2tZjbUT9pOI_ixYJJPrsCfLt7HEccnhObROE1mo_hpiPDrtOQDaX-BboNceB8vI1wmSPApGpPRM9hBRQbXgqKFC8094UNsMVkWPCrsPvP5YlMBLARlGf2WTevGKRREjstkApf1Swi7uKnpyhhsidD1yREMU0mWY9wnZfAX0jpEp3p9jKVMPQ3L-m-nSZI4zrtbW0AnI0O3pAEwe0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9DTzFQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA1LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MB0GA1UdDgQWBBT2vcy9ccvhGewsiHI1BQHsz3Wn8zAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBR61hmFKHlscXYeYPjzS--iBUIWHTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBADNBZjhX44bpBtC8kogZJGe4lYeHX95whfZ7X_CMSUuZRbQQ_b6raUpp8V8eF0YUa9b3Oa-DGrs5WfzogCuGcJPeoEVnDYzc1jlKubSIpGw73aGZzhbTjJeNf-Qe-5vTG-GcNzVtIcrwi93YSiK2LSbgrLpTL7T7znjePcGRRkCBjAslrV5SqufcsrpGmqvPAVKXRV-OIOzvXy6qmn9CHmdo0RGBXGIakbLMec_1SIS8NdPsB6i6XPjL2SDjqKTa5car7bVYlXEVsgL-000VF1t6x1II3VBNfsEJ81CdJyxaCJnwvWI6kHtCtJX9QYK3qZab9PfZRBvcetJoPdMFvBU\u0026s=GUs4-L261Vvs2uspyMgqyh4h828FgKXUht2QlN9oLtScmTlUtaZRw4wlRQ__QJrQQsVMZhXDX5XgNZXqgDlaEmeSMFjkDJYtpxiSvAT2LRpfxIoLgGgoeSnDhyefOJGH-f56FMHsUkctmCZOAhGtQT4ja3DfbhmNEfFLYi2GDzd_qTT7lkCEn9l03QNvAYAW395_JEA9pPd4fl2fRmTWOfdBcfbdzuWhh3QLLWoinRkAeyLfYLGDgsVM4ANGfjyZ3EmlmGmRPG8zqt2ToTSN-Ukox9eZwKGtnUJJ-DWV0okiZawdKFcXe7GJqc_2O5IoxM6paHeIJhv_pYZJ6V32Sw\u0026h=89GpUrozmQmZsJJHDhIyDBOvxqfxlWmPKt-eGG3z3vU", + "Content": null, + "isContentBase64": false, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "71" ], + "x-ms-client-request-id": [ "7ce74df1-c8a9-4ffa-8829-8b4419a5b3b2" ], + "CommandName": [ "Update-AzSecurityConnectorAzureDevOpsOrg" ], + "FullCommandName": [ "Update-AzSecurityConnectorAzureDevOpsOrg_UpdateViaIdentityExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Retry-After": [ "20" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=14a5c7981ca45a6803ac375748e68dc9b495d4e56b3202b86256249c9784b400;Path=/;HttpOnly;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com", "ARRAffinitySameSite=14a5c7981ca45a6803ac375748e68dc9b495d4e56b3202b86256249c9784b400;Path=/;HttpOnly;SameSite=None;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "Request-Context": [ "appId=cid-v1:b8e19897-bfe4-49ad-ad76-b9526fa18eea" ], + "mise-correlation-id": [ "81ecb50c-d1f0-4780-bae5-a396f5195258" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-request-id": [ "78f27f43-5476-4e42-99ee-8a6df57e26e9" ], + "x-ms-correlation-request-id": [ "78f27f43-5476-4e42-99ee-8a6df57e26e9" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T021313Z:78f27f43-5476-4e42-99ee-8a6df57e26e9" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 577D986B290B455A8C656483D8887773 Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:13:13Z" ], + "Date": [ "Wed, 14 Feb 2024 02:13:13 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "375" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/operationResults/887b62d0-95c1-45b5-8160-6751cc02b7ee\",\"name\":\"887b62d0-95c1-45b5-8160-6751cc02b7ee\",\"status\":\"Succeeded\",\"startTime\":\"2024-02-14T02:12:53.1249568Z\",\"endTime\":\"2024-02-14T02:13:06.9642761Z\"}", + "isContentBase64": false + } + }, + "Update-AzSecurityConnectorAzureDevOpsOrg+[NoContext]+UpdateViaIdentityExpanded+$GET+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests?api-version=2023-09-01-preview+4": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests?api-version=2023-09-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "72" ], + "x-ms-client-request-id": [ "7ce74df1-c8a9-4ffa-8829-8b4419a5b3b2" ], + "CommandName": [ "Update-AzSecurityConnectorAzureDevOpsOrg" ], + "FullCommandName": [ "Update-AzSecurityConnectorAzureDevOpsOrg_UpdateViaIdentityExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=ca594a79766484e25889904bf326227201e6905138dd325ca221b8b7af91ccae;Path=/;HttpOnly;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com", "ARRAffinitySameSite=ca594a79766484e25889904bf326227201e6905138dd325ca221b8b7af91ccae;Path=/;HttpOnly;SameSite=None;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "Request-Context": [ "appId=cid-v1:b8e19897-bfe4-49ad-ad76-b9526fa18eea" ], + "mise-correlation-id": [ "50e24984-68e5-48f7-822e-9a2af1491116" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-request-id": [ "b25b5d58-7aa5-47e9-b284-a914e5366f04" ], + "x-ms-correlation-request-id": [ "b25b5d58-7aa5-47e9-b284-a914e5366f04" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T021315Z:b25b5d58-7aa5-47e9-b284-a914e5366f04" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 271A87A7A3CB40D89F695B12EEC92F36 Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:13:13Z" ], + "Date": [ "Wed, 14 Feb 2024 02:13:14 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "687" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"onboardingState\":\"Onboarded\",\"actionableRemediation\":{\"state\":\"Enabled\",\"categoryConfigurations\":[{\"minimumSeverityLevel\":\"High\",\"category\":\"IaC\"}],\"branchConfiguration\":{\"branchNames\":[],\"annotateDefaultBranch\":\"Enabled\"},\"inheritFromParentState\":\"Disabled\"},\"provisioningStatusMessage\":\"OK\",\"provisioningStatusUpdateTimeUtc\":\"2024-02-14T00:31:18Z\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests\",\"name\":\"dfdsdktests\",\"type\":\"Microsoft.Security/securityConnectors/devops/azureDevOpsOrgs\"}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/test/Update-AzSecurityConnectorAzureDevOpsOrg.Tests.ps1 b/src/Security/Security.Autorest/test/Update-AzSecurityConnectorAzureDevOpsOrg.Tests.ps1 new file mode 100644 index 000000000000..3c630ce08a99 --- /dev/null +++ b/src/Security/Security.Autorest/test/Update-AzSecurityConnectorAzureDevOpsOrg.Tests.ps1 @@ -0,0 +1,33 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Update-AzSecurityConnectorAzureDevOpsOrg')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Update-AzSecurityConnectorAzureDevOpsOrg.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Update-AzSecurityConnectorAzureDevOpsOrg' { + It 'UpdateExpanded' { + $rg = $env.SecurityConnectorsResourceGroupName + $sid = $env.SubscriptionId + $config = New-AzSecurityConnectorActionableRemediationObject -State Enabled -InheritFromParentState Disabled -CategoryConfiguration @( @{category="IaC"; minimumSeverityLevel="High"}) + Update-AzSecurityConnectorAzureDevOpsOrg -SubscriptionId $sid -ResourceGroupName $rg -SecurityConnectorName "dfdsdktests-azdo-01" -OrgName "dfdsdktests" -ActionableRemediation $config + } + + It 'UpdateViaIdentityExpanded' { + $rg = $env.SecurityConnectorsResourceGroupName + $sid = $env.SubscriptionId + + $config = New-AzSecurityConnectorActionableRemediationObject -State Enabled -InheritFromParentState Disabled -CategoryConfiguration @( @{category="IaC"; minimumSeverityLevel="High"}) + $org = Get-AzSecurityConnectorAzureDevOpsOrg -SubscriptionId $sid -ResourceGroupName $rg -SecurityConnectorName "dfdsdktests-azdo-01" -OrgName "dfdsdktests" + Update-AzSecurityConnectorAzureDevOpsOrg -InputObject $org -ActionableRemediation $config + } +} diff --git a/src/Security/Security.Autorest/test/Update-AzSecurityConnectorAzureDevOpsProject.Recording.json b/src/Security/Security.Autorest/test/Update-AzSecurityConnectorAzureDevOpsProject.Recording.json new file mode 100644 index 000000000000..85b1b91de54e --- /dev/null +++ b/src/Security/Security.Autorest/test/Update-AzSecurityConnectorAzureDevOpsProject.Recording.json @@ -0,0 +1,325 @@ +{ + "Update-AzSecurityConnectorAzureDevOpsProject+[NoContext]+UpdateExpanded+$PATCH+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests/projects/ContosoSDKDfd?api-version=2023-09-01-preview+1": { + "Request": { + "Method": "PATCH", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests/projects/ContosoSDKDfd?api-version=2023-09-01-preview", + "Content": "{\r\n \"properties\": {\r\n \"actionableRemediation\": {\r\n \"state\": \"Enabled\",\r\n \"categoryConfigurations\": [\r\n {\r\n \"minimumSeverityLevel\": \"High\",\r\n \"category\": \"IaC\"\r\n }\r\n ],\r\n \"inheritFromParentState\": \"Disabled\"\r\n }\r\n }\r\n}", + "isContentBase64": false, + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "277" ] + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Retry-After": [ "20" ], + "Set-Cookie": [ "ARRAffinity=1c6c7a0a18efcd0c1f62ff61ff05f8a61bfe22533cfce5122cfd179979045df0;Path=/;HttpOnly;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com", "ARRAffinitySameSite=1c6c7a0a18efcd0c1f62ff61ff05f8a61bfe22533cfce5122cfd179979045df0;Path=/;HttpOnly;SameSite=None;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1199" ], + "Request-Context": [ "appId=cid-v1:b8e19897-bfe4-49ad-ad76-b9526fa18eea" ], + "mise-correlation-id": [ "9fd7cde7-7ba9-413e-a340-6cb551559d4c" ], + "Azure-AsyncOperation": [ "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/operationResults/01cd23ef-c58f-4a28-946b-c827b809f66b?api-version=2023-09-01-preview\u0026t=638434735966926474\u0026c=MIIHADCCBeigAwIBAgITfARmPsJdo2ShuN-ImAAABGY-wjANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDUwHhcNMjQwMTMxMjIwNzA5WhcNMjUwMTI1MjIwNzA5WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOVFiSMi9Sg6cKnrBuPHbDk_Zwa1ZNYHwLVPJArEI9N2bLrgd1mU0ZdNVcdf6rtZCkUUuCe3vxnVTGwufpwH9GPWDgJOpJoL9wgKOzUDiHLUeiWPjrK1AoaQVprZgjnzXBIWiZC2tZjbUT9pOI_ixYJJPrsCfLt7HEccnhObROE1mo_hpiPDrtOQDaX-BboNceB8vI1wmSPApGpPRM9hBRQbXgqKFC8094UNsMVkWPCrsPvP5YlMBLARlGf2WTevGKRREjstkApf1Swi7uKnpyhhsidD1yREMU0mWY9wnZfAX0jpEp3p9jKVMPQ3L-m-nSZI4zrtbW0AnI0O3pAEwe0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9DTzFQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA1LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MB0GA1UdDgQWBBT2vcy9ccvhGewsiHI1BQHsz3Wn8zAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBR61hmFKHlscXYeYPjzS--iBUIWHTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBADNBZjhX44bpBtC8kogZJGe4lYeHX95whfZ7X_CMSUuZRbQQ_b6raUpp8V8eF0YUa9b3Oa-DGrs5WfzogCuGcJPeoEVnDYzc1jlKubSIpGw73aGZzhbTjJeNf-Qe-5vTG-GcNzVtIcrwi93YSiK2LSbgrLpTL7T7znjePcGRRkCBjAslrV5SqufcsrpGmqvPAVKXRV-OIOzvXy6qmn9CHmdo0RGBXGIakbLMec_1SIS8NdPsB6i6XPjL2SDjqKTa5car7bVYlXEVsgL-000VF1t6x1II3VBNfsEJ81CdJyxaCJnwvWI6kHtCtJX9QYK3qZab9PfZRBvcetJoPdMFvBU\u0026s=JKG-T_DhVcRmgREOGdsjSD_P7SZ09H_8qEXMJtwt0nmqF9yDlQzwepgjpkMdN45Rpw6WAY-hb8Yn13e2byQDPxfifah3m0MkTc1MfWu36nPsSkLiScJTztHjJPf7xK1B_Bwn8y52uIehaHMQiZ0ogXtasetfSOhH4qPC_Gcz4z0uiDxtBdiU8wZUBzIXrDdOKKF7PdKMeq6nA0nzDw1DTiyj8tCbc2ytFi2xsJ3NcvUhv2DtwbzMA9jR2ysxpMC84fALzO62Tf2jJUmtzADDpkPPMJhqeojDzUqyV0600wCAuUqiFFR3gPV2MjiXpb1WK9RyEri7tq2xF-iFcGYbWw\u0026h=s0bmA8OQ5oxWzKhe7kW2cGgXDjKAnVi2lHIuRaA6Uu4" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-request-id": [ "9652968f-1b83-4ad2-9d0d-da929f843da5" ], + "x-ms-correlation-request-id": [ "9652968f-1b83-4ad2-9d0d-da929f843da5" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T021316Z:9652968f-1b83-4ad2-9d0d-da929f843da5" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 86643ECB73F9405DAD0118C11A02AAD0 Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:13:16Z" ], + "Date": [ "Wed, 14 Feb 2024 02:13:16 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "281" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"onboardingState\":\"NotApplicable\",\"actionableRemediation\":{\"state\":\"Enabled\",\"categoryConfigurations\":[{\"minimumSeverityLevel\":\"High\",\"category\":\"IaC\"}],\"branchConfiguration\":{\"branchNames\":[],\"annotateDefaultBranch\":\"Enabled\"},\"inheritFromParentState\":\"Disabled\"}}}", + "isContentBase64": false + } + }, + "Update-AzSecurityConnectorAzureDevOpsProject+[NoContext]+UpdateExpanded+$GET+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/operationResults/01cd23ef-c58f-4a28-946b-c827b809f66b?api-version=2023-09-01-preview\u0026t=638434735966926474\u0026c=MIIHADCCBeigAwIBAgITfARmPsJdo2ShuN-ImAAABGY-wjANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDUwHhcNMjQwMTMxMjIwNzA5WhcNMjUwMTI1MjIwNzA5WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOVFiSMi9Sg6cKnrBuPHbDk_Zwa1ZNYHwLVPJArEI9N2bLrgd1mU0ZdNVcdf6rtZCkUUuCe3vxnVTGwufpwH9GPWDgJOpJoL9wgKOzUDiHLUeiWPjrK1AoaQVprZgjnzXBIWiZC2tZjbUT9pOI_ixYJJPrsCfLt7HEccnhObROE1mo_hpiPDrtOQDaX-BboNceB8vI1wmSPApGpPRM9hBRQbXgqKFC8094UNsMVkWPCrsPvP5YlMBLARlGf2WTevGKRREjstkApf1Swi7uKnpyhhsidD1yREMU0mWY9wnZfAX0jpEp3p9jKVMPQ3L-m-nSZI4zrtbW0AnI0O3pAEwe0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9DTzFQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA1LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MB0GA1UdDgQWBBT2vcy9ccvhGewsiHI1BQHsz3Wn8zAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBR61hmFKHlscXYeYPjzS--iBUIWHTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBADNBZjhX44bpBtC8kogZJGe4lYeHX95whfZ7X_CMSUuZRbQQ_b6raUpp8V8eF0YUa9b3Oa-DGrs5WfzogCuGcJPeoEVnDYzc1jlKubSIpGw73aGZzhbTjJeNf-Qe-5vTG-GcNzVtIcrwi93YSiK2LSbgrLpTL7T7znjePcGRRkCBjAslrV5SqufcsrpGmqvPAVKXRV-OIOzvXy6qmn9CHmdo0RGBXGIakbLMec_1SIS8NdPsB6i6XPjL2SDjqKTa5car7bVYlXEVsgL-000VF1t6x1II3VBNfsEJ81CdJyxaCJnwvWI6kHtCtJX9QYK3qZab9PfZRBvcetJoPdMFvBU\u0026s=JKG-T_DhVcRmgREOGdsjSD_P7SZ09H_8qEXMJtwt0nmqF9yDlQzwepgjpkMdN45Rpw6WAY-hb8Yn13e2byQDPxfifah3m0MkTc1MfWu36nPsSkLiScJTztHjJPf7xK1B_Bwn8y52uIehaHMQiZ0ogXtasetfSOhH4qPC_Gcz4z0uiDxtBdiU8wZUBzIXrDdOKKF7PdKMeq6nA0nzDw1DTiyj8tCbc2ytFi2xsJ3NcvUhv2DtwbzMA9jR2ysxpMC84fALzO62Tf2jJUmtzADDpkPPMJhqeojDzUqyV0600wCAuUqiFFR3gPV2MjiXpb1WK9RyEri7tq2xF-iFcGYbWw\u0026h=s0bmA8OQ5oxWzKhe7kW2cGgXDjKAnVi2lHIuRaA6Uu4+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/operationResults/01cd23ef-c58f-4a28-946b-c827b809f66b?api-version=2023-09-01-preview\u0026t=638434735966926474\u0026c=MIIHADCCBeigAwIBAgITfARmPsJdo2ShuN-ImAAABGY-wjANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDUwHhcNMjQwMTMxMjIwNzA5WhcNMjUwMTI1MjIwNzA5WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOVFiSMi9Sg6cKnrBuPHbDk_Zwa1ZNYHwLVPJArEI9N2bLrgd1mU0ZdNVcdf6rtZCkUUuCe3vxnVTGwufpwH9GPWDgJOpJoL9wgKOzUDiHLUeiWPjrK1AoaQVprZgjnzXBIWiZC2tZjbUT9pOI_ixYJJPrsCfLt7HEccnhObROE1mo_hpiPDrtOQDaX-BboNceB8vI1wmSPApGpPRM9hBRQbXgqKFC8094UNsMVkWPCrsPvP5YlMBLARlGf2WTevGKRREjstkApf1Swi7uKnpyhhsidD1yREMU0mWY9wnZfAX0jpEp3p9jKVMPQ3L-m-nSZI4zrtbW0AnI0O3pAEwe0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9DTzFQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA1LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MB0GA1UdDgQWBBT2vcy9ccvhGewsiHI1BQHsz3Wn8zAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBR61hmFKHlscXYeYPjzS--iBUIWHTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBADNBZjhX44bpBtC8kogZJGe4lYeHX95whfZ7X_CMSUuZRbQQ_b6raUpp8V8eF0YUa9b3Oa-DGrs5WfzogCuGcJPeoEVnDYzc1jlKubSIpGw73aGZzhbTjJeNf-Qe-5vTG-GcNzVtIcrwi93YSiK2LSbgrLpTL7T7znjePcGRRkCBjAslrV5SqufcsrpGmqvPAVKXRV-OIOzvXy6qmn9CHmdo0RGBXGIakbLMec_1SIS8NdPsB6i6XPjL2SDjqKTa5car7bVYlXEVsgL-000VF1t6x1II3VBNfsEJ81CdJyxaCJnwvWI6kHtCtJX9QYK3qZab9PfZRBvcetJoPdMFvBU\u0026s=JKG-T_DhVcRmgREOGdsjSD_P7SZ09H_8qEXMJtwt0nmqF9yDlQzwepgjpkMdN45Rpw6WAY-hb8Yn13e2byQDPxfifah3m0MkTc1MfWu36nPsSkLiScJTztHjJPf7xK1B_Bwn8y52uIehaHMQiZ0ogXtasetfSOhH4qPC_Gcz4z0uiDxtBdiU8wZUBzIXrDdOKKF7PdKMeq6nA0nzDw1DTiyj8tCbc2ytFi2xsJ3NcvUhv2DtwbzMA9jR2ysxpMC84fALzO62Tf2jJUmtzADDpkPPMJhqeojDzUqyV0600wCAuUqiFFR3gPV2MjiXpb1WK9RyEri7tq2xF-iFcGYbWw\u0026h=s0bmA8OQ5oxWzKhe7kW2cGgXDjKAnVi2lHIuRaA6Uu4", + "Content": null, + "isContentBase64": false, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "74" ], + "x-ms-client-request-id": [ "578d1745-ee04-40d8-9fba-36332b49c041" ], + "CommandName": [ "Update-AzSecurityConnectorAzureDevOpsProject" ], + "FullCommandName": [ "Update-AzSecurityConnectorAzureDevOpsProject_UpdateExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Retry-After": [ "20" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=ca594a79766484e25889904bf326227201e6905138dd325ca221b8b7af91ccae;Path=/;HttpOnly;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com", "ARRAffinitySameSite=ca594a79766484e25889904bf326227201e6905138dd325ca221b8b7af91ccae;Path=/;HttpOnly;SameSite=None;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "Request-Context": [ "appId=cid-v1:b8e19897-bfe4-49ad-ad76-b9526fa18eea" ], + "mise-correlation-id": [ "3e05bde5-2cc0-41bd-9263-524588723419" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-request-id": [ "2e1bb146-a63a-4d4f-a71d-af790642670c" ], + "x-ms-correlation-request-id": [ "2e1bb146-a63a-4d4f-a71d-af790642670c" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T021337Z:2e1bb146-a63a-4d4f-a71d-af790642670c" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 6A775EADDA0740F09FADB2401D0343A2 Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:13:37Z" ], + "Date": [ "Wed, 14 Feb 2024 02:13:36 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "375" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/operationResults/01cd23ef-c58f-4a28-946b-c827b809f66b\",\"name\":\"01cd23ef-c58f-4a28-946b-c827b809f66b\",\"status\":\"Succeeded\",\"startTime\":\"2024-02-14T02:13:16.4620853Z\",\"endTime\":\"2024-02-14T02:13:22.8220731Z\"}", + "isContentBase64": false + } + }, + "Update-AzSecurityConnectorAzureDevOpsProject+[NoContext]+UpdateExpanded+$GET+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests/projects/ContosoSDKDfd?api-version=2023-09-01-preview+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests/projects/ContosoSDKDfd?api-version=2023-09-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "75" ], + "x-ms-client-request-id": [ "578d1745-ee04-40d8-9fba-36332b49c041" ], + "CommandName": [ "Update-AzSecurityConnectorAzureDevOpsProject" ], + "FullCommandName": [ "Update-AzSecurityConnectorAzureDevOpsProject_UpdateExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=14a5c7981ca45a6803ac375748e68dc9b495d4e56b3202b86256249c9784b400;Path=/;HttpOnly;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com", "ARRAffinitySameSite=14a5c7981ca45a6803ac375748e68dc9b495d4e56b3202b86256249c9784b400;Path=/;HttpOnly;SameSite=None;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "Request-Context": [ "appId=cid-v1:b8e19897-bfe4-49ad-ad76-b9526fa18eea" ], + "mise-correlation-id": [ "845ae8fa-eae7-496d-8939-b7d2c5d1f963" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-request-id": [ "b98fda4a-e3c6-445a-803f-411a62d36979" ], + "x-ms-correlation-request-id": [ "b98fda4a-e3c6-445a-803f-411a62d36979" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T021337Z:b98fda4a-e3c6-445a-803f-411a62d36979" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 72C630488D7A44FE948648D25EF32B38 Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:13:37Z" ], + "Date": [ "Wed, 14 Feb 2024 02:13:37 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "802" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"parentOrgName\":\"dfdsdktests\",\"projectId\":\"161fb6f6-f2fe-4616-a627-293b788ff583\",\"onboardingState\":\"Onboarded\",\"actionableRemediation\":{\"state\":\"Enabled\",\"categoryConfigurations\":[{\"minimumSeverityLevel\":\"High\",\"category\":\"IaC\"}],\"branchConfiguration\":{\"branchNames\":[],\"annotateDefaultBranch\":\"Enabled\"},\"inheritFromParentState\":\"Disabled\"},\"provisioningStatusMessage\":\"OK\",\"provisioningStatusUpdateTimeUtc\":\"2024-02-14T00:34:19Z\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests/projects/ContosoSDKDfd\",\"name\":\"ContosoSDKDfd\",\"type\":\"Microsoft.Security/securityConnectors/devops/azureDevOpsOrgs/projects\"}", + "isContentBase64": false + } + }, + "Update-AzSecurityConnectorAzureDevOpsProject+[NoContext]+UpdateViaIdentityExpanded+$GET+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests/projects/ContosoSDKDfd?api-version=2023-09-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests/projects/ContosoSDKDfd?api-version=2023-09-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "76" ], + "x-ms-client-request-id": [ "789ad5c6-d048-4b1c-a5be-89c8d4aafa58" ], + "CommandName": [ "Get-AzSecurityConnectorAzureDevOpsProject" ], + "FullCommandName": [ "Get-AzSecurityConnectorAzureDevOpsProject_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=ca594a79766484e25889904bf326227201e6905138dd325ca221b8b7af91ccae;Path=/;HttpOnly;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com", "ARRAffinitySameSite=ca594a79766484e25889904bf326227201e6905138dd325ca221b8b7af91ccae;Path=/;HttpOnly;SameSite=None;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "Request-Context": [ "appId=cid-v1:b8e19897-bfe4-49ad-ad76-b9526fa18eea" ], + "mise-correlation-id": [ "1db7bc47-06c8-4d91-a87d-3f12b77b3b3c" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-request-id": [ "86525668-ae5f-4313-bd8b-f844ce0c0266" ], + "x-ms-correlation-request-id": [ "86525668-ae5f-4313-bd8b-f844ce0c0266" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T021338Z:86525668-ae5f-4313-bd8b-f844ce0c0266" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 8405B0532B664BF7B3A20A892E05EF9A Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:13:38Z" ], + "Date": [ "Wed, 14 Feb 2024 02:13:37 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "802" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"parentOrgName\":\"dfdsdktests\",\"projectId\":\"161fb6f6-f2fe-4616-a627-293b788ff583\",\"onboardingState\":\"Onboarded\",\"actionableRemediation\":{\"state\":\"Enabled\",\"categoryConfigurations\":[{\"minimumSeverityLevel\":\"High\",\"category\":\"IaC\"}],\"branchConfiguration\":{\"branchNames\":[],\"annotateDefaultBranch\":\"Enabled\"},\"inheritFromParentState\":\"Disabled\"},\"provisioningStatusMessage\":\"OK\",\"provisioningStatusUpdateTimeUtc\":\"2024-02-14T00:34:19Z\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests/projects/ContosoSDKDfd\",\"name\":\"ContosoSDKDfd\",\"type\":\"Microsoft.Security/securityConnectors/devops/azureDevOpsOrgs/projects\"}", + "isContentBase64": false + } + }, + "Update-AzSecurityConnectorAzureDevOpsProject+[NoContext]+UpdateViaIdentityExpanded+$PATCH+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests/projects/ContosoSDKDfd?api-version=2023-09-01-preview+2": { + "Request": { + "Method": "PATCH", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests/projects/ContosoSDKDfd?api-version=2023-09-01-preview", + "Content": "{\r\n \"properties\": {\r\n \"actionableRemediation\": {\r\n \"state\": \"Enabled\",\r\n \"categoryConfigurations\": [\r\n {\r\n \"minimumSeverityLevel\": \"High\",\r\n \"category\": \"IaC\"\r\n }\r\n ],\r\n \"inheritFromParentState\": \"Disabled\"\r\n }\r\n }\r\n}", + "isContentBase64": false, + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "277" ] + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Retry-After": [ "20" ], + "Set-Cookie": [ "ARRAffinity=b0d653e3d2c4fba6e75578139341b84b35dee63a8a317f007b2447d8196b79e5;Path=/;HttpOnly;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com", "ARRAffinitySameSite=b0d653e3d2c4fba6e75578139341b84b35dee63a8a317f007b2447d8196b79e5;Path=/;HttpOnly;SameSite=None;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1199" ], + "Request-Context": [ "appId=cid-v1:b8e19897-bfe4-49ad-ad76-b9526fa18eea" ], + "mise-correlation-id": [ "ff24f363-6d91-4016-a3e8-7e963b5f4f13" ], + "Azure-AsyncOperation": [ "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/operationResults/072824f9-c994-4c17-9b29-f79a44db47ce?api-version=2023-09-01-preview\u0026t=638434736195458798\u0026c=MIIHADCCBeigAwIBAgITfARmPsJdo2ShuN-ImAAABGY-wjANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDUwHhcNMjQwMTMxMjIwNzA5WhcNMjUwMTI1MjIwNzA5WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOVFiSMi9Sg6cKnrBuPHbDk_Zwa1ZNYHwLVPJArEI9N2bLrgd1mU0ZdNVcdf6rtZCkUUuCe3vxnVTGwufpwH9GPWDgJOpJoL9wgKOzUDiHLUeiWPjrK1AoaQVprZgjnzXBIWiZC2tZjbUT9pOI_ixYJJPrsCfLt7HEccnhObROE1mo_hpiPDrtOQDaX-BboNceB8vI1wmSPApGpPRM9hBRQbXgqKFC8094UNsMVkWPCrsPvP5YlMBLARlGf2WTevGKRREjstkApf1Swi7uKnpyhhsidD1yREMU0mWY9wnZfAX0jpEp3p9jKVMPQ3L-m-nSZI4zrtbW0AnI0O3pAEwe0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9DTzFQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA1LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MB0GA1UdDgQWBBT2vcy9ccvhGewsiHI1BQHsz3Wn8zAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBR61hmFKHlscXYeYPjzS--iBUIWHTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBADNBZjhX44bpBtC8kogZJGe4lYeHX95whfZ7X_CMSUuZRbQQ_b6raUpp8V8eF0YUa9b3Oa-DGrs5WfzogCuGcJPeoEVnDYzc1jlKubSIpGw73aGZzhbTjJeNf-Qe-5vTG-GcNzVtIcrwi93YSiK2LSbgrLpTL7T7znjePcGRRkCBjAslrV5SqufcsrpGmqvPAVKXRV-OIOzvXy6qmn9CHmdo0RGBXGIakbLMec_1SIS8NdPsB6i6XPjL2SDjqKTa5car7bVYlXEVsgL-000VF1t6x1II3VBNfsEJ81CdJyxaCJnwvWI6kHtCtJX9QYK3qZab9PfZRBvcetJoPdMFvBU\u0026s=ffQmXHhiuQw2T0ar4d2EROVFrlBoRzrsRdgusfNndyLTO7LQTD1sRc0BHzb4Zd_YoKYIUrcwZJbUwpnvSwMotHO9MKhqrmZQJ47P3T38vGAU7-xF-Cj5rLznK7uBEtK5-3-wUOtaCeawZuyeEml0OJD_1uPD04nkR6FNXqaWPz9_Mv-_cmEOiWy7v2AGk-koqCkoft50GonpII83HNYR7Z7LMzGDrs-MpZ1Ksk-AxDSt9hx670QV5ZR5bde7AaRkxa1XZkewooTf2rR4WNN-kkjMVa3Sa_1L-kUvzgPSUa9P4tv2vwFu2hOPzt_L_acCmwbI7VIud4sMPUDWhhHZVQ\u0026h=KNHS5eGwM3X001poUWPc57TWZ-mPW3Of42lCsWq4Zpc" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-request-id": [ "7d3f0d3d-0781-4bee-aa8e-4136ab62b53f" ], + "x-ms-correlation-request-id": [ "7d3f0d3d-0781-4bee-aa8e-4136ab62b53f" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T021339Z:7d3f0d3d-0781-4bee-aa8e-4136ab62b53f" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 82E4546FA2634B72B2CDD8F679558AAB Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:13:38Z" ], + "Date": [ "Wed, 14 Feb 2024 02:13:38 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "281" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"onboardingState\":\"NotApplicable\",\"actionableRemediation\":{\"state\":\"Enabled\",\"categoryConfigurations\":[{\"minimumSeverityLevel\":\"High\",\"category\":\"IaC\"}],\"branchConfiguration\":{\"branchNames\":[],\"annotateDefaultBranch\":\"Enabled\"},\"inheritFromParentState\":\"Disabled\"}}}", + "isContentBase64": false + } + }, + "Update-AzSecurityConnectorAzureDevOpsProject+[NoContext]+UpdateViaIdentityExpanded+$GET+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/operationResults/072824f9-c994-4c17-9b29-f79a44db47ce?api-version=2023-09-01-preview\u0026t=638434736195458798\u0026c=MIIHADCCBeigAwIBAgITfARmPsJdo2ShuN-ImAAABGY-wjANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDUwHhcNMjQwMTMxMjIwNzA5WhcNMjUwMTI1MjIwNzA5WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOVFiSMi9Sg6cKnrBuPHbDk_Zwa1ZNYHwLVPJArEI9N2bLrgd1mU0ZdNVcdf6rtZCkUUuCe3vxnVTGwufpwH9GPWDgJOpJoL9wgKOzUDiHLUeiWPjrK1AoaQVprZgjnzXBIWiZC2tZjbUT9pOI_ixYJJPrsCfLt7HEccnhObROE1mo_hpiPDrtOQDaX-BboNceB8vI1wmSPApGpPRM9hBRQbXgqKFC8094UNsMVkWPCrsPvP5YlMBLARlGf2WTevGKRREjstkApf1Swi7uKnpyhhsidD1yREMU0mWY9wnZfAX0jpEp3p9jKVMPQ3L-m-nSZI4zrtbW0AnI0O3pAEwe0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9DTzFQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA1LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MB0GA1UdDgQWBBT2vcy9ccvhGewsiHI1BQHsz3Wn8zAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBR61hmFKHlscXYeYPjzS--iBUIWHTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBADNBZjhX44bpBtC8kogZJGe4lYeHX95whfZ7X_CMSUuZRbQQ_b6raUpp8V8eF0YUa9b3Oa-DGrs5WfzogCuGcJPeoEVnDYzc1jlKubSIpGw73aGZzhbTjJeNf-Qe-5vTG-GcNzVtIcrwi93YSiK2LSbgrLpTL7T7znjePcGRRkCBjAslrV5SqufcsrpGmqvPAVKXRV-OIOzvXy6qmn9CHmdo0RGBXGIakbLMec_1SIS8NdPsB6i6XPjL2SDjqKTa5car7bVYlXEVsgL-000VF1t6x1II3VBNfsEJ81CdJyxaCJnwvWI6kHtCtJX9QYK3qZab9PfZRBvcetJoPdMFvBU\u0026s=ffQmXHhiuQw2T0ar4d2EROVFrlBoRzrsRdgusfNndyLTO7LQTD1sRc0BHzb4Zd_YoKYIUrcwZJbUwpnvSwMotHO9MKhqrmZQJ47P3T38vGAU7-xF-Cj5rLznK7uBEtK5-3-wUOtaCeawZuyeEml0OJD_1uPD04nkR6FNXqaWPz9_Mv-_cmEOiWy7v2AGk-koqCkoft50GonpII83HNYR7Z7LMzGDrs-MpZ1Ksk-AxDSt9hx670QV5ZR5bde7AaRkxa1XZkewooTf2rR4WNN-kkjMVa3Sa_1L-kUvzgPSUa9P4tv2vwFu2hOPzt_L_acCmwbI7VIud4sMPUDWhhHZVQ\u0026h=KNHS5eGwM3X001poUWPc57TWZ-mPW3Of42lCsWq4Zpc+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/operationResults/072824f9-c994-4c17-9b29-f79a44db47ce?api-version=2023-09-01-preview\u0026t=638434736195458798\u0026c=MIIHADCCBeigAwIBAgITfARmPsJdo2ShuN-ImAAABGY-wjANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDUwHhcNMjQwMTMxMjIwNzA5WhcNMjUwMTI1MjIwNzA5WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOVFiSMi9Sg6cKnrBuPHbDk_Zwa1ZNYHwLVPJArEI9N2bLrgd1mU0ZdNVcdf6rtZCkUUuCe3vxnVTGwufpwH9GPWDgJOpJoL9wgKOzUDiHLUeiWPjrK1AoaQVprZgjnzXBIWiZC2tZjbUT9pOI_ixYJJPrsCfLt7HEccnhObROE1mo_hpiPDrtOQDaX-BboNceB8vI1wmSPApGpPRM9hBRQbXgqKFC8094UNsMVkWPCrsPvP5YlMBLARlGf2WTevGKRREjstkApf1Swi7uKnpyhhsidD1yREMU0mWY9wnZfAX0jpEp3p9jKVMPQ3L-m-nSZI4zrtbW0AnI0O3pAEwe0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9DTzFQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA1LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MB0GA1UdDgQWBBT2vcy9ccvhGewsiHI1BQHsz3Wn8zAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBR61hmFKHlscXYeYPjzS--iBUIWHTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBADNBZjhX44bpBtC8kogZJGe4lYeHX95whfZ7X_CMSUuZRbQQ_b6raUpp8V8eF0YUa9b3Oa-DGrs5WfzogCuGcJPeoEVnDYzc1jlKubSIpGw73aGZzhbTjJeNf-Qe-5vTG-GcNzVtIcrwi93YSiK2LSbgrLpTL7T7znjePcGRRkCBjAslrV5SqufcsrpGmqvPAVKXRV-OIOzvXy6qmn9CHmdo0RGBXGIakbLMec_1SIS8NdPsB6i6XPjL2SDjqKTa5car7bVYlXEVsgL-000VF1t6x1II3VBNfsEJ81CdJyxaCJnwvWI6kHtCtJX9QYK3qZab9PfZRBvcetJoPdMFvBU\u0026s=ffQmXHhiuQw2T0ar4d2EROVFrlBoRzrsRdgusfNndyLTO7LQTD1sRc0BHzb4Zd_YoKYIUrcwZJbUwpnvSwMotHO9MKhqrmZQJ47P3T38vGAU7-xF-Cj5rLznK7uBEtK5-3-wUOtaCeawZuyeEml0OJD_1uPD04nkR6FNXqaWPz9_Mv-_cmEOiWy7v2AGk-koqCkoft50GonpII83HNYR7Z7LMzGDrs-MpZ1Ksk-AxDSt9hx670QV5ZR5bde7AaRkxa1XZkewooTf2rR4WNN-kkjMVa3Sa_1L-kUvzgPSUa9P4tv2vwFu2hOPzt_L_acCmwbI7VIud4sMPUDWhhHZVQ\u0026h=KNHS5eGwM3X001poUWPc57TWZ-mPW3Of42lCsWq4Zpc", + "Content": null, + "isContentBase64": false, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "78" ], + "x-ms-client-request-id": [ "5f532eef-e7d5-4178-aea7-123badcc4118" ], + "CommandName": [ "Update-AzSecurityConnectorAzureDevOpsProject" ], + "FullCommandName": [ "Update-AzSecurityConnectorAzureDevOpsProject_UpdateViaIdentityExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Retry-After": [ "20" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=14a5c7981ca45a6803ac375748e68dc9b495d4e56b3202b86256249c9784b400;Path=/;HttpOnly;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com", "ARRAffinitySameSite=14a5c7981ca45a6803ac375748e68dc9b495d4e56b3202b86256249c9784b400;Path=/;HttpOnly;SameSite=None;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "Request-Context": [ "appId=cid-v1:b8e19897-bfe4-49ad-ad76-b9526fa18eea" ], + "mise-correlation-id": [ "c75228dd-f914-4f3e-98b8-4010ece68b68" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-request-id": [ "21a4914f-4f29-4341-8162-eed15eaba109" ], + "x-ms-correlation-request-id": [ "21a4914f-4f29-4341-8162-eed15eaba109" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T021400Z:21a4914f-4f29-4341-8162-eed15eaba109" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: E8B888EDE01A49D8894D9DFE20068315 Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:13:59Z" ], + "Date": [ "Wed, 14 Feb 2024 02:13:59 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "375" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/operationResults/072824f9-c994-4c17-9b29-f79a44db47ce\",\"name\":\"072824f9-c994-4c17-9b29-f79a44db47ce\",\"status\":\"Succeeded\",\"startTime\":\"2024-02-14T02:13:39.3891249Z\",\"endTime\":\"2024-02-14T02:13:58.7086708Z\"}", + "isContentBase64": false + } + }, + "Update-AzSecurityConnectorAzureDevOpsProject+[NoContext]+UpdateViaIdentityExpanded+$GET+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests/projects/ContosoSDKDfd?api-version=2023-09-01-preview+4": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests/projects/ContosoSDKDfd?api-version=2023-09-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "79" ], + "x-ms-client-request-id": [ "5f532eef-e7d5-4178-aea7-123badcc4118" ], + "CommandName": [ "Update-AzSecurityConnectorAzureDevOpsProject" ], + "FullCommandName": [ "Update-AzSecurityConnectorAzureDevOpsProject_UpdateViaIdentityExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=14a5c7981ca45a6803ac375748e68dc9b495d4e56b3202b86256249c9784b400;Path=/;HttpOnly;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com", "ARRAffinitySameSite=14a5c7981ca45a6803ac375748e68dc9b495d4e56b3202b86256249c9784b400;Path=/;HttpOnly;SameSite=None;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "Request-Context": [ "appId=cid-v1:b8e19897-bfe4-49ad-ad76-b9526fa18eea" ], + "mise-correlation-id": [ "96e4df39-b618-490d-b4d9-d91d55a7afc9" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-request-id": [ "e63656cb-4cc9-404f-b48a-99726dcc1f77" ], + "x-ms-correlation-request-id": [ "e63656cb-4cc9-404f-b48a-99726dcc1f77" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T021400Z:e63656cb-4cc9-404f-b48a-99726dcc1f77" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 8BB2B9998A3B4360B09529B0D7269AA5 Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:14:00Z" ], + "Date": [ "Wed, 14 Feb 2024 02:13:59 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "802" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"parentOrgName\":\"dfdsdktests\",\"projectId\":\"161fb6f6-f2fe-4616-a627-293b788ff583\",\"onboardingState\":\"Onboarded\",\"actionableRemediation\":{\"state\":\"Enabled\",\"categoryConfigurations\":[{\"minimumSeverityLevel\":\"High\",\"category\":\"IaC\"}],\"branchConfiguration\":{\"branchNames\":[],\"annotateDefaultBranch\":\"Enabled\"},\"inheritFromParentState\":\"Disabled\"},\"provisioningStatusMessage\":\"OK\",\"provisioningStatusUpdateTimeUtc\":\"2024-02-14T00:34:19Z\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests/projects/ContosoSDKDfd\",\"name\":\"ContosoSDKDfd\",\"type\":\"Microsoft.Security/securityConnectors/devops/azureDevOpsOrgs/projects\"}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/test/Update-AzSecurityConnectorAzureDevOpsProject.Tests.ps1 b/src/Security/Security.Autorest/test/Update-AzSecurityConnectorAzureDevOpsProject.Tests.ps1 new file mode 100644 index 000000000000..05c6630915f5 --- /dev/null +++ b/src/Security/Security.Autorest/test/Update-AzSecurityConnectorAzureDevOpsProject.Tests.ps1 @@ -0,0 +1,33 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Update-AzSecurityConnectorAzureDevOpsProject')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Update-AzSecurityConnectorAzureDevOpsProject.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Update-AzSecurityConnectorAzureDevOpsProject' { + It 'UpdateExpanded' { + $rg = $env.SecurityConnectorsResourceGroupName + $sid = $env.SubscriptionId + $config = New-AzSecurityConnectorActionableRemediationObject -State Enabled -InheritFromParentState Disabled -CategoryConfiguration @( @{category="IaC"; minimumSeverityLevel="High"}) + Update-AzSecurityConnectorAzureDevOpsProject -SubscriptionId $sid -ResourceGroupName $rg -SecurityConnectorName "dfdsdktests-azdo-01" -OrgName "dfdsdktests" -ProjectName "ContosoSDKDfd" -ActionableRemediation $config + } + + It 'UpdateViaIdentityExpanded' { + $rg = $env.SecurityConnectorsResourceGroupName + $sid = $env.SubscriptionId + + $config = New-AzSecurityConnectorActionableRemediationObject -State Enabled -InheritFromParentState Disabled -CategoryConfiguration @( @{category="IaC"; minimumSeverityLevel="High"}) + $project = Get-AzSecurityConnectorAzureDevOpsProject -SubscriptionId $sid -ResourceGroupName $rg -SecurityConnectorName "dfdsdktests-azdo-01" -OrgName "dfdsdktests" -ProjectName "ContosoSDKDfd" + Update-AzSecurityConnectorAzureDevOpsProject -InputObject $project -ActionableRemediation $config + } +} diff --git a/src/Security/Security.Autorest/test/Update-AzSecurityConnectorAzureDevOpsRepo.Recording.json b/src/Security/Security.Autorest/test/Update-AzSecurityConnectorAzureDevOpsRepo.Recording.json new file mode 100644 index 000000000000..27ec7f1a9fb9 --- /dev/null +++ b/src/Security/Security.Autorest/test/Update-AzSecurityConnectorAzureDevOpsRepo.Recording.json @@ -0,0 +1,373 @@ +{ + "Update-AzSecurityConnectorAzureDevOpsRepo+[NoContext]+UpdateExpanded+$PATCH+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests/projects/ContosoSDKDfd/repos/TestApp2?api-version=2023-09-01-preview+1": { + "Request": { + "Method": "PATCH", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests/projects/ContosoSDKDfd/repos/TestApp2?api-version=2023-09-01-preview", + "Content": "{\r\n \"properties\": {\r\n \"actionableRemediation\": {\r\n \"state\": \"Enabled\",\r\n \"categoryConfigurations\": [\r\n {\r\n \"minimumSeverityLevel\": \"High\",\r\n \"category\": \"IaC\"\r\n }\r\n ],\r\n \"inheritFromParentState\": \"Enabled\"\r\n }\r\n }\r\n}", + "isContentBase64": false, + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "276" ] + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Retry-After": [ "20" ], + "Set-Cookie": [ "ARRAffinity=1c6c7a0a18efcd0c1f62ff61ff05f8a61bfe22533cfce5122cfd179979045df0;Path=/;HttpOnly;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com", "ARRAffinitySameSite=1c6c7a0a18efcd0c1f62ff61ff05f8a61bfe22533cfce5122cfd179979045df0;Path=/;HttpOnly;SameSite=None;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1199" ], + "Request-Context": [ "appId=cid-v1:b8e19897-bfe4-49ad-ad76-b9526fa18eea" ], + "mise-correlation-id": [ "52595737-87b9-4478-b80c-f9ce52e6a949" ], + "Azure-AsyncOperation": [ "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/operationResults/43b6a033-5ab4-436f-86a2-3f7033f39a61?api-version=2023-09-01-preview\u0026t=638434736421667150\u0026c=MIIHADCCBeigAwIBAgITfARmPsJdo2ShuN-ImAAABGY-wjANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDUwHhcNMjQwMTMxMjIwNzA5WhcNMjUwMTI1MjIwNzA5WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOVFiSMi9Sg6cKnrBuPHbDk_Zwa1ZNYHwLVPJArEI9N2bLrgd1mU0ZdNVcdf6rtZCkUUuCe3vxnVTGwufpwH9GPWDgJOpJoL9wgKOzUDiHLUeiWPjrK1AoaQVprZgjnzXBIWiZC2tZjbUT9pOI_ixYJJPrsCfLt7HEccnhObROE1mo_hpiPDrtOQDaX-BboNceB8vI1wmSPApGpPRM9hBRQbXgqKFC8094UNsMVkWPCrsPvP5YlMBLARlGf2WTevGKRREjstkApf1Swi7uKnpyhhsidD1yREMU0mWY9wnZfAX0jpEp3p9jKVMPQ3L-m-nSZI4zrtbW0AnI0O3pAEwe0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9DTzFQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA1LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MB0GA1UdDgQWBBT2vcy9ccvhGewsiHI1BQHsz3Wn8zAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBR61hmFKHlscXYeYPjzS--iBUIWHTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBADNBZjhX44bpBtC8kogZJGe4lYeHX95whfZ7X_CMSUuZRbQQ_b6raUpp8V8eF0YUa9b3Oa-DGrs5WfzogCuGcJPeoEVnDYzc1jlKubSIpGw73aGZzhbTjJeNf-Qe-5vTG-GcNzVtIcrwi93YSiK2LSbgrLpTL7T7znjePcGRRkCBjAslrV5SqufcsrpGmqvPAVKXRV-OIOzvXy6qmn9CHmdo0RGBXGIakbLMec_1SIS8NdPsB6i6XPjL2SDjqKTa5car7bVYlXEVsgL-000VF1t6x1II3VBNfsEJ81CdJyxaCJnwvWI6kHtCtJX9QYK3qZab9PfZRBvcetJoPdMFvBU\u0026s=AtvmxjBPTXu2um0JuBBiJ9IcC324tWcMdTVD0fHi1Scx2PTMab499Xw3g-yfK60SF03yuriW3rlortMdtj8d1BI1nBQdtlrsvRkax6ds6id1n3_tmRJUthX3ToOi5Pt2hfL07btraavcXB0Utm8ocg2te8RShF8Y5Sf1e5XX-Vv7N9lazTPN9k8hr2ibpxQVoRH_TyaQdr22M5574Mfea4oBfr0DEnBZsksDgDCtNRe8ZpACuApyxMZc3TfJpdzWw2PLoSdPboa-CVAP_9hZviYvkSdpLgfcU0PSaW8ZhbOJ59KgP8hveFd1xpfbBX2gVy69sDz5Do7_IbHsEvDS_g\u0026h=xJoJ_PEd7utG2tKcQCnk71a6HkbXmNMe_2JVKyjXFdU" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-request-id": [ "a4e0f81e-8260-4297-a37d-88bf66698c46" ], + "x-ms-correlation-request-id": [ "a4e0f81e-8260-4297-a37d-88bf66698c46" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T021402Z:a4e0f81e-8260-4297-a37d-88bf66698c46" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: BF8454C6F7534CD49061800BF83D49BF Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:14:01Z" ], + "Date": [ "Wed, 14 Feb 2024 02:14:01 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "280" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"onboardingState\":\"NotApplicable\",\"actionableRemediation\":{\"state\":\"Enabled\",\"categoryConfigurations\":[{\"minimumSeverityLevel\":\"High\",\"category\":\"IaC\"}],\"branchConfiguration\":{\"branchNames\":[],\"annotateDefaultBranch\":\"Enabled\"},\"inheritFromParentState\":\"Enabled\"}}}", + "isContentBase64": false + } + }, + "Update-AzSecurityConnectorAzureDevOpsRepo+[NoContext]+UpdateExpanded+$GET+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/operationResults/43b6a033-5ab4-436f-86a2-3f7033f39a61?api-version=2023-09-01-preview\u0026t=638434736421667150\u0026c=MIIHADCCBeigAwIBAgITfARmPsJdo2ShuN-ImAAABGY-wjANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDUwHhcNMjQwMTMxMjIwNzA5WhcNMjUwMTI1MjIwNzA5WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOVFiSMi9Sg6cKnrBuPHbDk_Zwa1ZNYHwLVPJArEI9N2bLrgd1mU0ZdNVcdf6rtZCkUUuCe3vxnVTGwufpwH9GPWDgJOpJoL9wgKOzUDiHLUeiWPjrK1AoaQVprZgjnzXBIWiZC2tZjbUT9pOI_ixYJJPrsCfLt7HEccnhObROE1mo_hpiPDrtOQDaX-BboNceB8vI1wmSPApGpPRM9hBRQbXgqKFC8094UNsMVkWPCrsPvP5YlMBLARlGf2WTevGKRREjstkApf1Swi7uKnpyhhsidD1yREMU0mWY9wnZfAX0jpEp3p9jKVMPQ3L-m-nSZI4zrtbW0AnI0O3pAEwe0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9DTzFQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA1LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MB0GA1UdDgQWBBT2vcy9ccvhGewsiHI1BQHsz3Wn8zAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBR61hmFKHlscXYeYPjzS--iBUIWHTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBADNBZjhX44bpBtC8kogZJGe4lYeHX95whfZ7X_CMSUuZRbQQ_b6raUpp8V8eF0YUa9b3Oa-DGrs5WfzogCuGcJPeoEVnDYzc1jlKubSIpGw73aGZzhbTjJeNf-Qe-5vTG-GcNzVtIcrwi93YSiK2LSbgrLpTL7T7znjePcGRRkCBjAslrV5SqufcsrpGmqvPAVKXRV-OIOzvXy6qmn9CHmdo0RGBXGIakbLMec_1SIS8NdPsB6i6XPjL2SDjqKTa5car7bVYlXEVsgL-000VF1t6x1II3VBNfsEJ81CdJyxaCJnwvWI6kHtCtJX9QYK3qZab9PfZRBvcetJoPdMFvBU\u0026s=AtvmxjBPTXu2um0JuBBiJ9IcC324tWcMdTVD0fHi1Scx2PTMab499Xw3g-yfK60SF03yuriW3rlortMdtj8d1BI1nBQdtlrsvRkax6ds6id1n3_tmRJUthX3ToOi5Pt2hfL07btraavcXB0Utm8ocg2te8RShF8Y5Sf1e5XX-Vv7N9lazTPN9k8hr2ibpxQVoRH_TyaQdr22M5574Mfea4oBfr0DEnBZsksDgDCtNRe8ZpACuApyxMZc3TfJpdzWw2PLoSdPboa-CVAP_9hZviYvkSdpLgfcU0PSaW8ZhbOJ59KgP8hveFd1xpfbBX2gVy69sDz5Do7_IbHsEvDS_g\u0026h=xJoJ_PEd7utG2tKcQCnk71a6HkbXmNMe_2JVKyjXFdU+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/operationResults/43b6a033-5ab4-436f-86a2-3f7033f39a61?api-version=2023-09-01-preview\u0026t=638434736421667150\u0026c=MIIHADCCBeigAwIBAgITfARmPsJdo2ShuN-ImAAABGY-wjANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDUwHhcNMjQwMTMxMjIwNzA5WhcNMjUwMTI1MjIwNzA5WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOVFiSMi9Sg6cKnrBuPHbDk_Zwa1ZNYHwLVPJArEI9N2bLrgd1mU0ZdNVcdf6rtZCkUUuCe3vxnVTGwufpwH9GPWDgJOpJoL9wgKOzUDiHLUeiWPjrK1AoaQVprZgjnzXBIWiZC2tZjbUT9pOI_ixYJJPrsCfLt7HEccnhObROE1mo_hpiPDrtOQDaX-BboNceB8vI1wmSPApGpPRM9hBRQbXgqKFC8094UNsMVkWPCrsPvP5YlMBLARlGf2WTevGKRREjstkApf1Swi7uKnpyhhsidD1yREMU0mWY9wnZfAX0jpEp3p9jKVMPQ3L-m-nSZI4zrtbW0AnI0O3pAEwe0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9DTzFQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA1LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MB0GA1UdDgQWBBT2vcy9ccvhGewsiHI1BQHsz3Wn8zAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBR61hmFKHlscXYeYPjzS--iBUIWHTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBADNBZjhX44bpBtC8kogZJGe4lYeHX95whfZ7X_CMSUuZRbQQ_b6raUpp8V8eF0YUa9b3Oa-DGrs5WfzogCuGcJPeoEVnDYzc1jlKubSIpGw73aGZzhbTjJeNf-Qe-5vTG-GcNzVtIcrwi93YSiK2LSbgrLpTL7T7znjePcGRRkCBjAslrV5SqufcsrpGmqvPAVKXRV-OIOzvXy6qmn9CHmdo0RGBXGIakbLMec_1SIS8NdPsB6i6XPjL2SDjqKTa5car7bVYlXEVsgL-000VF1t6x1II3VBNfsEJ81CdJyxaCJnwvWI6kHtCtJX9QYK3qZab9PfZRBvcetJoPdMFvBU\u0026s=AtvmxjBPTXu2um0JuBBiJ9IcC324tWcMdTVD0fHi1Scx2PTMab499Xw3g-yfK60SF03yuriW3rlortMdtj8d1BI1nBQdtlrsvRkax6ds6id1n3_tmRJUthX3ToOi5Pt2hfL07btraavcXB0Utm8ocg2te8RShF8Y5Sf1e5XX-Vv7N9lazTPN9k8hr2ibpxQVoRH_TyaQdr22M5574Mfea4oBfr0DEnBZsksDgDCtNRe8ZpACuApyxMZc3TfJpdzWw2PLoSdPboa-CVAP_9hZviYvkSdpLgfcU0PSaW8ZhbOJ59KgP8hveFd1xpfbBX2gVy69sDz5Do7_IbHsEvDS_g\u0026h=xJoJ_PEd7utG2tKcQCnk71a6HkbXmNMe_2JVKyjXFdU", + "Content": null, + "isContentBase64": false, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "81" ], + "x-ms-client-request-id": [ "78142230-db30-4946-af09-371522f20031" ], + "CommandName": [ "Update-AzSecurityConnectorAzureDevOpsRepo" ], + "FullCommandName": [ "Update-AzSecurityConnectorAzureDevOpsRepo_UpdateExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Retry-After": [ "20" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=ca594a79766484e25889904bf326227201e6905138dd325ca221b8b7af91ccae;Path=/;HttpOnly;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com", "ARRAffinitySameSite=ca594a79766484e25889904bf326227201e6905138dd325ca221b8b7af91ccae;Path=/;HttpOnly;SameSite=None;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "Request-Context": [ "appId=cid-v1:b8e19897-bfe4-49ad-ad76-b9526fa18eea" ], + "mise-correlation-id": [ "2cd0b6ad-a148-4e51-b0b1-13f0c14416ba" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-request-id": [ "30132605-4610-4b0a-b27f-07f04d352a33" ], + "x-ms-correlation-request-id": [ "30132605-4610-4b0a-b27f-07f04d352a33" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T021422Z:30132605-4610-4b0a-b27f-07f04d352a33" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 88FB6BAEFD964E459F58FCF3E45A487D Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:14:22Z" ], + "Date": [ "Wed, 14 Feb 2024 02:14:22 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "333" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/operationResults/43b6a033-5ab4-436f-86a2-3f7033f39a61\",\"name\":\"43b6a033-5ab4-436f-86a2-3f7033f39a61\",\"status\":\"Accepted\",\"startTime\":\"2024-02-14T02:14:02.0239148Z\"}", + "isContentBase64": false + } + }, + "Update-AzSecurityConnectorAzureDevOpsRepo+[NoContext]+UpdateExpanded+$GET+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/operationResults/43b6a033-5ab4-436f-86a2-3f7033f39a61?api-version=2023-09-01-preview\u0026t=638434736421667150\u0026c=MIIHADCCBeigAwIBAgITfARmPsJdo2ShuN-ImAAABGY-wjANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDUwHhcNMjQwMTMxMjIwNzA5WhcNMjUwMTI1MjIwNzA5WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOVFiSMi9Sg6cKnrBuPHbDk_Zwa1ZNYHwLVPJArEI9N2bLrgd1mU0ZdNVcdf6rtZCkUUuCe3vxnVTGwufpwH9GPWDgJOpJoL9wgKOzUDiHLUeiWPjrK1AoaQVprZgjnzXBIWiZC2tZjbUT9pOI_ixYJJPrsCfLt7HEccnhObROE1mo_hpiPDrtOQDaX-BboNceB8vI1wmSPApGpPRM9hBRQbXgqKFC8094UNsMVkWPCrsPvP5YlMBLARlGf2WTevGKRREjstkApf1Swi7uKnpyhhsidD1yREMU0mWY9wnZfAX0jpEp3p9jKVMPQ3L-m-nSZI4zrtbW0AnI0O3pAEwe0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9DTzFQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA1LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MB0GA1UdDgQWBBT2vcy9ccvhGewsiHI1BQHsz3Wn8zAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBR61hmFKHlscXYeYPjzS--iBUIWHTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBADNBZjhX44bpBtC8kogZJGe4lYeHX95whfZ7X_CMSUuZRbQQ_b6raUpp8V8eF0YUa9b3Oa-DGrs5WfzogCuGcJPeoEVnDYzc1jlKubSIpGw73aGZzhbTjJeNf-Qe-5vTG-GcNzVtIcrwi93YSiK2LSbgrLpTL7T7znjePcGRRkCBjAslrV5SqufcsrpGmqvPAVKXRV-OIOzvXy6qmn9CHmdo0RGBXGIakbLMec_1SIS8NdPsB6i6XPjL2SDjqKTa5car7bVYlXEVsgL-000VF1t6x1II3VBNfsEJ81CdJyxaCJnwvWI6kHtCtJX9QYK3qZab9PfZRBvcetJoPdMFvBU\u0026s=AtvmxjBPTXu2um0JuBBiJ9IcC324tWcMdTVD0fHi1Scx2PTMab499Xw3g-yfK60SF03yuriW3rlortMdtj8d1BI1nBQdtlrsvRkax6ds6id1n3_tmRJUthX3ToOi5Pt2hfL07btraavcXB0Utm8ocg2te8RShF8Y5Sf1e5XX-Vv7N9lazTPN9k8hr2ibpxQVoRH_TyaQdr22M5574Mfea4oBfr0DEnBZsksDgDCtNRe8ZpACuApyxMZc3TfJpdzWw2PLoSdPboa-CVAP_9hZviYvkSdpLgfcU0PSaW8ZhbOJ59KgP8hveFd1xpfbBX2gVy69sDz5Do7_IbHsEvDS_g\u0026h=xJoJ_PEd7utG2tKcQCnk71a6HkbXmNMe_2JVKyjXFdU+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/operationResults/43b6a033-5ab4-436f-86a2-3f7033f39a61?api-version=2023-09-01-preview\u0026t=638434736421667150\u0026c=MIIHADCCBeigAwIBAgITfARmPsJdo2ShuN-ImAAABGY-wjANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDUwHhcNMjQwMTMxMjIwNzA5WhcNMjUwMTI1MjIwNzA5WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOVFiSMi9Sg6cKnrBuPHbDk_Zwa1ZNYHwLVPJArEI9N2bLrgd1mU0ZdNVcdf6rtZCkUUuCe3vxnVTGwufpwH9GPWDgJOpJoL9wgKOzUDiHLUeiWPjrK1AoaQVprZgjnzXBIWiZC2tZjbUT9pOI_ixYJJPrsCfLt7HEccnhObROE1mo_hpiPDrtOQDaX-BboNceB8vI1wmSPApGpPRM9hBRQbXgqKFC8094UNsMVkWPCrsPvP5YlMBLARlGf2WTevGKRREjstkApf1Swi7uKnpyhhsidD1yREMU0mWY9wnZfAX0jpEp3p9jKVMPQ3L-m-nSZI4zrtbW0AnI0O3pAEwe0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9DTzFQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA1LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MB0GA1UdDgQWBBT2vcy9ccvhGewsiHI1BQHsz3Wn8zAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBR61hmFKHlscXYeYPjzS--iBUIWHTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBADNBZjhX44bpBtC8kogZJGe4lYeHX95whfZ7X_CMSUuZRbQQ_b6raUpp8V8eF0YUa9b3Oa-DGrs5WfzogCuGcJPeoEVnDYzc1jlKubSIpGw73aGZzhbTjJeNf-Qe-5vTG-GcNzVtIcrwi93YSiK2LSbgrLpTL7T7znjePcGRRkCBjAslrV5SqufcsrpGmqvPAVKXRV-OIOzvXy6qmn9CHmdo0RGBXGIakbLMec_1SIS8NdPsB6i6XPjL2SDjqKTa5car7bVYlXEVsgL-000VF1t6x1II3VBNfsEJ81CdJyxaCJnwvWI6kHtCtJX9QYK3qZab9PfZRBvcetJoPdMFvBU\u0026s=AtvmxjBPTXu2um0JuBBiJ9IcC324tWcMdTVD0fHi1Scx2PTMab499Xw3g-yfK60SF03yuriW3rlortMdtj8d1BI1nBQdtlrsvRkax6ds6id1n3_tmRJUthX3ToOi5Pt2hfL07btraavcXB0Utm8ocg2te8RShF8Y5Sf1e5XX-Vv7N9lazTPN9k8hr2ibpxQVoRH_TyaQdr22M5574Mfea4oBfr0DEnBZsksDgDCtNRe8ZpACuApyxMZc3TfJpdzWw2PLoSdPboa-CVAP_9hZviYvkSdpLgfcU0PSaW8ZhbOJ59KgP8hveFd1xpfbBX2gVy69sDz5Do7_IbHsEvDS_g\u0026h=xJoJ_PEd7utG2tKcQCnk71a6HkbXmNMe_2JVKyjXFdU", + "Content": null, + "isContentBase64": false, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "82" ], + "x-ms-client-request-id": [ "78142230-db30-4946-af09-371522f20031" ], + "CommandName": [ "Update-AzSecurityConnectorAzureDevOpsRepo" ], + "FullCommandName": [ "Update-AzSecurityConnectorAzureDevOpsRepo_UpdateExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Retry-After": [ "20" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=b0d653e3d2c4fba6e75578139341b84b35dee63a8a317f007b2447d8196b79e5;Path=/;HttpOnly;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com", "ARRAffinitySameSite=b0d653e3d2c4fba6e75578139341b84b35dee63a8a317f007b2447d8196b79e5;Path=/;HttpOnly;SameSite=None;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "Request-Context": [ "appId=cid-v1:b8e19897-bfe4-49ad-ad76-b9526fa18eea" ], + "mise-correlation-id": [ "8afe6371-f820-46e7-b221-f52dc3fc802b" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-request-id": [ "fd0de110-c522-4963-8f76-98aa0c0c00be" ], + "x-ms-correlation-request-id": [ "fd0de110-c522-4963-8f76-98aa0c0c00be" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T021443Z:fd0de110-c522-4963-8f76-98aa0c0c00be" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: C149135F2FC84E10AF97C3CE4F8D8BEB Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:14:43Z" ], + "Date": [ "Wed, 14 Feb 2024 02:14:42 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "375" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/operationResults/43b6a033-5ab4-436f-86a2-3f7033f39a61\",\"name\":\"43b6a033-5ab4-436f-86a2-3f7033f39a61\",\"status\":\"Succeeded\",\"startTime\":\"2024-02-14T02:14:02.0239148Z\",\"endTime\":\"2024-02-14T02:14:32.7218931Z\"}", + "isContentBase64": false + } + }, + "Update-AzSecurityConnectorAzureDevOpsRepo+[NoContext]+UpdateExpanded+$GET+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests/projects/ContosoSDKDfd/repos/TestApp2?api-version=2023-09-01-preview+4": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests/projects/ContosoSDKDfd/repos/TestApp2?api-version=2023-09-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "83" ], + "x-ms-client-request-id": [ "78142230-db30-4946-af09-371522f20031" ], + "CommandName": [ "Update-AzSecurityConnectorAzureDevOpsRepo" ], + "FullCommandName": [ "Update-AzSecurityConnectorAzureDevOpsRepo_UpdateExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=14a5c7981ca45a6803ac375748e68dc9b495d4e56b3202b86256249c9784b400;Path=/;HttpOnly;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com", "ARRAffinitySameSite=14a5c7981ca45a6803ac375748e68dc9b495d4e56b3202b86256249c9784b400;Path=/;HttpOnly;SameSite=None;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "Request-Context": [ "appId=cid-v1:b8e19897-bfe4-49ad-ad76-b9526fa18eea" ], + "mise-correlation-id": [ "f7b6c24b-b647-48a8-8664-950b5d72efe7" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-request-id": [ "80e90634-8290-4e92-aaeb-cdce1cfa085f" ], + "x-ms-correlation-request-id": [ "80e90634-8290-4e92-aaeb-cdce1cfa085f" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T021443Z:80e90634-8290-4e92-aaeb-cdce1cfa085f" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 94544801301845A4879064663D2D9792 Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:14:43Z" ], + "Date": [ "Wed, 14 Feb 2024 02:14:43 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "924" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"parentOrgName\":\"dfdsdktests\",\"parentProjectName\":\"ContosoSDKDfd\",\"repoId\":\"77c1e69a-41a5-4de7-8b9c-0acab45f5bca\",\"repoUrl\":\"https://dev.azure.com/dfdsdktests/ContosoSDKDfd/_git/TestApp2\",\"onboardingState\":\"Onboarded\",\"actionableRemediation\":{\"state\":\"Enabled\",\"categoryConfigurations\":[{\"minimumSeverityLevel\":\"High\",\"category\":\"IaC\"}],\"branchConfiguration\":{\"branchNames\":[],\"annotateDefaultBranch\":\"Enabled\"},\"inheritFromParentState\":\"Enabled\"},\"provisioningStatusMessage\":\"OK\",\"provisioningStatusUpdateTimeUtc\":\"2024-02-14T00:34:19Z\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests/projects/ContosoSDKDfd/repos/TestApp2\",\"name\":\"TestApp2\",\"type\":\"Microsoft.Security/securityConnectors/devops/azureDevOpsOrgs/projects/repos\"}", + "isContentBase64": false + } + }, + "Update-AzSecurityConnectorAzureDevOpsRepo+[NoContext]+UpdateViaIdentityExpanded+$GET+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests/projects/ContosoSDKDfd/repos/TestApp2?api-version=2023-09-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests/projects/ContosoSDKDfd/repos/TestApp2?api-version=2023-09-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "84" ], + "x-ms-client-request-id": [ "91129a75-69dc-44e5-b789-c5f41151bb87" ], + "CommandName": [ "Get-AzSecurityConnectorAzureDevOpsRepo" ], + "FullCommandName": [ "Get-AzSecurityConnectorAzureDevOpsRepo_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=b0d653e3d2c4fba6e75578139341b84b35dee63a8a317f007b2447d8196b79e5;Path=/;HttpOnly;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com", "ARRAffinitySameSite=b0d653e3d2c4fba6e75578139341b84b35dee63a8a317f007b2447d8196b79e5;Path=/;HttpOnly;SameSite=None;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11998" ], + "Request-Context": [ "appId=cid-v1:b8e19897-bfe4-49ad-ad76-b9526fa18eea" ], + "mise-correlation-id": [ "20b48edd-c229-4c24-829e-d86019a20c39" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-request-id": [ "73066d75-a321-46e9-b2d8-b767bc0f4908" ], + "x-ms-correlation-request-id": [ "73066d75-a321-46e9-b2d8-b767bc0f4908" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T021444Z:73066d75-a321-46e9-b2d8-b767bc0f4908" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 5F4D40C6FA9C421890EAA2947BEC8B78 Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:14:44Z" ], + "Date": [ "Wed, 14 Feb 2024 02:14:43 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "924" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"parentOrgName\":\"dfdsdktests\",\"parentProjectName\":\"ContosoSDKDfd\",\"repoId\":\"77c1e69a-41a5-4de7-8b9c-0acab45f5bca\",\"repoUrl\":\"https://dev.azure.com/dfdsdktests/ContosoSDKDfd/_git/TestApp2\",\"onboardingState\":\"Onboarded\",\"actionableRemediation\":{\"state\":\"Enabled\",\"categoryConfigurations\":[{\"minimumSeverityLevel\":\"High\",\"category\":\"IaC\"}],\"branchConfiguration\":{\"branchNames\":[],\"annotateDefaultBranch\":\"Enabled\"},\"inheritFromParentState\":\"Enabled\"},\"provisioningStatusMessage\":\"OK\",\"provisioningStatusUpdateTimeUtc\":\"2024-02-14T00:34:19Z\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests/projects/ContosoSDKDfd/repos/TestApp2\",\"name\":\"TestApp2\",\"type\":\"Microsoft.Security/securityConnectors/devops/azureDevOpsOrgs/projects/repos\"}", + "isContentBase64": false + } + }, + "Update-AzSecurityConnectorAzureDevOpsRepo+[NoContext]+UpdateViaIdentityExpanded+$PATCH+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests/projects/ContosoSDKDfd/repos/TestApp2?api-version=2023-09-01-preview+2": { + "Request": { + "Method": "PATCH", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests/projects/ContosoSDKDfd/repos/TestApp2?api-version=2023-09-01-preview", + "Content": "{\r\n \"properties\": {\r\n \"actionableRemediation\": {\r\n \"state\": \"Enabled\",\r\n \"categoryConfigurations\": [\r\n {\r\n \"minimumSeverityLevel\": \"High\",\r\n \"category\": \"IaC\"\r\n }\r\n ],\r\n \"inheritFromParentState\": \"Enabled\"\r\n }\r\n }\r\n}", + "isContentBase64": false, + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "276" ] + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Retry-After": [ "20" ], + "Set-Cookie": [ "ARRAffinity=14a5c7981ca45a6803ac375748e68dc9b495d4e56b3202b86256249c9784b400;Path=/;HttpOnly;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com", "ARRAffinitySameSite=14a5c7981ca45a6803ac375748e68dc9b495d4e56b3202b86256249c9784b400;Path=/;HttpOnly;SameSite=None;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1199" ], + "Request-Context": [ "appId=cid-v1:b8e19897-bfe4-49ad-ad76-b9526fa18eea" ], + "mise-correlation-id": [ "1ce4aebb-1f6e-4e5f-aac5-253a2af9338c" ], + "Azure-AsyncOperation": [ "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/operationResults/a3f54152-359a-44d0-889b-af0d797ee7d0?api-version=2023-09-01-preview\u0026t=638434736852271315\u0026c=MIIHADCCBeigAwIBAgITfARmPsJdo2ShuN-ImAAABGY-wjANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDUwHhcNMjQwMTMxMjIwNzA5WhcNMjUwMTI1MjIwNzA5WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOVFiSMi9Sg6cKnrBuPHbDk_Zwa1ZNYHwLVPJArEI9N2bLrgd1mU0ZdNVcdf6rtZCkUUuCe3vxnVTGwufpwH9GPWDgJOpJoL9wgKOzUDiHLUeiWPjrK1AoaQVprZgjnzXBIWiZC2tZjbUT9pOI_ixYJJPrsCfLt7HEccnhObROE1mo_hpiPDrtOQDaX-BboNceB8vI1wmSPApGpPRM9hBRQbXgqKFC8094UNsMVkWPCrsPvP5YlMBLARlGf2WTevGKRREjstkApf1Swi7uKnpyhhsidD1yREMU0mWY9wnZfAX0jpEp3p9jKVMPQ3L-m-nSZI4zrtbW0AnI0O3pAEwe0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9DTzFQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA1LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MB0GA1UdDgQWBBT2vcy9ccvhGewsiHI1BQHsz3Wn8zAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBR61hmFKHlscXYeYPjzS--iBUIWHTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBADNBZjhX44bpBtC8kogZJGe4lYeHX95whfZ7X_CMSUuZRbQQ_b6raUpp8V8eF0YUa9b3Oa-DGrs5WfzogCuGcJPeoEVnDYzc1jlKubSIpGw73aGZzhbTjJeNf-Qe-5vTG-GcNzVtIcrwi93YSiK2LSbgrLpTL7T7znjePcGRRkCBjAslrV5SqufcsrpGmqvPAVKXRV-OIOzvXy6qmn9CHmdo0RGBXGIakbLMec_1SIS8NdPsB6i6XPjL2SDjqKTa5car7bVYlXEVsgL-000VF1t6x1II3VBNfsEJ81CdJyxaCJnwvWI6kHtCtJX9QYK3qZab9PfZRBvcetJoPdMFvBU\u0026s=f1m3iLLFE5alrEFCCW-0oVn8Pbh6DCoBjvZIlMBgCLo5Xoh1Vt58lKv8nAucuVZ8SZdUmY6L_a0DwHNyCkiWKyzno2LHnd6H7B7sn2fdQyIO5ffAA9iUNBP1Q_FmkFeetFUmfJwPP6pYF8je0-3exBpicxcF_7wr_ZSrutYCc6jfSGlGHSeWo1QPI7Bbm_NzJ3Vx8wicawqwYRdsnhzDEfIrIB8DQnVpBwuRViJWP3LLCzS1nElhEkAuq5MaO63ALXdL7hKkEJB5ROMyDIDNRoElaNZlEMOo8qhBfaIcKVTODM07q80ApqYgmzIOz3yBDh6xzh7M2JGjHqUXZZVA_g\u0026h=xtiUzOVWhdeSBRLVJLDJ0Na36Ed7F8y-Cl8eCQdR-So" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-request-id": [ "ade0fd5e-6fad-44aa-b310-1c9fb52b596a" ], + "x-ms-correlation-request-id": [ "ade0fd5e-6fad-44aa-b310-1c9fb52b596a" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T021445Z:ade0fd5e-6fad-44aa-b310-1c9fb52b596a" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: DAD749970A6543469D1191467C581E48 Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:14:44Z" ], + "Date": [ "Wed, 14 Feb 2024 02:14:44 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "280" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"onboardingState\":\"NotApplicable\",\"actionableRemediation\":{\"state\":\"Enabled\",\"categoryConfigurations\":[{\"minimumSeverityLevel\":\"High\",\"category\":\"IaC\"}],\"branchConfiguration\":{\"branchNames\":[],\"annotateDefaultBranch\":\"Enabled\"},\"inheritFromParentState\":\"Enabled\"}}}", + "isContentBase64": false + } + }, + "Update-AzSecurityConnectorAzureDevOpsRepo+[NoContext]+UpdateViaIdentityExpanded+$GET+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/operationResults/a3f54152-359a-44d0-889b-af0d797ee7d0?api-version=2023-09-01-preview\u0026t=638434736852271315\u0026c=MIIHADCCBeigAwIBAgITfARmPsJdo2ShuN-ImAAABGY-wjANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDUwHhcNMjQwMTMxMjIwNzA5WhcNMjUwMTI1MjIwNzA5WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOVFiSMi9Sg6cKnrBuPHbDk_Zwa1ZNYHwLVPJArEI9N2bLrgd1mU0ZdNVcdf6rtZCkUUuCe3vxnVTGwufpwH9GPWDgJOpJoL9wgKOzUDiHLUeiWPjrK1AoaQVprZgjnzXBIWiZC2tZjbUT9pOI_ixYJJPrsCfLt7HEccnhObROE1mo_hpiPDrtOQDaX-BboNceB8vI1wmSPApGpPRM9hBRQbXgqKFC8094UNsMVkWPCrsPvP5YlMBLARlGf2WTevGKRREjstkApf1Swi7uKnpyhhsidD1yREMU0mWY9wnZfAX0jpEp3p9jKVMPQ3L-m-nSZI4zrtbW0AnI0O3pAEwe0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9DTzFQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA1LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MB0GA1UdDgQWBBT2vcy9ccvhGewsiHI1BQHsz3Wn8zAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBR61hmFKHlscXYeYPjzS--iBUIWHTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBADNBZjhX44bpBtC8kogZJGe4lYeHX95whfZ7X_CMSUuZRbQQ_b6raUpp8V8eF0YUa9b3Oa-DGrs5WfzogCuGcJPeoEVnDYzc1jlKubSIpGw73aGZzhbTjJeNf-Qe-5vTG-GcNzVtIcrwi93YSiK2LSbgrLpTL7T7znjePcGRRkCBjAslrV5SqufcsrpGmqvPAVKXRV-OIOzvXy6qmn9CHmdo0RGBXGIakbLMec_1SIS8NdPsB6i6XPjL2SDjqKTa5car7bVYlXEVsgL-000VF1t6x1II3VBNfsEJ81CdJyxaCJnwvWI6kHtCtJX9QYK3qZab9PfZRBvcetJoPdMFvBU\u0026s=f1m3iLLFE5alrEFCCW-0oVn8Pbh6DCoBjvZIlMBgCLo5Xoh1Vt58lKv8nAucuVZ8SZdUmY6L_a0DwHNyCkiWKyzno2LHnd6H7B7sn2fdQyIO5ffAA9iUNBP1Q_FmkFeetFUmfJwPP6pYF8je0-3exBpicxcF_7wr_ZSrutYCc6jfSGlGHSeWo1QPI7Bbm_NzJ3Vx8wicawqwYRdsnhzDEfIrIB8DQnVpBwuRViJWP3LLCzS1nElhEkAuq5MaO63ALXdL7hKkEJB5ROMyDIDNRoElaNZlEMOo8qhBfaIcKVTODM07q80ApqYgmzIOz3yBDh6xzh7M2JGjHqUXZZVA_g\u0026h=xtiUzOVWhdeSBRLVJLDJ0Na36Ed7F8y-Cl8eCQdR-So+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/operationResults/a3f54152-359a-44d0-889b-af0d797ee7d0?api-version=2023-09-01-preview\u0026t=638434736852271315\u0026c=MIIHADCCBeigAwIBAgITfARmPsJdo2ShuN-ImAAABGY-wjANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDUwHhcNMjQwMTMxMjIwNzA5WhcNMjUwMTI1MjIwNzA5WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOVFiSMi9Sg6cKnrBuPHbDk_Zwa1ZNYHwLVPJArEI9N2bLrgd1mU0ZdNVcdf6rtZCkUUuCe3vxnVTGwufpwH9GPWDgJOpJoL9wgKOzUDiHLUeiWPjrK1AoaQVprZgjnzXBIWiZC2tZjbUT9pOI_ixYJJPrsCfLt7HEccnhObROE1mo_hpiPDrtOQDaX-BboNceB8vI1wmSPApGpPRM9hBRQbXgqKFC8094UNsMVkWPCrsPvP5YlMBLARlGf2WTevGKRREjstkApf1Swi7uKnpyhhsidD1yREMU0mWY9wnZfAX0jpEp3p9jKVMPQ3L-m-nSZI4zrtbW0AnI0O3pAEwe0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9DTzFQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA1LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MB0GA1UdDgQWBBT2vcy9ccvhGewsiHI1BQHsz3Wn8zAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBR61hmFKHlscXYeYPjzS--iBUIWHTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBADNBZjhX44bpBtC8kogZJGe4lYeHX95whfZ7X_CMSUuZRbQQ_b6raUpp8V8eF0YUa9b3Oa-DGrs5WfzogCuGcJPeoEVnDYzc1jlKubSIpGw73aGZzhbTjJeNf-Qe-5vTG-GcNzVtIcrwi93YSiK2LSbgrLpTL7T7znjePcGRRkCBjAslrV5SqufcsrpGmqvPAVKXRV-OIOzvXy6qmn9CHmdo0RGBXGIakbLMec_1SIS8NdPsB6i6XPjL2SDjqKTa5car7bVYlXEVsgL-000VF1t6x1II3VBNfsEJ81CdJyxaCJnwvWI6kHtCtJX9QYK3qZab9PfZRBvcetJoPdMFvBU\u0026s=f1m3iLLFE5alrEFCCW-0oVn8Pbh6DCoBjvZIlMBgCLo5Xoh1Vt58lKv8nAucuVZ8SZdUmY6L_a0DwHNyCkiWKyzno2LHnd6H7B7sn2fdQyIO5ffAA9iUNBP1Q_FmkFeetFUmfJwPP6pYF8je0-3exBpicxcF_7wr_ZSrutYCc6jfSGlGHSeWo1QPI7Bbm_NzJ3Vx8wicawqwYRdsnhzDEfIrIB8DQnVpBwuRViJWP3LLCzS1nElhEkAuq5MaO63ALXdL7hKkEJB5ROMyDIDNRoElaNZlEMOo8qhBfaIcKVTODM07q80ApqYgmzIOz3yBDh6xzh7M2JGjHqUXZZVA_g\u0026h=xtiUzOVWhdeSBRLVJLDJ0Na36Ed7F8y-Cl8eCQdR-So", + "Content": null, + "isContentBase64": false, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "86" ], + "x-ms-client-request-id": [ "eea58c8b-3a78-4948-b6d2-4315fa60a41b" ], + "CommandName": [ "Update-AzSecurityConnectorAzureDevOpsRepo" ], + "FullCommandName": [ "Update-AzSecurityConnectorAzureDevOpsRepo_UpdateViaIdentityExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Retry-After": [ "20" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=b0d653e3d2c4fba6e75578139341b84b35dee63a8a317f007b2447d8196b79e5;Path=/;HttpOnly;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com", "ARRAffinitySameSite=b0d653e3d2c4fba6e75578139341b84b35dee63a8a317f007b2447d8196b79e5;Path=/;HttpOnly;SameSite=None;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "Request-Context": [ "appId=cid-v1:b8e19897-bfe4-49ad-ad76-b9526fa18eea" ], + "mise-correlation-id": [ "941f39a4-a226-4177-b791-d9e70055c28e" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-request-id": [ "97e47fae-fe99-453b-ad05-9dacb919bea3" ], + "x-ms-correlation-request-id": [ "97e47fae-fe99-453b-ad05-9dacb919bea3" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T021505Z:97e47fae-fe99-453b-ad05-9dacb919bea3" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 590D9708D4B9419BAB6C6C0919222350 Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:15:05Z" ], + "Date": [ "Wed, 14 Feb 2024 02:15:05 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "375" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/operationResults/a3f54152-359a-44d0-889b-af0d797ee7d0\",\"name\":\"a3f54152-359a-44d0-889b-af0d797ee7d0\",\"status\":\"Succeeded\",\"startTime\":\"2024-02-14T02:14:45.0906399Z\",\"endTime\":\"2024-02-14T02:14:45.7387043Z\"}", + "isContentBase64": false + } + }, + "Update-AzSecurityConnectorAzureDevOpsRepo+[NoContext]+UpdateViaIdentityExpanded+$GET+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests/projects/ContosoSDKDfd/repos/TestApp2?api-version=2023-09-01-preview+4": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests/projects/ContosoSDKDfd/repos/TestApp2?api-version=2023-09-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "87" ], + "x-ms-client-request-id": [ "eea58c8b-3a78-4948-b6d2-4315fa60a41b" ], + "CommandName": [ "Update-AzSecurityConnectorAzureDevOpsRepo" ], + "FullCommandName": [ "Update-AzSecurityConnectorAzureDevOpsRepo_UpdateViaIdentityExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=1c6c7a0a18efcd0c1f62ff61ff05f8a61bfe22533cfce5122cfd179979045df0;Path=/;HttpOnly;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com", "ARRAffinitySameSite=1c6c7a0a18efcd0c1f62ff61ff05f8a61bfe22533cfce5122cfd179979045df0;Path=/;HttpOnly;SameSite=None;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "Request-Context": [ "appId=cid-v1:b8e19897-bfe4-49ad-ad76-b9526fa18eea" ], + "mise-correlation-id": [ "31fe5b81-c40e-45fa-8db8-8f95d0a9d702" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-request-id": [ "1dfa8bfc-5bf0-457c-8d0d-90011c6ec79e" ], + "x-ms-correlation-request-id": [ "1dfa8bfc-5bf0-457c-8d0d-90011c6ec79e" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T021506Z:1dfa8bfc-5bf0-457c-8d0d-90011c6ec79e" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 6ABDF5642AE245CBA695C4BFA47CE05B Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:15:06Z" ], + "Date": [ "Wed, 14 Feb 2024 02:15:05 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "924" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"parentOrgName\":\"dfdsdktests\",\"parentProjectName\":\"ContosoSDKDfd\",\"repoId\":\"77c1e69a-41a5-4de7-8b9c-0acab45f5bca\",\"repoUrl\":\"https://dev.azure.com/dfdsdktests/ContosoSDKDfd/_git/TestApp2\",\"onboardingState\":\"Onboarded\",\"actionableRemediation\":{\"state\":\"Enabled\",\"categoryConfigurations\":[{\"minimumSeverityLevel\":\"High\",\"category\":\"IaC\"}],\"branchConfiguration\":{\"branchNames\":[],\"annotateDefaultBranch\":\"Enabled\"},\"inheritFromParentState\":\"Enabled\"},\"provisioningStatusMessage\":\"OK\",\"provisioningStatusUpdateTimeUtc\":\"2024-02-14T00:34:19Z\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/azureDevOpsOrgs/dfdsdktests/projects/ContosoSDKDfd/repos/TestApp2\",\"name\":\"TestApp2\",\"type\":\"Microsoft.Security/securityConnectors/devops/azureDevOpsOrgs/projects/repos\"}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/test/Update-AzSecurityConnectorAzureDevOpsRepo.Tests.ps1 b/src/Security/Security.Autorest/test/Update-AzSecurityConnectorAzureDevOpsRepo.Tests.ps1 new file mode 100644 index 000000000000..5266aeb62de7 --- /dev/null +++ b/src/Security/Security.Autorest/test/Update-AzSecurityConnectorAzureDevOpsRepo.Tests.ps1 @@ -0,0 +1,33 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Update-AzSecurityConnectorAzureDevOpsRepo')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Update-AzSecurityConnectorAzureDevOpsRepo.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Update-AzSecurityConnectorAzureDevOpsRepo' { + It 'UpdateExpanded' { + $rg = $env.SecurityConnectorsResourceGroupName + $sid = $env.SubscriptionId + $config = New-AzSecurityConnectorActionableRemediationObject -State Enabled -InheritFromParentState Enabled -CategoryConfiguration @( @{category="IaC"; minimumSeverityLevel="High"}) + Update-AzSecurityConnectorAzureDevOpsRepo -SubscriptionId $sid -ResourceGroupName $rg -SecurityConnectorName "dfdsdktests-azdo-01" -OrgName "dfdsdktests" -ProjectName "ContosoSDKDfd" -RepoName "TestApp2" -ActionableRemediation $config + } + + It 'UpdateViaIdentityExpanded' { + $rg = $env.SecurityConnectorsResourceGroupName + $sid = $env.SubscriptionId + + $config = New-AzSecurityConnectorActionableRemediationObject -State Enabled -InheritFromParentState Enabled -CategoryConfiguration @( @{category="IaC"; minimumSeverityLevel="High"}) + $repo = Get-AzSecurityConnectorAzureDevOpsRepo -SubscriptionId $sid -ResourceGroupName $rg -SecurityConnectorName "dfdsdktests-azdo-01" -OrgName "dfdsdktests" -ProjectName "ContosoSDKDfd" -RepoName "TestApp2" + Update-AzSecurityConnectorAzureDevOpsRepo -InputObject $repo -ActionableRemediation $config + } +} diff --git a/src/Security/Security.Autorest/test/Update-AzSecurityConnectorDevOpsConfiguration.Recording.json b/src/Security/Security.Autorest/test/Update-AzSecurityConnectorDevOpsConfiguration.Recording.json new file mode 100644 index 000000000000..23335004d946 --- /dev/null +++ b/src/Security/Security.Autorest/test/Update-AzSecurityConnectorDevOpsConfiguration.Recording.json @@ -0,0 +1,325 @@ +{ + "Update-AzSecurityConnectorDevOpsConfiguration+[NoContext]+UpdateExpanded+$PATCH+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default?api-version=2023-09-01-preview+1": { + "Request": { + "Method": "PATCH", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default?api-version=2023-09-01-preview", + "Content": "{\r\n \"properties\": {\r\n \"autoDiscovery\": \"Disabled\",\r\n \"topLevelInventoryList\": [ \"dfdsdktests\" ]\r\n }\r\n}", + "isContentBase64": false, + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "110" ] + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Retry-After": [ "20" ], + "Set-Cookie": [ "ARRAffinity=ca594a79766484e25889904bf326227201e6905138dd325ca221b8b7af91ccae;Path=/;HttpOnly;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com", "ARRAffinitySameSite=ca594a79766484e25889904bf326227201e6905138dd325ca221b8b7af91ccae;Path=/;HttpOnly;SameSite=None;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1199" ], + "Request-Context": [ "appId=cid-v1:b8e19897-bfe4-49ad-ad76-b9526fa18eea" ], + "mise-correlation-id": [ "5e923fca-8c4c-437c-8558-1fcb78ecbd49" ], + "Azure-AsyncOperation": [ "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/operationResults/638e559a-5dc1-4f12-a066-2948a2664a1c?api-version=2023-09-01-preview\u0026t=638434737084147492\u0026c=MIIHADCCBeigAwIBAgITfARmPsJdo2ShuN-ImAAABGY-wjANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDUwHhcNMjQwMTMxMjIwNzA5WhcNMjUwMTI1MjIwNzA5WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOVFiSMi9Sg6cKnrBuPHbDk_Zwa1ZNYHwLVPJArEI9N2bLrgd1mU0ZdNVcdf6rtZCkUUuCe3vxnVTGwufpwH9GPWDgJOpJoL9wgKOzUDiHLUeiWPjrK1AoaQVprZgjnzXBIWiZC2tZjbUT9pOI_ixYJJPrsCfLt7HEccnhObROE1mo_hpiPDrtOQDaX-BboNceB8vI1wmSPApGpPRM9hBRQbXgqKFC8094UNsMVkWPCrsPvP5YlMBLARlGf2WTevGKRREjstkApf1Swi7uKnpyhhsidD1yREMU0mWY9wnZfAX0jpEp3p9jKVMPQ3L-m-nSZI4zrtbW0AnI0O3pAEwe0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9DTzFQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA1LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MB0GA1UdDgQWBBT2vcy9ccvhGewsiHI1BQHsz3Wn8zAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBR61hmFKHlscXYeYPjzS--iBUIWHTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBADNBZjhX44bpBtC8kogZJGe4lYeHX95whfZ7X_CMSUuZRbQQ_b6raUpp8V8eF0YUa9b3Oa-DGrs5WfzogCuGcJPeoEVnDYzc1jlKubSIpGw73aGZzhbTjJeNf-Qe-5vTG-GcNzVtIcrwi93YSiK2LSbgrLpTL7T7znjePcGRRkCBjAslrV5SqufcsrpGmqvPAVKXRV-OIOzvXy6qmn9CHmdo0RGBXGIakbLMec_1SIS8NdPsB6i6XPjL2SDjqKTa5car7bVYlXEVsgL-000VF1t6x1II3VBNfsEJ81CdJyxaCJnwvWI6kHtCtJX9QYK3qZab9PfZRBvcetJoPdMFvBU\u0026s=XQZyoiarm9D3H32uXvdVilxkcuYqpW3OSlthIWn4iJli7iFKSiYW-8jDSXZSGhZnSH2IqL_9Wd9JKxGQ10z69e3xHxkovCwKD7czsqEz4aNsj8bNFprxhR0RrCRoumyXRio5Zapm4AyVrOsBK-Q46LgHeMqZNLlOt-akr7NAJXmB2ghlCvzR5ibIRe2HiiaL1s-tqR4QoKzHrIl0IDhCPNJXm_0_ffvfbEmKEOeKXv1wo1wEpo7MnaR2Wg675b8BN7iMLQwHLeynjhbA5t1Wwfke-2b2Las9Q_mvkqVht49lCH1pGH7MYXuGrBGRhfjrBj32h5jo_7CfbMO-R3bd1w\u0026h=pFrPXVZRiU8fEMj8ZO0p2TsmTpktlNuqRRxnXwI09CU" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-request-id": [ "3a48ad70-39a5-432f-a1eb-22fcd5342ce1" ], + "x-ms-correlation-request-id": [ "3a48ad70-39a5-432f-a1eb-22fcd5342ce1" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T021508Z:3a48ad70-39a5-432f-a1eb-22fcd5342ce1" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 28E92D8D8CDF4504BDED74E22206353C Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:15:06Z" ], + "Date": [ "Wed, 14 Feb 2024 02:15:07 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "363" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"tags\":{},\"properties\":{\"autoDiscovery\":\"Disabled\",\"topLevelInventoryList\":[\"dfdsdktests\"],\"provisioningState\":\"Pending\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default\",\"name\":\"default\",\"type\":\"Microsoft.Security/securityConnectors/devops\"}", + "isContentBase64": false + } + }, + "Update-AzSecurityConnectorDevOpsConfiguration+[NoContext]+UpdateExpanded+$GET+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/operationResults/638e559a-5dc1-4f12-a066-2948a2664a1c?api-version=2023-09-01-preview\u0026t=638434737084147492\u0026c=MIIHADCCBeigAwIBAgITfARmPsJdo2ShuN-ImAAABGY-wjANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDUwHhcNMjQwMTMxMjIwNzA5WhcNMjUwMTI1MjIwNzA5WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOVFiSMi9Sg6cKnrBuPHbDk_Zwa1ZNYHwLVPJArEI9N2bLrgd1mU0ZdNVcdf6rtZCkUUuCe3vxnVTGwufpwH9GPWDgJOpJoL9wgKOzUDiHLUeiWPjrK1AoaQVprZgjnzXBIWiZC2tZjbUT9pOI_ixYJJPrsCfLt7HEccnhObROE1mo_hpiPDrtOQDaX-BboNceB8vI1wmSPApGpPRM9hBRQbXgqKFC8094UNsMVkWPCrsPvP5YlMBLARlGf2WTevGKRREjstkApf1Swi7uKnpyhhsidD1yREMU0mWY9wnZfAX0jpEp3p9jKVMPQ3L-m-nSZI4zrtbW0AnI0O3pAEwe0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9DTzFQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA1LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MB0GA1UdDgQWBBT2vcy9ccvhGewsiHI1BQHsz3Wn8zAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBR61hmFKHlscXYeYPjzS--iBUIWHTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBADNBZjhX44bpBtC8kogZJGe4lYeHX95whfZ7X_CMSUuZRbQQ_b6raUpp8V8eF0YUa9b3Oa-DGrs5WfzogCuGcJPeoEVnDYzc1jlKubSIpGw73aGZzhbTjJeNf-Qe-5vTG-GcNzVtIcrwi93YSiK2LSbgrLpTL7T7znjePcGRRkCBjAslrV5SqufcsrpGmqvPAVKXRV-OIOzvXy6qmn9CHmdo0RGBXGIakbLMec_1SIS8NdPsB6i6XPjL2SDjqKTa5car7bVYlXEVsgL-000VF1t6x1II3VBNfsEJ81CdJyxaCJnwvWI6kHtCtJX9QYK3qZab9PfZRBvcetJoPdMFvBU\u0026s=XQZyoiarm9D3H32uXvdVilxkcuYqpW3OSlthIWn4iJli7iFKSiYW-8jDSXZSGhZnSH2IqL_9Wd9JKxGQ10z69e3xHxkovCwKD7czsqEz4aNsj8bNFprxhR0RrCRoumyXRio5Zapm4AyVrOsBK-Q46LgHeMqZNLlOt-akr7NAJXmB2ghlCvzR5ibIRe2HiiaL1s-tqR4QoKzHrIl0IDhCPNJXm_0_ffvfbEmKEOeKXv1wo1wEpo7MnaR2Wg675b8BN7iMLQwHLeynjhbA5t1Wwfke-2b2Las9Q_mvkqVht49lCH1pGH7MYXuGrBGRhfjrBj32h5jo_7CfbMO-R3bd1w\u0026h=pFrPXVZRiU8fEMj8ZO0p2TsmTpktlNuqRRxnXwI09CU+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/operationResults/638e559a-5dc1-4f12-a066-2948a2664a1c?api-version=2023-09-01-preview\u0026t=638434737084147492\u0026c=MIIHADCCBeigAwIBAgITfARmPsJdo2ShuN-ImAAABGY-wjANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDUwHhcNMjQwMTMxMjIwNzA5WhcNMjUwMTI1MjIwNzA5WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOVFiSMi9Sg6cKnrBuPHbDk_Zwa1ZNYHwLVPJArEI9N2bLrgd1mU0ZdNVcdf6rtZCkUUuCe3vxnVTGwufpwH9GPWDgJOpJoL9wgKOzUDiHLUeiWPjrK1AoaQVprZgjnzXBIWiZC2tZjbUT9pOI_ixYJJPrsCfLt7HEccnhObROE1mo_hpiPDrtOQDaX-BboNceB8vI1wmSPApGpPRM9hBRQbXgqKFC8094UNsMVkWPCrsPvP5YlMBLARlGf2WTevGKRREjstkApf1Swi7uKnpyhhsidD1yREMU0mWY9wnZfAX0jpEp3p9jKVMPQ3L-m-nSZI4zrtbW0AnI0O3pAEwe0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9DTzFQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA1LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MB0GA1UdDgQWBBT2vcy9ccvhGewsiHI1BQHsz3Wn8zAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBR61hmFKHlscXYeYPjzS--iBUIWHTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBADNBZjhX44bpBtC8kogZJGe4lYeHX95whfZ7X_CMSUuZRbQQ_b6raUpp8V8eF0YUa9b3Oa-DGrs5WfzogCuGcJPeoEVnDYzc1jlKubSIpGw73aGZzhbTjJeNf-Qe-5vTG-GcNzVtIcrwi93YSiK2LSbgrLpTL7T7znjePcGRRkCBjAslrV5SqufcsrpGmqvPAVKXRV-OIOzvXy6qmn9CHmdo0RGBXGIakbLMec_1SIS8NdPsB6i6XPjL2SDjqKTa5car7bVYlXEVsgL-000VF1t6x1II3VBNfsEJ81CdJyxaCJnwvWI6kHtCtJX9QYK3qZab9PfZRBvcetJoPdMFvBU\u0026s=XQZyoiarm9D3H32uXvdVilxkcuYqpW3OSlthIWn4iJli7iFKSiYW-8jDSXZSGhZnSH2IqL_9Wd9JKxGQ10z69e3xHxkovCwKD7czsqEz4aNsj8bNFprxhR0RrCRoumyXRio5Zapm4AyVrOsBK-Q46LgHeMqZNLlOt-akr7NAJXmB2ghlCvzR5ibIRe2HiiaL1s-tqR4QoKzHrIl0IDhCPNJXm_0_ffvfbEmKEOeKXv1wo1wEpo7MnaR2Wg675b8BN7iMLQwHLeynjhbA5t1Wwfke-2b2Las9Q_mvkqVht49lCH1pGH7MYXuGrBGRhfjrBj32h5jo_7CfbMO-R3bd1w\u0026h=pFrPXVZRiU8fEMj8ZO0p2TsmTpktlNuqRRxnXwI09CU", + "Content": null, + "isContentBase64": false, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "89" ], + "x-ms-client-request-id": [ "d6abcced-099b-46f4-9016-2fafc441a640" ], + "CommandName": [ "Update-AzSecurityConnectorDevOpsConfiguration" ], + "FullCommandName": [ "Update-AzSecurityConnectorDevOpsConfiguration_UpdateExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Retry-After": [ "20" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=14a5c7981ca45a6803ac375748e68dc9b495d4e56b3202b86256249c9784b400;Path=/;HttpOnly;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com", "ARRAffinitySameSite=14a5c7981ca45a6803ac375748e68dc9b495d4e56b3202b86256249c9784b400;Path=/;HttpOnly;SameSite=None;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "Request-Context": [ "appId=cid-v1:b8e19897-bfe4-49ad-ad76-b9526fa18eea" ], + "mise-correlation-id": [ "6ae09bc9-0d88-4b75-a7f1-abe2dad33257" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-request-id": [ "22cb9c22-b8f2-4829-aece-2cad319485a7" ], + "x-ms-correlation-request-id": [ "22cb9c22-b8f2-4829-aece-2cad319485a7" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T021528Z:22cb9c22-b8f2-4829-aece-2cad319485a7" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 08859B2AED4C4008BD48E7F1B09D668F Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:15:28Z" ], + "Date": [ "Wed, 14 Feb 2024 02:15:28 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "374" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/operationResults/638e559a-5dc1-4f12-a066-2948a2664a1c\",\"name\":\"638e559a-5dc1-4f12-a066-2948a2664a1c\",\"status\":\"Succeeded\",\"startTime\":\"2024-02-14T02:15:07.382047Z\",\"endTime\":\"2024-02-14T02:15:26.7216856Z\"}", + "isContentBase64": false + } + }, + "Update-AzSecurityConnectorDevOpsConfiguration+[NoContext]+UpdateExpanded+$GET+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default?api-version=2023-09-01-preview+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default?api-version=2023-09-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "90" ], + "x-ms-client-request-id": [ "d6abcced-099b-46f4-9016-2fafc441a640" ], + "CommandName": [ "Update-AzSecurityConnectorDevOpsConfiguration" ], + "FullCommandName": [ "Update-AzSecurityConnectorDevOpsConfiguration_UpdateExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=b0d653e3d2c4fba6e75578139341b84b35dee63a8a317f007b2447d8196b79e5;Path=/;HttpOnly;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com", "ARRAffinitySameSite=b0d653e3d2c4fba6e75578139341b84b35dee63a8a317f007b2447d8196b79e5;Path=/;HttpOnly;SameSite=None;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "Request-Context": [ "appId=cid-v1:b8e19897-bfe4-49ad-ad76-b9526fa18eea" ], + "mise-correlation-id": [ "2b9c2350-0859-467b-89fb-55c7215aba21" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-request-id": [ "fa92015f-37d1-45cb-9532-8dd4a3206b0a" ], + "x-ms-correlation-request-id": [ "fa92015f-37d1-45cb-9532-8dd4a3206b0a" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T021529Z:fa92015f-37d1-45cb-9532-8dd4a3206b0a" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 5E235861BA54459387D4562935121D03 Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:15:29Z" ], + "Date": [ "Wed, 14 Feb 2024 02:15:28 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "408" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"centralus\",\"tags\":{},\"properties\":{\"autoDiscovery\":\"Disabled\",\"provisioningStatusMessage\":\"Resource creation successful.\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default\",\"name\":\"default\",\"type\":\"Microsoft.Security/securityConnectors/devops\"}", + "isContentBase64": false + } + }, + "Update-AzSecurityConnectorDevOpsConfiguration+[NoContext]+UpdateViaIdentityExpanded+$GET+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default?api-version=2023-09-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default?api-version=2023-09-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "91" ], + "x-ms-client-request-id": [ "999896e1-83ee-4d8d-817e-fd107bc4dc05" ], + "CommandName": [ "Get-AzSecurityConnectorDevOpsConfiguration" ], + "FullCommandName": [ "Get-AzSecurityConnectorDevOpsConfiguration_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=ca594a79766484e25889904bf326227201e6905138dd325ca221b8b7af91ccae;Path=/;HttpOnly;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com", "ARRAffinitySameSite=ca594a79766484e25889904bf326227201e6905138dd325ca221b8b7af91ccae;Path=/;HttpOnly;SameSite=None;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11998" ], + "Request-Context": [ "appId=cid-v1:b8e19897-bfe4-49ad-ad76-b9526fa18eea" ], + "mise-correlation-id": [ "94090c18-c145-4c1d-8632-976b23cceb0c" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-request-id": [ "256cf873-6dce-4735-8db4-1ce3645d8d04" ], + "x-ms-correlation-request-id": [ "256cf873-6dce-4735-8db4-1ce3645d8d04" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T021531Z:256cf873-6dce-4735-8db4-1ce3645d8d04" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 8CDC411A42234EBD8C7317C681A92C6F Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:15:29Z" ], + "Date": [ "Wed, 14 Feb 2024 02:15:30 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "408" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"centralus\",\"tags\":{},\"properties\":{\"autoDiscovery\":\"Disabled\",\"provisioningStatusMessage\":\"Resource creation successful.\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default\",\"name\":\"default\",\"type\":\"Microsoft.Security/securityConnectors/devops\"}", + "isContentBase64": false + } + }, + "Update-AzSecurityConnectorDevOpsConfiguration+[NoContext]+UpdateViaIdentityExpanded+$PATCH+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default?api-version=2023-09-01-preview+2": { + "Request": { + "Method": "PATCH", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default?api-version=2023-09-01-preview", + "Content": "{\r\n \"properties\": {\r\n \"autoDiscovery\": \"Disabled\",\r\n \"topLevelInventoryList\": [ \"dfdsdktests\" ]\r\n }\r\n}", + "isContentBase64": false, + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "110" ] + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Retry-After": [ "20" ], + "Set-Cookie": [ "ARRAffinity=1c6c7a0a18efcd0c1f62ff61ff05f8a61bfe22533cfce5122cfd179979045df0;Path=/;HttpOnly;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com", "ARRAffinitySameSite=1c6c7a0a18efcd0c1f62ff61ff05f8a61bfe22533cfce5122cfd179979045df0;Path=/;HttpOnly;SameSite=None;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1199" ], + "Request-Context": [ "appId=cid-v1:b8e19897-bfe4-49ad-ad76-b9526fa18eea" ], + "mise-correlation-id": [ "37044dbc-dc89-45d0-9006-8233889ad857" ], + "Azure-AsyncOperation": [ "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/operationResults/9bc80ced-f29c-48e1-be02-4309be376db9?api-version=2023-09-01-preview\u0026t=638434737319554106\u0026c=MIIHADCCBeigAwIBAgITfARmPsJdo2ShuN-ImAAABGY-wjANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDUwHhcNMjQwMTMxMjIwNzA5WhcNMjUwMTI1MjIwNzA5WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOVFiSMi9Sg6cKnrBuPHbDk_Zwa1ZNYHwLVPJArEI9N2bLrgd1mU0ZdNVcdf6rtZCkUUuCe3vxnVTGwufpwH9GPWDgJOpJoL9wgKOzUDiHLUeiWPjrK1AoaQVprZgjnzXBIWiZC2tZjbUT9pOI_ixYJJPrsCfLt7HEccnhObROE1mo_hpiPDrtOQDaX-BboNceB8vI1wmSPApGpPRM9hBRQbXgqKFC8094UNsMVkWPCrsPvP5YlMBLARlGf2WTevGKRREjstkApf1Swi7uKnpyhhsidD1yREMU0mWY9wnZfAX0jpEp3p9jKVMPQ3L-m-nSZI4zrtbW0AnI0O3pAEwe0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9DTzFQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA1LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MB0GA1UdDgQWBBT2vcy9ccvhGewsiHI1BQHsz3Wn8zAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBR61hmFKHlscXYeYPjzS--iBUIWHTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBADNBZjhX44bpBtC8kogZJGe4lYeHX95whfZ7X_CMSUuZRbQQ_b6raUpp8V8eF0YUa9b3Oa-DGrs5WfzogCuGcJPeoEVnDYzc1jlKubSIpGw73aGZzhbTjJeNf-Qe-5vTG-GcNzVtIcrwi93YSiK2LSbgrLpTL7T7znjePcGRRkCBjAslrV5SqufcsrpGmqvPAVKXRV-OIOzvXy6qmn9CHmdo0RGBXGIakbLMec_1SIS8NdPsB6i6XPjL2SDjqKTa5car7bVYlXEVsgL-000VF1t6x1II3VBNfsEJ81CdJyxaCJnwvWI6kHtCtJX9QYK3qZab9PfZRBvcetJoPdMFvBU\u0026s=NgwoMJGnEBmNHXOCesmkJR5OOmpd0oAQMixo177FE7lxVKjRNRH-aX70Yx-Z1EUiy6uLtrua8bUDDLZQBmdh8fxpFiXV5je64KXji9MKVm6Xc3jg4AwobLiyQjm1VTJ9Qst_iHi7RVr5SaZKey8h0h4419BHG75-473jdDxJBGwmonZa5jr-z2Ta6WPDRXi1QY1wTjz6CyzskXQS4Vq7CmpSeViESzryR3Mm3K1O_dAEaiLi9qUjKSjM9lqgAZYxiMy2yyC2ZSSD1wTlZepG6kBnEgSYDhctg47E49u8zdgFvgYdJbZ1n7-QUUv_frU-fGnxd5rISMqDhFco3Zhzig\u0026h=mJGr4ykwJcZp6NzjLNjCE195H0OQHI5fzz2PPjohC24" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-request-id": [ "5a75f2a4-2f67-4011-bcd9-309071f7e532" ], + "x-ms-correlation-request-id": [ "5a75f2a4-2f67-4011-bcd9-309071f7e532" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T021531Z:5a75f2a4-2f67-4011-bcd9-309071f7e532" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 41DDD162BCF444E0A6C78C7D920A003A Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:15:31Z" ], + "Date": [ "Wed, 14 Feb 2024 02:15:31 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "363" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"tags\":{},\"properties\":{\"autoDiscovery\":\"Disabled\",\"topLevelInventoryList\":[\"dfdsdktests\"],\"provisioningState\":\"Pending\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default\",\"name\":\"default\",\"type\":\"Microsoft.Security/securityConnectors/devops\"}", + "isContentBase64": false + } + }, + "Update-AzSecurityConnectorDevOpsConfiguration+[NoContext]+UpdateViaIdentityExpanded+$GET+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/operationResults/9bc80ced-f29c-48e1-be02-4309be376db9?api-version=2023-09-01-preview\u0026t=638434737319554106\u0026c=MIIHADCCBeigAwIBAgITfARmPsJdo2ShuN-ImAAABGY-wjANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDUwHhcNMjQwMTMxMjIwNzA5WhcNMjUwMTI1MjIwNzA5WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOVFiSMi9Sg6cKnrBuPHbDk_Zwa1ZNYHwLVPJArEI9N2bLrgd1mU0ZdNVcdf6rtZCkUUuCe3vxnVTGwufpwH9GPWDgJOpJoL9wgKOzUDiHLUeiWPjrK1AoaQVprZgjnzXBIWiZC2tZjbUT9pOI_ixYJJPrsCfLt7HEccnhObROE1mo_hpiPDrtOQDaX-BboNceB8vI1wmSPApGpPRM9hBRQbXgqKFC8094UNsMVkWPCrsPvP5YlMBLARlGf2WTevGKRREjstkApf1Swi7uKnpyhhsidD1yREMU0mWY9wnZfAX0jpEp3p9jKVMPQ3L-m-nSZI4zrtbW0AnI0O3pAEwe0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9DTzFQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA1LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MB0GA1UdDgQWBBT2vcy9ccvhGewsiHI1BQHsz3Wn8zAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBR61hmFKHlscXYeYPjzS--iBUIWHTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBADNBZjhX44bpBtC8kogZJGe4lYeHX95whfZ7X_CMSUuZRbQQ_b6raUpp8V8eF0YUa9b3Oa-DGrs5WfzogCuGcJPeoEVnDYzc1jlKubSIpGw73aGZzhbTjJeNf-Qe-5vTG-GcNzVtIcrwi93YSiK2LSbgrLpTL7T7znjePcGRRkCBjAslrV5SqufcsrpGmqvPAVKXRV-OIOzvXy6qmn9CHmdo0RGBXGIakbLMec_1SIS8NdPsB6i6XPjL2SDjqKTa5car7bVYlXEVsgL-000VF1t6x1II3VBNfsEJ81CdJyxaCJnwvWI6kHtCtJX9QYK3qZab9PfZRBvcetJoPdMFvBU\u0026s=NgwoMJGnEBmNHXOCesmkJR5OOmpd0oAQMixo177FE7lxVKjRNRH-aX70Yx-Z1EUiy6uLtrua8bUDDLZQBmdh8fxpFiXV5je64KXji9MKVm6Xc3jg4AwobLiyQjm1VTJ9Qst_iHi7RVr5SaZKey8h0h4419BHG75-473jdDxJBGwmonZa5jr-z2Ta6WPDRXi1QY1wTjz6CyzskXQS4Vq7CmpSeViESzryR3Mm3K1O_dAEaiLi9qUjKSjM9lqgAZYxiMy2yyC2ZSSD1wTlZepG6kBnEgSYDhctg47E49u8zdgFvgYdJbZ1n7-QUUv_frU-fGnxd5rISMqDhFco3Zhzig\u0026h=mJGr4ykwJcZp6NzjLNjCE195H0OQHI5fzz2PPjohC24+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/operationResults/9bc80ced-f29c-48e1-be02-4309be376db9?api-version=2023-09-01-preview\u0026t=638434737319554106\u0026c=MIIHADCCBeigAwIBAgITfARmPsJdo2ShuN-ImAAABGY-wjANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDUwHhcNMjQwMTMxMjIwNzA5WhcNMjUwMTI1MjIwNzA5WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOVFiSMi9Sg6cKnrBuPHbDk_Zwa1ZNYHwLVPJArEI9N2bLrgd1mU0ZdNVcdf6rtZCkUUuCe3vxnVTGwufpwH9GPWDgJOpJoL9wgKOzUDiHLUeiWPjrK1AoaQVprZgjnzXBIWiZC2tZjbUT9pOI_ixYJJPrsCfLt7HEccnhObROE1mo_hpiPDrtOQDaX-BboNceB8vI1wmSPApGpPRM9hBRQbXgqKFC8094UNsMVkWPCrsPvP5YlMBLARlGf2WTevGKRREjstkApf1Swi7uKnpyhhsidD1yREMU0mWY9wnZfAX0jpEp3p9jKVMPQ3L-m-nSZI4zrtbW0AnI0O3pAEwe0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9DTzFQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA1LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQ08xUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNS5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0NPMVBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3J0MB0GA1UdDgQWBBT2vcy9ccvhGewsiHI1BQHsz3Wn8zAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDUuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBR61hmFKHlscXYeYPjzS--iBUIWHTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBADNBZjhX44bpBtC8kogZJGe4lYeHX95whfZ7X_CMSUuZRbQQ_b6raUpp8V8eF0YUa9b3Oa-DGrs5WfzogCuGcJPeoEVnDYzc1jlKubSIpGw73aGZzhbTjJeNf-Qe-5vTG-GcNzVtIcrwi93YSiK2LSbgrLpTL7T7znjePcGRRkCBjAslrV5SqufcsrpGmqvPAVKXRV-OIOzvXy6qmn9CHmdo0RGBXGIakbLMec_1SIS8NdPsB6i6XPjL2SDjqKTa5car7bVYlXEVsgL-000VF1t6x1II3VBNfsEJ81CdJyxaCJnwvWI6kHtCtJX9QYK3qZab9PfZRBvcetJoPdMFvBU\u0026s=NgwoMJGnEBmNHXOCesmkJR5OOmpd0oAQMixo177FE7lxVKjRNRH-aX70Yx-Z1EUiy6uLtrua8bUDDLZQBmdh8fxpFiXV5je64KXji9MKVm6Xc3jg4AwobLiyQjm1VTJ9Qst_iHi7RVr5SaZKey8h0h4419BHG75-473jdDxJBGwmonZa5jr-z2Ta6WPDRXi1QY1wTjz6CyzskXQS4Vq7CmpSeViESzryR3Mm3K1O_dAEaiLi9qUjKSjM9lqgAZYxiMy2yyC2ZSSD1wTlZepG6kBnEgSYDhctg47E49u8zdgFvgYdJbZ1n7-QUUv_frU-fGnxd5rISMqDhFco3Zhzig\u0026h=mJGr4ykwJcZp6NzjLNjCE195H0OQHI5fzz2PPjohC24", + "Content": null, + "isContentBase64": false, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "93" ], + "x-ms-client-request-id": [ "f7c8a96b-ed20-437e-809d-280096033049" ], + "CommandName": [ "Update-AzSecurityConnectorDevOpsConfiguration" ], + "FullCommandName": [ "Update-AzSecurityConnectorDevOpsConfiguration_UpdateViaIdentityExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Retry-After": [ "20" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=14a5c7981ca45a6803ac375748e68dc9b495d4e56b3202b86256249c9784b400;Path=/;HttpOnly;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com", "ARRAffinitySameSite=14a5c7981ca45a6803ac375748e68dc9b495d4e56b3202b86256249c9784b400;Path=/;HttpOnly;SameSite=None;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "Request-Context": [ "appId=cid-v1:b8e19897-bfe4-49ad-ad76-b9526fa18eea" ], + "mise-correlation-id": [ "b3d2e6a6-fd7d-4b44-b636-5764ee6157eb" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-request-id": [ "bb31a217-9eef-4749-b223-fc7db9017abb" ], + "x-ms-correlation-request-id": [ "bb31a217-9eef-4749-b223-fc7db9017abb" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T021552Z:bb31a217-9eef-4749-b223-fc7db9017abb" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 93D3320C644E41B5B98BF9E26C4364C3 Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:15:52Z" ], + "Date": [ "Wed, 14 Feb 2024 02:15:52 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "374" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default/operationResults/9bc80ced-f29c-48e1-be02-4309be376db9\",\"name\":\"9bc80ced-f29c-48e1-be02-4309be376db9\",\"status\":\"Succeeded\",\"startTime\":\"2024-02-14T02:15:31.8311342Z\",\"endTime\":\"2024-02-14T02:15:33.744497Z\"}", + "isContentBase64": false + } + }, + "Update-AzSecurityConnectorDevOpsConfiguration+[NoContext]+UpdateViaIdentityExpanded+$GET+https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default?api-version=2023-09-01-preview+4": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default?api-version=2023-09-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "94" ], + "x-ms-client-request-id": [ "f7c8a96b-ed20-437e-809d-280096033049" ], + "CommandName": [ "Update-AzSecurityConnectorDevOpsConfiguration" ], + "FullCommandName": [ "Update-AzSecurityConnectorDevOpsConfiguration_UpdateViaIdentityExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v11.0.0", "PSVersion/v7.3.11", "Az.Security/1.5.1" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=14a5c7981ca45a6803ac375748e68dc9b495d4e56b3202b86256249c9784b400;Path=/;HttpOnly;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com", "ARRAffinitySameSite=14a5c7981ca45a6803ac375748e68dc9b495d4e56b3202b86256249c9784b400;Path=/;HttpOnly;SameSite=None;Secure;Domain=dfduserrp-centralus.dfd.security.azure.com" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11998" ], + "Request-Context": [ "appId=cid-v1:b8e19897-bfe4-49ad-ad76-b9526fa18eea" ], + "mise-correlation-id": [ "e3ccc4a0-a89b-4bb9-bfe9-dd75b70b7fcf" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-request-id": [ "65285a4d-2b25-4370-8144-8892351be7a0" ], + "x-ms-correlation-request-id": [ "65285a4d-2b25-4370-8144-8892351be7a0" ], + "x-ms-routing-request-id": [ "WESTUS2:20240214T021553Z:65285a4d-2b25-4370-8144-8892351be7a0" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 2A0154DDA6D64B628DD7C664E16907E4 Ref B: CO6AA3150220037 Ref C: 2024-02-14T02:15:53Z" ], + "Date": [ "Wed, 14 Feb 2024 02:15:52 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "408" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"centralus\",\"tags\":{},\"properties\":{\"autoDiscovery\":\"Disabled\",\"provisioningStatusMessage\":\"Resource creation successful.\",\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/dfdtest-sdk/providers/Microsoft.Security/securityConnectors/dfdsdktests-azdo-01/devops/default\",\"name\":\"default\",\"type\":\"Microsoft.Security/securityConnectors/devops\"}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/test/Update-AzSecurityConnectorDevOpsConfiguration.Tests.ps1 b/src/Security/Security.Autorest/test/Update-AzSecurityConnectorDevOpsConfiguration.Tests.ps1 new file mode 100644 index 000000000000..09d87670cb3e --- /dev/null +++ b/src/Security/Security.Autorest/test/Update-AzSecurityConnectorDevOpsConfiguration.Tests.ps1 @@ -0,0 +1,33 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Update-AzSecurityConnectorDevOpsConfiguration')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Update-AzSecurityConnectorDevOpsConfiguration.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Update-AzSecurityConnectorDevOpsConfiguration' { + It 'UpdateExpanded' { + $rg = $env.SecurityConnectorsResourceGroupName + $sid = $env.SubscriptionId + + $devops = Update-AzSecurityConnectorDevOpsConfiguration -SubscriptionId $sid -ResourceGroupName $rg -SecurityConnectorName "dfdsdktests-azdo-01" -AutoDiscovery Disabled -TopLevelInventoryList @("dfdsdktests") + $devops.AutoDiscovery | Should -Be "Disabled" + } + + It 'UpdateViaIdentityExpanded' { + $rg = $env.SecurityConnectorsResourceGroupName + $sid = $env.SubscriptionId + + $devops = Get-AzSecurityConnectorDevOpsConfiguration -SubscriptionId $sid -ResourceGroupName $rg -SecurityConnectorName "dfdsdktests-azdo-01" + Update-AzSecurityConnectorDevOpsConfiguration -InputObject $devops -AutoDiscovery Disabled -TopLevelInventoryList @("dfdsdktests") + } +} diff --git a/src/Security/Security.Autorest/test/env.json b/src/Security/Security.Autorest/test/env.json new file mode 100644 index 000000000000..7f59a9df2644 --- /dev/null +++ b/src/Security/Security.Autorest/test/env.json @@ -0,0 +1,6 @@ +{ + "SecurityConnectorsResourceGroupName": "dfdtest-sdk", + "SubscriptionId": "487bb485-b5b0-471e-9c0d-10717612f869", + "Tenant": "72f988bf-86f1-41af-91ab-2d7cd011db47", + "ApiCollectionsResourceGroupName": "apicollectionstests" +} diff --git a/src/Security/Security.Autorest/test/loadEnv.ps1 b/src/Security/Security.Autorest/test/loadEnv.ps1 new file mode 100644 index 000000000000..5f079e89615e --- /dev/null +++ b/src/Security/Security.Autorest/test/loadEnv.ps1 @@ -0,0 +1,29 @@ +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- +$envFile = 'env.json' +if ($TestMode -eq 'live') { + $envFile = 'localEnv.json' +} + +if (Test-Path -Path (Join-Path $PSScriptRoot $envFile)) { + $envFilePath = Join-Path $PSScriptRoot $envFile +} else { + $envFilePath = Join-Path $PSScriptRoot '..\$envFile' +} +$env = @{} +if (Test-Path -Path $envFilePath) { + $env = Get-Content (Join-Path $PSScriptRoot $envFile) | ConvertFrom-Json + $PSDefaultParameterValues=@{"*:SubscriptionId"=$env.SubscriptionId; "*:Tenant"=$env.Tenant} +} \ No newline at end of file diff --git a/src/Security/Security.Autorest/test/utils.ps1 b/src/Security/Security.Autorest/test/utils.ps1 new file mode 100644 index 000000000000..f8497fbd7da0 --- /dev/null +++ b/src/Security/Security.Autorest/test/utils.ps1 @@ -0,0 +1,56 @@ +function RandomString([bool]$allChars, [int32]$len) { + if ($allChars) { + return -join ((33..126) | Get-Random -Count $len | % {[char]$_}) + } else { + return -join ((48..57) + (97..122) | Get-Random -Count $len | % {[char]$_}) + } +} +function Start-TestSleep { + [CmdletBinding(DefaultParameterSetName = 'SleepBySeconds')] + param( + [parameter(Mandatory = $true, Position = 0, ParameterSetName = 'SleepBySeconds')] + [ValidateRange(0.0, 2147483.0)] + [double] $Seconds, + + [parameter(Mandatory = $true, ParameterSetName = 'SleepByMilliseconds')] + [ValidateRange('NonNegative')] + [Alias('ms')] + [int] $Milliseconds + ) + + if ($TestMode -ne 'playback') { + switch ($PSCmdlet.ParameterSetName) { + 'SleepBySeconds' { + Start-Sleep -Seconds $Seconds + } + 'SleepByMilliseconds' { + Start-Sleep -Milliseconds $Milliseconds + } + } + } +} + +$env = @{} +if ($UsePreviousConfigForRecord) { + $previousEnv = Get-Content (Join-Path $PSScriptRoot 'env.json') | ConvertFrom-Json + $previousEnv.psobject.properties | Foreach-Object { $env[$_.Name] = $_.Value } +} +# Add script method called AddWithCache to $env, when useCache is set true, it will try to get the value from the $env first. +# example: $val = $env.AddWithCache('key', $val, $true) +$env | Add-Member -Type ScriptMethod -Value { param( [string]$key, [object]$val, [bool]$useCache) if ($this.Contains($key) -and $useCache) { return $this[$key] } else { $this[$key] = $val; return $val } } -Name 'AddWithCache' +function setupEnv() { + # Preload subscriptionId and tenant from context, which will be used in test + # as default. You could change them if needed. + $env.SubscriptionId = (Get-AzContext).Subscription.Id + $env.Tenant = (Get-AzContext).Tenant.Id + # For any resources you created for test, you should add it to $env here. + $envFile = 'env.json' + if ($TestMode -eq 'live') { + $envFile = 'localEnv.json' + } + set-content -Path (Join-Path $PSScriptRoot $envFile) -Value (ConvertTo-Json $env) +} +function cleanupEnv() { + # Clean resources you create for testing +} + diff --git a/src/Security/Security.Autorest/utils/Unprotect-SecureString.ps1 b/src/Security/Security.Autorest/utils/Unprotect-SecureString.ps1 new file mode 100644 index 000000000000..cb05b51a6220 --- /dev/null +++ b/src/Security/Security.Autorest/utils/Unprotect-SecureString.ps1 @@ -0,0 +1,16 @@ +#This script converts securestring to plaintext + +param( + [Parameter(Mandatory, ValueFromPipeline)] + [System.Security.SecureString] + ${SecureString} +) + +$ssPtr = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($SecureString) +try { + $plaintext = [System.Runtime.InteropServices.Marshal]::PtrToStringBSTR($ssPtr) +} finally { + [System.Runtime.InteropServices.Marshal]::ZeroFreeBSTR($ssPtr) +} + +return $plaintext \ No newline at end of file diff --git a/src/Security/Security.sln b/src/Security/Security.sln index 41244b585c6c..8cba4b16b026 100644 --- a/src/Security/Security.sln +++ b/src/Security/Security.sln @@ -45,6 +45,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Security", "Security\Securi EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestFx", "..\..\tools\TestFx\TestFx.csproj", "{5CAAE885-B0C8-4951-869C-A982BE1B9204}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Az.Security", "Security.Autorest\Az.Security.csproj", "{8201B108-9493-402C-9B0F-78CD7C105E49}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -126,6 +128,10 @@ Global {5CAAE885-B0C8-4951-869C-A982BE1B9204}.Debug|Any CPU.Build.0 = Debug|Any CPU {5CAAE885-B0C8-4951-869C-A982BE1B9204}.Release|Any CPU.ActiveCfg = Release|Any CPU {5CAAE885-B0C8-4951-869C-A982BE1B9204}.Release|Any CPU.Build.0 = Release|Any CPU + {8201B108-9493-402C-9B0F-78CD7C105E49}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8201B108-9493-402C-9B0F-78CD7C105E49}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8201B108-9493-402C-9B0F-78CD7C105E49}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8201B108-9493-402C-9B0F-78CD7C105E49}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(NestedProjects) = preSolution {5C3BCAE2-2337-45E5-83D8-872FD589C773} = {CFA0BCE7-FC56-4150-9366-4B530A8E3DD6} diff --git a/src/Security/Security/Az.Security.psd1 b/src/Security/Security/Az.Security.psd1 index 3ee6fd5f02a6..618718e5bbfd 100644 --- a/src/Security/Security/Az.Security.psd1 +++ b/src/Security/Security/Az.Security.psd1 @@ -3,193 +3,233 @@ # # Generated by: Microsoft Corporation # -# Generated on: 12/5/2023 +# Generated on: 2/27/2024 # @{ -# Script module or binary module file associated with this manifest. -# RootModule = '' - -# Version number of this module. -ModuleVersion = '1.5.1' - -# Supported PSEditions -CompatiblePSEditions = 'Core', 'Desktop' - -# ID used to uniquely identify this module -GUID = '2b6bac56-a03a-4606-8b05-c1a1f36248db' - -# Author of this module -Author = 'Microsoft Corporation' - -# Company or vendor of this module -CompanyName = 'Microsoft Corporation' - -# Copyright statement for this module -Copyright = 'Microsoft Corporation. All rights reserved.' - -# Description of the functionality provided by this module -Description = 'Microsoft Azure PowerShell - Azure Security Center cmdlets in Windows PowerShell and PowerShell Core. Allows managing and monitoring the security posture of your resources. - -For more information on Security Center, please visit the following: https://learn.microsoft.com/azure/security-center' - -# Minimum version of the PowerShell engine required by this module -PowerShellVersion = '5.1' - -# Name of the PowerShell host required by this module -# PowerShellHostName = '' - -# Minimum version of the PowerShell host required by this module -# PowerShellHostVersion = '' - -# Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only. -DotNetFrameworkVersion = '4.7.2' - -# Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only. -# ClrVersion = '' - -# Processor architecture (None, X86, Amd64) required by this module -# ProcessorArchitecture = '' - -# Modules that must be imported into the global environment prior to importing this module -RequiredModules = @(@{ModuleName = 'Az.Accounts'; ModuleVersion = '2.13.2'; }) - -# Assemblies that must be loaded prior to importing this module -RequiredAssemblies = 'Microsoft.Azure.PowerShell.Security.Management.Sdk.dll' - -# Script files (.ps1) that are run in the caller's environment prior to importing this module. -ScriptsToProcess = @() - -# Type files (.ps1xml) to be loaded when importing this module -TypesToProcess = @() - -# Format files (.ps1xml) to be loaded when importing this module -FormatsToProcess = @() - -# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess -NestedModules = @('Microsoft.Azure.PowerShell.Cmdlets.Security.dll') - -# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export. -FunctionsToExport = @() - -# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export. -CmdletsToExport = 'Add-AzSecurityAdaptiveNetworkHardening', - 'Add-AzSecuritySqlVulnerabilityAssessmentBaseline', - 'Confirm-AzSecurityAutomation', - 'Disable-AzIotSecurityAnalyticsAggregatedAlert', - 'Disable-AzSecurityAdvancedThreatProtection', - 'Enable-AzSecurityAdvancedThreatProtection', - 'Get-AzAlertsSuppressionRule', 'Get-AzAllowedConnection', - 'Get-AzDeviceSecurityGroup', 'Get-AzDiscoveredSecuritySolution', - 'Get-AzExternalSecuritySolution', 'Get-AzIotSecurityAnalytics', - 'Get-AzIotSecurityAnalyticsAggregatedAlert', - 'Get-AzIotSecurityAnalyticsAggregatedRecommendation', - 'Get-AzIotSecuritySolution', 'Get-AzJitNetworkAccessPolicy', - 'Get-AzRegulatoryComplianceAssessment', - 'Get-AzRegulatoryComplianceControl', - 'Get-AzRegulatoryComplianceStandard', - 'Get-AzSecurityAdaptiveApplicationControl', - 'Get-AzSecurityAdaptiveApplicationControlGroup', - 'Get-AzSecurityAdaptiveNetworkHardening', - 'Get-AzSecurityAdvancedThreatProtection', 'Get-AzSecurityAlert', - 'Get-AzSecurityAssessment', 'Get-AzSecurityAssessmentMetadata', - 'Get-AzSecurityAutomation', 'Get-AzSecurityAutoProvisioningSetting', - 'Get-AzSecurityCompliance', 'Get-AzSecurityContact', - 'Get-AzSecurityLocation', 'Get-AzSecurityPricing', - 'Get-AzSecuritySecureScore', 'Get-AzSecuritySecureScoreControl', - 'Get-AzSecuritySecureScoreControlDefinition', - 'Get-AzSecuritySetting', 'Get-AzSecuritySolution', - 'Get-AzSecuritySolutionsReferenceData', - 'Get-AzSecuritySqlVulnerabilityAssessmentBaseline', - 'Get-AzSecuritySqlVulnerabilityAssessmentScanRecord', - 'Get-AzSecuritySqlVulnerabilityAssessmentScanResult', - 'Get-AzSecuritySubAssessment', 'Get-AzSecurityTask', - 'Get-AzSecurityTopology', 'Get-AzSecurityWorkspaceSetting', - 'Get-AzSqlInformationProtectionPolicy', - 'New-AzAlertsSuppressionRuleScope', - 'New-AzDeviceSecurityGroupAllowlistCustomAlertRuleObject', - 'New-AzDeviceSecurityGroupDenylistCustomAlertRuleObject', - 'New-AzDeviceSecurityGroupThresholdCustomAlertRuleObject', - 'New-AzDeviceSecurityGroupTimeWindowRuleObject', - 'New-AzIotSecuritySolutionRecommendationConfigurationObject', - 'New-AzIotSecuritySolutionUserDefinedResourcesObject', - 'New-AzSecurityAutomation', 'New-AzSecurityAutomationActionObject', - 'New-AzSecurityAutomationRuleObject', - 'New-AzSecurityAutomationRuleSetObject', - 'New-AzSecurityAutomationScopeObject', - 'New-AzSecurityAutomationSourceObject', - 'Remove-AzAlertsSuppressionRule', 'Remove-AzDeviceSecurityGroup', - 'Remove-AzIotSecuritySolution', 'Remove-AzJitNetworkAccessPolicy', - 'Remove-AzSecurityAssessment', - 'Remove-AzSecurityAssessmentMetadata', - 'Remove-AzSecurityAutomation', 'Remove-AzSecurityContact', - 'Remove-AzSecuritySqlVulnerabilityAssessmentBaseline', - 'Remove-AzSecurityWorkspaceSetting', 'Set-AzAlertsSuppressionRule', - 'Set-AzDeviceSecurityGroup', 'Set-AzIotSecuritySolution', - 'Set-AzJitNetworkAccessPolicy', 'Set-AzSecurityAlert', - 'Set-AzSecurityAssessment', 'Set-AzSecurityAssessmentMetadata', - 'Set-AzSecurityAutoProvisioningSetting', 'Set-AzSecurityContact', - 'Set-AzSecurityPricing', 'Set-AzSecuritySetting', - 'Set-AzSecuritySqlVulnerabilityAssessmentBaseline', - 'Set-AzSecurityWorkspaceSetting', - 'Set-AzSqlInformationProtectionPolicy', - 'Start-AzJitNetworkAccessPolicy', 'Update-AzIotSecuritySolution' - -# Variables to export from this module -# VariablesToExport = @() - -# Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export. -AliasesToExport = 'Get-AzRegulatoryComplainceAssessment', 'Set-AzSecurityAutomation' - -# DSC resources to export from this module -# DscResourcesToExport = @() - -# List of all modules packaged with this module -# ModuleList = @() - -# List of all files packaged with this module -# FileList = @() - -# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. -PrivateData = @{ - - PSData = @{ - - # Tags applied to this module. These help with module discovery in online galleries. - Tags = 'Azure', 'ResourceManager', 'ARM', 'Provider', 'Security', 'ASC', - 'SecurityCenter', 'AzureSecurityCenter' - - # A URL to the license for this module. - LicenseUri = 'https://aka.ms/azps-license' - - # A URL to the main website for this project. - ProjectUri = 'https://github.com/Azure/azure-powershell' - - # A URL to an icon representing this module. - # IconUri = '' - - # ReleaseNotes of this module - ReleaseNotes = '* Fixed bug for ''Set-AzSecurityPricing''' - - # Prerelease string of this module - # Prerelease = '' - - # Flag to indicate whether the module requires explicit user acceptance for install/update/save - # RequireLicenseAcceptance = $false - - # External dependent modules of this module - # ExternalModuleDependencies = @() - - } # End of PSData hashtable - -} # End of PrivateData hashtable - -# HelpInfo URI of this module -# HelpInfoURI = '' - -# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix. -# DefaultCommandPrefix = '' - + # Script module or binary module file associated with this manifest. + # RootModule = '' + + # Version number of this module. + ModuleVersion = '1.5.1' + + # Supported PSEditions + CompatiblePSEditions = 'Core', 'Desktop' + + # ID used to uniquely identify this module + GUID = '2b6bac56-a03a-4606-8b05-c1a1f36248db' + + # Author of this module + Author = 'Microsoft Corporation' + + # Company or vendor of this module + CompanyName = 'Microsoft Corporation' + + # Copyright statement for this module + Copyright = 'Microsoft Corporation. All rights reserved.' + + # Description of the functionality provided by this module + Description = 'Microsoft Azure PowerShell - Azure Security Center cmdlets in Windows PowerShell and PowerShell Core. Allows managing and monitoring the security posture of your resources. + + For more information on Security Center, please visit the following: https://learn.microsoft.com/azure/security-center' + + # Minimum version of the Windows PowerShell engine required by this module + PowerShellVersion = '5.1' + + # Name of the Windows PowerShell host required by this module + # PowerShellHostName = '' + + # Minimum version of the Windows PowerShell host required by this module + # PowerShellHostVersion = '' + + # Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only. + DotNetFrameworkVersion = '4.7.2' + + # Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only. + # CLRVersion = '' + + # Processor architecture (None, X86, Amd64) required by this module + # ProcessorArchitecture = '' + + # Modules that must be imported into the global environment prior to importing this module + RequiredModules = @(@{ModuleName = 'Az.Accounts'; ModuleVersion = '2.15.1'; }) + + # Assemblies that must be loaded prior to importing this module + RequiredAssemblies = 'Microsoft.Azure.PowerShell.Security.Management.Sdk.dll', + 'Security.Autorest/bin/Az.Security.private.dll' + + # Script files (.ps1) that are run in the caller's environment prior to importing this module. + ScriptsToProcess = @() + + # Type files (.ps1xml) to be loaded when importing this module + TypesToProcess = @() + + # Format files (.ps1xml) to be loaded when importing this module + FormatsToProcess = 'Security.Autorest/Az.Security.format.ps1xml' + + # Modules to import as nested modules of the module specified in RootModule/ModuleToProcess + NestedModules = @('Microsoft.Azure.PowerShell.Cmdlets.Security.dll', + 'Security.Autorest/Az.Security.psm1') + + # Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export. + FunctionsToExport = 'Get-AzSecurityApiCollection', 'Get-AzSecurityConnector', + 'Get-AzSecurityConnectorAzureDevOpsOrg', + 'Get-AzSecurityConnectorAzureDevOpsOrgAvailable', + 'Get-AzSecurityConnectorAzureDevOpsProject', + 'Get-AzSecurityConnectorAzureDevOpsRepo', + 'Get-AzSecurityConnectorDevOpsConfiguration', + 'Get-AzSecurityConnectorGitHubOwner', + 'Get-AzSecurityConnectorGitHubOwnerAvailable', + 'Get-AzSecurityConnectorGitHubRepo', + 'Get-AzSecurityConnectorGitLabGroup', + 'Get-AzSecurityConnectorGitLabGroupAvailable', + 'Get-AzSecurityConnectorGitLabProject', + 'Get-AzSecurityConnectorGitLabSubgroup', + 'Invoke-AzSecurityApiCollectionApimOffboard', + 'Invoke-AzSecurityApiCollectionApimOnboard', + 'New-AzSecurityAwsEnvironmentObject', + 'New-AzSecurityAwsOrganizationalDataMasterObject', + 'New-AzSecurityAwsOrganizationalDataMemberObject', + 'New-AzSecurityAzureDevOpsScopeEnvironmentObject', + 'New-AzSecurityConnector', + 'New-AzSecurityConnectorActionableRemediationObject', + 'New-AzSecurityConnectorDevOpsConfiguration', + 'New-AzSecurityCspmMonitorAwsOfferingObject', + 'New-AzSecurityCspmMonitorAzureDevOpsOfferingObject', + 'New-AzSecurityCspmMonitorGcpOfferingObject', + 'New-AzSecurityCspmMonitorGithubOfferingObject', + 'New-AzSecurityCspmMonitorGitLabOfferingObject', + 'New-AzSecurityDefenderCspmAwsOfferingObject', + 'New-AzSecurityDefenderCspmGcpOfferingObject', + 'New-AzSecurityDefenderForContainersAwsOfferingObject', + 'New-AzSecurityDefenderForContainersGcpOfferingObject', + 'New-AzSecurityDefenderForDatabasesAwsOfferingObject', + 'New-AzSecurityDefenderForDatabasesGcpOfferingObject', + 'New-AzSecurityDefenderForServersAwsOfferingObject', + 'New-AzSecurityDefenderForServersGcpOfferingObject', + 'New-AzSecurityGcpOrganizationalDataMemberObject', + 'New-AzSecurityGcpOrganizationalDataOrganizationObject', + 'New-AzSecurityGcpProjectEnvironmentObject', + 'New-AzSecurityGitHubScopeEnvironmentObject', + 'New-AzSecurityGitLabScopeEnvironmentObject', + 'New-AzSecurityInformationProtectionAwsOfferingObject', + 'Remove-AzSecurityConnector', + 'Remove-AzSecurityConnectorDevOpsConfiguration', + 'Update-AzSecurityConnector', + 'Update-AzSecurityConnectorAzureDevOpsOrg', + 'Update-AzSecurityConnectorAzureDevOpsProject', + 'Update-AzSecurityConnectorAzureDevOpsRepo', + 'Update-AzSecurityConnectorDevOpsConfiguration' + + # Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export. + CmdletsToExport = 'Add-AzSecurityAdaptiveNetworkHardening', + 'Add-AzSecuritySqlVulnerabilityAssessmentBaseline', + 'Confirm-AzSecurityAutomation', + 'Disable-AzIotSecurityAnalyticsAggregatedAlert', + 'Disable-AzSecurityAdvancedThreatProtection', + 'Enable-AzSecurityAdvancedThreatProtection', + 'Get-AzAlertsSuppressionRule', 'Get-AzAllowedConnection', + 'Get-AzDeviceSecurityGroup', 'Get-AzDiscoveredSecuritySolution', + 'Get-AzExternalSecuritySolution', 'Get-AzIotSecurityAnalytics', + 'Get-AzIotSecurityAnalyticsAggregatedAlert', + 'Get-AzIotSecurityAnalyticsAggregatedRecommendation', + 'Get-AzIotSecuritySolution', 'Get-AzJitNetworkAccessPolicy', + 'Get-AzRegulatoryComplianceAssessment', + 'Get-AzRegulatoryComplianceControl', + 'Get-AzRegulatoryComplianceStandard', + 'Get-AzSecurityAdaptiveApplicationControl', + 'Get-AzSecurityAdaptiveApplicationControlGroup', + 'Get-AzSecurityAdaptiveNetworkHardening', + 'Get-AzSecurityAdvancedThreatProtection', 'Get-AzSecurityAlert', + 'Get-AzSecurityAssessment', 'Get-AzSecurityAssessmentMetadata', + 'Get-AzSecurityAutomation', 'Get-AzSecurityAutoProvisioningSetting', + 'Get-AzSecurityCompliance', 'Get-AzSecurityContact', + 'Get-AzSecurityLocation', 'Get-AzSecurityPricing', + 'Get-AzSecuritySecureScore', 'Get-AzSecuritySecureScoreControl', + 'Get-AzSecuritySecureScoreControlDefinition', + 'Get-AzSecuritySetting', 'Get-AzSecuritySolution', + 'Get-AzSecuritySolutionsReferenceData', + 'Get-AzSecuritySqlVulnerabilityAssessmentBaseline', + 'Get-AzSecuritySqlVulnerabilityAssessmentScanRecord', + 'Get-AzSecuritySqlVulnerabilityAssessmentScanResult', + 'Get-AzSecuritySubAssessment', 'Get-AzSecurityTask', + 'Get-AzSecurityTopology', 'Get-AzSecurityWorkspaceSetting', + 'Get-AzSqlInformationProtectionPolicy', + 'New-AzAlertsSuppressionRuleScope', + 'New-AzDeviceSecurityGroupAllowlistCustomAlertRuleObject', + 'New-AzDeviceSecurityGroupDenylistCustomAlertRuleObject', + 'New-AzDeviceSecurityGroupThresholdCustomAlertRuleObject', + 'New-AzDeviceSecurityGroupTimeWindowRuleObject', + 'New-AzIotSecuritySolutionRecommendationConfigurationObject', + 'New-AzIotSecuritySolutionUserDefinedResourcesObject', + 'New-AzSecurityAutomation', 'New-AzSecurityAutomationActionObject', + 'New-AzSecurityAutomationRuleObject', + 'New-AzSecurityAutomationRuleSetObject', + 'New-AzSecurityAutomationScopeObject', + 'New-AzSecurityAutomationSourceObject', + 'Remove-AzAlertsSuppressionRule', 'Remove-AzDeviceSecurityGroup', + 'Remove-AzIotSecuritySolution', 'Remove-AzJitNetworkAccessPolicy', + 'Remove-AzSecurityAssessment', + 'Remove-AzSecurityAssessmentMetadata', + 'Remove-AzSecurityAutomation', 'Remove-AzSecurityContact', + 'Remove-AzSecuritySqlVulnerabilityAssessmentBaseline', + 'Remove-AzSecurityWorkspaceSetting', 'Set-AzAlertsSuppressionRule', + 'Set-AzDeviceSecurityGroup', 'Set-AzIotSecuritySolution', + 'Set-AzJitNetworkAccessPolicy', 'Set-AzSecurityAlert', + 'Set-AzSecurityAssessment', 'Set-AzSecurityAssessmentMetadata', + 'Set-AzSecurityAutoProvisioningSetting', 'Set-AzSecurityContact', + 'Set-AzSecurityPricing', 'Set-AzSecuritySetting', + 'Set-AzSecuritySqlVulnerabilityAssessmentBaseline', + 'Set-AzSecurityWorkspaceSetting', + 'Set-AzSqlInformationProtectionPolicy', + 'Start-AzJitNetworkAccessPolicy', 'Update-AzIotSecuritySolution' + + # Variables to export from this module + # VariablesToExport = @() + + # Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export. + AliasesToExport = 'Get-AzRegulatoryComplainceAssessment', 'Set-AzSecurityAutomation' + + # DSC resources to export from this module + # DscResourcesToExport = @() + + # List of all modules packaged with this module + # ModuleList = @() + + # List of all files packaged with this module + # FileList = @() + + # Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. + PrivateData = @{ + + PSData = @{ + + # Tags applied to this module. These help with module discovery in online galleries. + Tags = 'Azure', 'ResourceManager', 'ARM', 'Provider', 'Security', 'ASC', + 'SecurityCenter', 'AzureSecurityCenter' + + # A URL to the license for this module. + LicenseUri = 'https://aka.ms/azps-license' + + # A URL to the main website for this project. + ProjectUri = 'https://github.com/Azure/azure-powershell' + + # A URL to an icon representing this module. + # IconUri = '' + + # ReleaseNotes of this module + ReleaseNotes = '* Fixed bug for ''Set-AzSecurityPricing''' + + } # End of PSData hashtable + + } # End of PrivateData hashtable + + # HelpInfo URI of this module + # HelpInfoURI = '' + + # Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix. + # DefaultCommandPrefix = '' + } - + \ No newline at end of file diff --git a/src/Security/Security/help/Az.Security.md b/src/Security/Security/help/Az.Security.md index 05f1483a717b..30965319d553 100644 --- a/src/Security/Security/help/Az.Security.md +++ b/src/Security/Security/help/Az.Security.md @@ -90,7 +90,7 @@ Gets security assessments and their results on a subscription Gets security assessments types and metadta in a subscription. ### [Get-AzSecurityAutomation](Get-AzSecurityAutomation.md) -Gets security automation(s) +Gets security automations ### [Get-AzSecurityAutoProvisioningSetting](Get-AzSecurityAutoProvisioningSetting.md) Gets the security automatic provisioning settings @@ -119,6 +119,12 @@ Gets security secure score control definitions on a subscription ### [Get-AzSecuritySetting](Get-AzSecuritySetting.md) Get security settings in Azure Security Center +### [Get-AzSecuritySolution](Get-AzSecuritySolution.md) +Get Security Solutions + +### [Get-AzSecuritySolutionsReferenceData](Get-AzSecuritySolutionsReferenceData.md) +Get Security Solutions Reference Data + ### [Get-AzSecuritySqlVulnerabilityAssessmentBaseline](Get-AzSecuritySqlVulnerabilityAssessmentBaseline.md) Get SQL vulnerability assessment baseline. @@ -164,9 +170,6 @@ Create new recommendation configuration for iot security solution ### [New-AzIotSecuritySolutionUserDefinedResourcesObject](New-AzIotSecuritySolutionUserDefinedResourcesObject.md) Create new user defined resources for iot security solution -### [Remove-AzAlertsSuppressionRule](Remove-AzAlertsSuppressionRule.md) -Deletes an alerts suppression rule. - ### [New-AzSecurityAutomation](New-AzSecurityAutomation.md) Creates new security automation @@ -174,16 +177,19 @@ Creates new security automation Creates new security automation action object ### [New-AzSecurityAutomationRuleObject](New-AzSecurityAutomationRuleObject.md) -Creates new security automation rule object +Creates security automation rule object ### [New-AzSecurityAutomationRuleSetObject](New-AzSecurityAutomationRuleSetObject.md) -Creates new security automation rule set object +Creates security automation rule set object ### [New-AzSecurityAutomationScopeObject](New-AzSecurityAutomationScopeObject.md) -Creates new security automation scope object +Creates security automation scope object ### [New-AzSecurityAutomationSourceObject](New-AzSecurityAutomationSourceObject.md) -Creates new security automation source object +Creates security automation source object + +### [Remove-AzAlertsSuppressionRule](Remove-AzAlertsSuppressionRule.md) +Deletes an alerts suppression rule. ### [Remove-AzDeviceSecurityGroup](Remove-AzDeviceSecurityGroup.md) Delete device security group @@ -233,9 +239,6 @@ Create or update a security assessment result on a resource ### [Set-AzSecurityAssessmentMetadata](Set-AzSecurityAssessmentMetadata.md) Creates or updates a security assessment type. -### [Set-AzSecurityAutomation](Set-AzSecurityAutomation.md) -Creates or updates a security automation. If a security automation is already created and a subsequent request is issued for the same automation id, then it will be updated. - ### [Set-AzSecurityAutoProvisioningSetting](Set-AzSecurityAutoProvisioningSetting.md) Updates automatic provisioning setting @@ -243,7 +246,10 @@ Updates automatic provisioning setting Updates a security contact for a subscription. ### [Set-AzSecurityPricing](Set-AzSecurityPricing.md) -Enables or disables Azure Defender plans for a subscription in Azure Security Center. +Enables or disables Microsoft Defender plans for a subscription in Microsoft Defender for Cloud. + +> [!NOTE] +> For CloudPosture (Defender Cloud Security Posture Management), [the agentless extensions](https://techcommunity.microsoft.com/t5/microsoft-defender-for-cloud/enhanced-cloud-security-value-added-with-defender-cspm-s/ba-p/3880746) will not be enabled when using this command. To enable extensions, please use the Azure Policy definition or scripts in the [Microsoft Defender for Cloud Community Repository](https://github.com/Azure/Microsoft-Defender-for-Cloud/tree/main/Policy/Configure-DCSPM-Extensions). ### [Set-AzSecuritySetting](Set-AzSecuritySetting.md) Update a security setting in Azure Security Center diff --git a/src/Security/Security/help/Get-AzSecurityApiCollection.md b/src/Security/Security/help/Get-AzSecurityApiCollection.md new file mode 100644 index 000000000000..e091ff2c71d3 --- /dev/null +++ b/src/Security/Security/help/Get-AzSecurityApiCollection.md @@ -0,0 +1,197 @@ +--- +external help file: Az.Security-help.xml +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/az.security/get-azsecurityapicollection +schema: 2.0.0 +--- + +# Get-AzSecurityApiCollection + +## SYNOPSIS +Gets an Azure API Management API if it has been onboarded to Microsoft Defender for APIs. +If an Azure API Management API is onboarded to Microsoft Defender for APIs, the system will monitor the operations within the Azure API Management API for intrusive behaviors and provide alerts for attacks that have been detected. + +## SYNTAX + +### List (Default) +``` +Get-AzSecurityApiCollection [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzSecurityApiCollection -ApiId -ResourceGroupName -ServiceName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### List2 +``` +Get-AzSecurityApiCollection -ResourceGroupName -ServiceName [-SubscriptionId ] + [-DefaultProfile ] [] +``` + +### List1 +``` +Get-AzSecurityApiCollection -ResourceGroupName [-SubscriptionId ] + [-DefaultProfile ] [] +``` + +### GetViaIdentity +``` +Get-AzSecurityApiCollection -InputObject [-DefaultProfile ] [] +``` + +## DESCRIPTION +Gets an Azure API Management API if it has been onboarded to Microsoft Defender for APIs. +If an Azure API Management API is onboarded to Microsoft Defender for APIs, the system will monitor the operations within the Azure API Management API for intrusive behaviors and provide alerts for attacks that have been detected. + +## EXAMPLES + +### EXAMPLE 1 +``` +Get-AzSecurityApiCollection -ResourceGroupName apicollectionstests -ServiceName "demoapimservice2" -ApiId "echo-api" +``` + +### EXAMPLE 2 +``` +Get-AzSecurityApiCollection -ResourceGroupName "apicollectionstests" -ServiceName "demoapimservice2" +``` + +### EXAMPLE 3 +``` +Get-AzSecurityApiCollection +``` + +## PARAMETERS + +### -ApiId +API revision identifier. +Must be unique in the API Management service instance. +Non-current revision has ;rev=n as a suffix where n is the revision number. + +```yaml +Type: String +Parameter Sets: Get +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +. + +```yaml +Type: ISecurityIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: String +Parameter Sets: Get, List2, List1 +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ServiceName +The name of the API Management service. + +```yaml +Type: String +Parameter Sets: Get, List2 +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure subscription ID + +```yaml +Type: String[] +Parameter Sets: List, Get, List2, List1 +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollection +## NOTES +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. +For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT \: Identity Parameter + \[ApiId \\]: API revision identifier. +Must be unique in the API Management service instance. +Non-current revision has ;rev=n as a suffix where n is the revision number. + \[GroupFqName \\]: The GitLab group fully-qualified name. + \[Id \\]: Resource identity path + \[OperationResultId \\]: The operation result Id. + \[OrgName \\]: The Azure DevOps organization name. + \[OwnerName \\]: The GitHub owner name. + \[ProjectName \\]: The project name. + \[RepoName \\]: The repository name. + \[ResourceGroupName \\]: The name of the resource group within the user's subscription. +The name is case insensitive. + \[SecurityConnectorName \\]: The security connector name. + \[ServiceName \\]: The name of the API Management service. + \[SubscriptionId \\]: Azure subscription ID + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/az.security/get-azsecurityapicollection](https://learn.microsoft.com/powershell/module/az.security/get-azsecurityapicollection) + diff --git a/src/Security/Security/help/Get-AzSecurityConnector.md b/src/Security/Security/help/Get-AzSecurityConnector.md new file mode 100644 index 000000000000..42f145a762ef --- /dev/null +++ b/src/Security/Security/help/Get-AzSecurityConnector.md @@ -0,0 +1,167 @@ +--- +external help file: Az.Security-help.xml +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnector +schema: 2.0.0 +--- + +# Get-AzSecurityConnector + +## SYNOPSIS +Retrieves details of a specific security connector + +## SYNTAX + +### List (Default) +``` +Get-AzSecurityConnector [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzSecurityConnector -Name -ResourceGroupName [-SubscriptionId ] + [-DefaultProfile ] [] +``` + +### List1 +``` +Get-AzSecurityConnector -ResourceGroupName [-SubscriptionId ] [-DefaultProfile ] + [] +``` + +### GetViaIdentity +``` +Get-AzSecurityConnector -InputObject [-DefaultProfile ] [] +``` + +## DESCRIPTION +Retrieves details of a specific security connector + +## EXAMPLES + +### EXAMPLE 1 +``` +Get-AzSecurityConnector -ResourceGroupName "dfdtest-sdk" -Name "dfdsdktests-azdo-01" +``` + +### EXAMPLE 2 +``` +Get-AzSecurityConnector +``` + +## PARAMETERS + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +. + +```yaml +Type: ISecurityIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Name +The security connector name. + +```yaml +Type: String +Parameter Sets: Get +Aliases: SecurityConnectorName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group within the user's subscription. +The name is case insensitive. + +```yaml +Type: String +Parameter Sets: Get, List1 +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure subscription ID + +```yaml +Type: String[] +Parameter Sets: List, Get, List1 +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnector +## NOTES +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. +For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT \: Identity Parameter + \[ApiId \\]: API revision identifier. +Must be unique in the API Management service instance. +Non-current revision has ;rev=n as a suffix where n is the revision number. + \[GroupFqName \\]: The GitLab group fully-qualified name. + \[Id \\]: Resource identity path + \[OperationResultId \\]: The operation result Id. + \[OrgName \\]: The Azure DevOps organization name. + \[OwnerName \\]: The GitHub owner name. + \[ProjectName \\]: The project name. + \[RepoName \\]: The repository name. + \[ResourceGroupName \\]: The name of the resource group within the user's subscription. +The name is case insensitive. + \[SecurityConnectorName \\]: The security connector name. + \[ServiceName \\]: The name of the API Management service. + \[SubscriptionId \\]: Azure subscription ID + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnector](https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnector) + diff --git a/src/Security/Security/help/Get-AzSecurityConnectorAzureDevOpsOrg.md b/src/Security/Security/help/Get-AzSecurityConnectorAzureDevOpsOrg.md new file mode 100644 index 000000000000..743e7fade9c8 --- /dev/null +++ b/src/Security/Security/help/Get-AzSecurityConnectorAzureDevOpsOrg.md @@ -0,0 +1,178 @@ +--- +external help file: Az.Security-help.xml +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorazuredevopsorg +schema: 2.0.0 +--- + +# Get-AzSecurityConnectorAzureDevOpsOrg + +## SYNOPSIS +Returns a monitored Azure DevOps organization resource. + +## SYNTAX + +### List (Default) +``` +Get-AzSecurityConnectorAzureDevOpsOrg -ResourceGroupName -SecurityConnectorName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzSecurityConnectorAzureDevOpsOrg -OrgName -ResourceGroupName + -SecurityConnectorName [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### GetViaIdentity +``` +Get-AzSecurityConnectorAzureDevOpsOrg -InputObject [-DefaultProfile ] + [] +``` + +## DESCRIPTION +Returns a monitored Azure DevOps organization resource. + +## EXAMPLES + +### EXAMPLE 1 +``` +Get-AzSecurityConnectorAzureDevOpsOrg -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-azdo-01 -OrgName dfdsdktests +``` + +### EXAMPLE 2 +``` +Get-AzSecurityConnectorAzureDevOpsOrg -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-azdo-01 +``` + +## PARAMETERS + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +. + +```yaml +Type: ISecurityIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -OrgName +The Azure DevOps organization name. + +```yaml +Type: String +Parameter Sets: Get +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: String +Parameter Sets: List, Get +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SecurityConnectorName +The security connector name. + +```yaml +Type: String +Parameter Sets: List, Get +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure subscription ID + +```yaml +Type: String[] +Parameter Sets: List, Get +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrg +## NOTES +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. +For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT \: Identity Parameter + \[ApiId \\]: API revision identifier. +Must be unique in the API Management service instance. +Non-current revision has ;rev=n as a suffix where n is the revision number. + \[GroupFqName \\]: The GitLab group fully-qualified name. + \[Id \\]: Resource identity path + \[OperationResultId \\]: The operation result Id. + \[OrgName \\]: The Azure DevOps organization name. + \[OwnerName \\]: The GitHub owner name. + \[ProjectName \\]: The project name. + \[RepoName \\]: The repository name. + \[ResourceGroupName \\]: The name of the resource group within the user's subscription. +The name is case insensitive. + \[SecurityConnectorName \\]: The security connector name. + \[ServiceName \\]: The name of the API Management service. + \[SubscriptionId \\]: Azure subscription ID + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorazuredevopsorg](https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorazuredevopsorg) + diff --git a/src/Security/Security/help/Get-AzSecurityConnectorAzureDevOpsOrgAvailable.md b/src/Security/Security/help/Get-AzSecurityConnectorAzureDevOpsOrgAvailable.md new file mode 100644 index 000000000000..ae28f1f01012 --- /dev/null +++ b/src/Security/Security/help/Get-AzSecurityConnectorAzureDevOpsOrgAvailable.md @@ -0,0 +1,138 @@ +--- +external help file: Az.Security-help.xml +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorazuredevopsorgavailable +schema: 2.0.0 +--- + +# Get-AzSecurityConnectorAzureDevOpsOrgAvailable + +## SYNOPSIS +Returns a list of all Azure DevOps organizations accessible by the user token consumed by the connector. + +## SYNTAX + +``` +Get-AzSecurityConnectorAzureDevOpsOrgAvailable -ResourceGroupName -SecurityConnectorName + [-SubscriptionId ] [-DefaultProfile ] [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION +Returns a list of all Azure DevOps organizations accessible by the user token consumed by the connector. + +## EXAMPLES + +### EXAMPLE 1 +``` +Get-AzSecurityConnectorAzureDevOpsOrgAvailable -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-azdo-01 +``` + +## PARAMETERS + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SecurityConnectorName +The security connector name. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure subscription ID + +```yaml +Type: String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrgListResponse +## NOTES + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorazuredevopsorgavailable](https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorazuredevopsorgavailable) + diff --git a/src/Security/Security/help/Get-AzSecurityConnectorAzureDevOpsProject.md b/src/Security/Security/help/Get-AzSecurityConnectorAzureDevOpsProject.md new file mode 100644 index 000000000000..b66f2339604d --- /dev/null +++ b/src/Security/Security/help/Get-AzSecurityConnectorAzureDevOpsProject.md @@ -0,0 +1,193 @@ +--- +external help file: Az.Security-help.xml +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorazuredevopsproject +schema: 2.0.0 +--- + +# Get-AzSecurityConnectorAzureDevOpsProject + +## SYNOPSIS +Returns a monitored Azure DevOps project resource. + +## SYNTAX + +### List (Default) +``` +Get-AzSecurityConnectorAzureDevOpsProject -OrgName -ResourceGroupName + -SecurityConnectorName [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzSecurityConnectorAzureDevOpsProject -OrgName -ProjectName -ResourceGroupName + -SecurityConnectorName [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### GetViaIdentity +``` +Get-AzSecurityConnectorAzureDevOpsProject -InputObject [-DefaultProfile ] + [] +``` + +## DESCRIPTION +Returns a monitored Azure DevOps project resource. + +## EXAMPLES + +### EXAMPLE 1 +``` +Get-AzSecurityConnectorAzureDevOpsProject -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-azdo-01 -OrgName dfdsdktests -ProjectName ContosoSDKDfd +``` + +### EXAMPLE 2 +``` +Get-AzSecurityConnectorAzureDevOpsProject -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-azdo-01 -OrgName dfdsdktests +``` + +## PARAMETERS + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +. + +```yaml +Type: ISecurityIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -OrgName +The Azure DevOps organization name. + +```yaml +Type: String +Parameter Sets: List, Get +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProjectName +The project name. + +```yaml +Type: String +Parameter Sets: Get +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: String +Parameter Sets: List, Get +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SecurityConnectorName +The security connector name. + +```yaml +Type: String +Parameter Sets: List, Get +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure subscription ID + +```yaml +Type: String[] +Parameter Sets: List, Get +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProject +## NOTES +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. +For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT \: Identity Parameter + \[ApiId \\]: API revision identifier. +Must be unique in the API Management service instance. +Non-current revision has ;rev=n as a suffix where n is the revision number. + \[GroupFqName \\]: The GitLab group fully-qualified name. + \[Id \\]: Resource identity path + \[OperationResultId \\]: The operation result Id. + \[OrgName \\]: The Azure DevOps organization name. + \[OwnerName \\]: The GitHub owner name. + \[ProjectName \\]: The project name. + \[RepoName \\]: The repository name. + \[ResourceGroupName \\]: The name of the resource group within the user's subscription. +The name is case insensitive. + \[SecurityConnectorName \\]: The security connector name. + \[ServiceName \\]: The name of the API Management service. + \[SubscriptionId \\]: Azure subscription ID + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorazuredevopsproject](https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorazuredevopsproject) + diff --git a/src/Security/Security/help/Get-AzSecurityConnectorAzureDevOpsRepo.md b/src/Security/Security/help/Get-AzSecurityConnectorAzureDevOpsRepo.md new file mode 100644 index 000000000000..090ed923aaa8 --- /dev/null +++ b/src/Security/Security/help/Get-AzSecurityConnectorAzureDevOpsRepo.md @@ -0,0 +1,209 @@ +--- +external help file: Az.Security-help.xml +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorazuredevopsrepo +schema: 2.0.0 +--- + +# Get-AzSecurityConnectorAzureDevOpsRepo + +## SYNOPSIS +Returns a monitored Azure DevOps repository resource. + +## SYNTAX + +### List (Default) +``` +Get-AzSecurityConnectorAzureDevOpsRepo -OrgName -ProjectName -ResourceGroupName + -SecurityConnectorName [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzSecurityConnectorAzureDevOpsRepo -OrgName -ProjectName -RepoName + -ResourceGroupName -SecurityConnectorName [-SubscriptionId ] + [-DefaultProfile ] [] +``` + +### GetViaIdentity +``` +Get-AzSecurityConnectorAzureDevOpsRepo -InputObject [-DefaultProfile ] + [] +``` + +## DESCRIPTION +Returns a monitored Azure DevOps repository resource. + +## EXAMPLES + +### EXAMPLE 1 +``` +Get-AzSecurityConnectorAzureDevOpsRepo -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-azdo-01 -OrgName dfdsdktests -ProjectName ContosoSDKDfd -RepoName TestApp0 +``` + +### EXAMPLE 2 +``` +Get-AzSecurityConnectorAzureDevOpsRepo -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-azdo-01 -OrgName dfdsdktests -ProjectName ContosoSDKDfd +``` + +## PARAMETERS + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +. + +```yaml +Type: ISecurityIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -OrgName +The Azure DevOps organization name. + +```yaml +Type: String +Parameter Sets: List, Get +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProjectName +The project name. + +```yaml +Type: String +Parameter Sets: List, Get +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -RepoName +The repository name. + +```yaml +Type: String +Parameter Sets: Get +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: String +Parameter Sets: List, Get +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SecurityConnectorName +The security connector name. + +```yaml +Type: String +Parameter Sets: List, Get +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure subscription ID + +```yaml +Type: String[] +Parameter Sets: List, Get +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepository +## NOTES +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. +For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT \: Identity Parameter + \[ApiId \\]: API revision identifier. +Must be unique in the API Management service instance. +Non-current revision has ;rev=n as a suffix where n is the revision number. + \[GroupFqName \\]: The GitLab group fully-qualified name. + \[Id \\]: Resource identity path + \[OperationResultId \\]: The operation result Id. + \[OrgName \\]: The Azure DevOps organization name. + \[OwnerName \\]: The GitHub owner name. + \[ProjectName \\]: The project name. + \[RepoName \\]: The repository name. + \[ResourceGroupName \\]: The name of the resource group within the user's subscription. +The name is case insensitive. + \[SecurityConnectorName \\]: The security connector name. + \[ServiceName \\]: The name of the API Management service. + \[SubscriptionId \\]: Azure subscription ID + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorazuredevopsrepo](https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorazuredevopsrepo) + diff --git a/src/Security/Security/help/Get-AzSecurityConnectorDevOpsConfiguration.md b/src/Security/Security/help/Get-AzSecurityConnectorDevOpsConfiguration.md new file mode 100644 index 000000000000..2db7b9cc86ca --- /dev/null +++ b/src/Security/Security/help/Get-AzSecurityConnectorDevOpsConfiguration.md @@ -0,0 +1,163 @@ +--- +external help file: Az.Security-help.xml +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectordevopsconfiguration +schema: 2.0.0 +--- + +# Get-AzSecurityConnectorDevOpsConfiguration + +## SYNOPSIS +Gets a DevOps Configuration. + +## SYNTAX + +### Get (Default) +``` +Get-AzSecurityConnectorDevOpsConfiguration -ResourceGroupName -SecurityConnectorName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### List +``` +Get-AzSecurityConnectorDevOpsConfiguration -ResourceGroupName -SecurityConnectorName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### GetViaIdentity +``` +Get-AzSecurityConnectorDevOpsConfiguration -InputObject [-DefaultProfile ] + [] +``` + +## DESCRIPTION +Gets a DevOps Configuration. + +## EXAMPLES + +### EXAMPLE 1 +``` +Get-AzSecurityConnectorDevOpsConfiguration -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-azdo-01 +``` + +### EXAMPLE 2 +``` +Get-AzSecurityConnectorDevOpsConfiguration -ResourceGroupName securityconnectors-tests -SecurityConnectorName aws-sdktest01 +``` + +## PARAMETERS + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +. + +```yaml +Type: ISecurityIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SecurityConnectorName +The security connector name. + +```yaml +Type: String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure subscription ID + +```yaml +Type: String[] +Parameter Sets: Get, List +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfiguration +## NOTES +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. +For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT \: Identity Parameter + \[ApiId \\]: API revision identifier. +Must be unique in the API Management service instance. +Non-current revision has ;rev=n as a suffix where n is the revision number. + \[GroupFqName \\]: The GitLab group fully-qualified name. + \[Id \\]: Resource identity path + \[OperationResultId \\]: The operation result Id. + \[OrgName \\]: The Azure DevOps organization name. + \[OwnerName \\]: The GitHub owner name. + \[ProjectName \\]: The project name. + \[RepoName \\]: The repository name. + \[ResourceGroupName \\]: The name of the resource group within the user's subscription. +The name is case insensitive. + \[SecurityConnectorName \\]: The security connector name. + \[ServiceName \\]: The name of the API Management service. + \[SubscriptionId \\]: Azure subscription ID + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectordevopsconfiguration](https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectordevopsconfiguration) + diff --git a/src/Security/Security/help/Get-AzSecurityConnectorGitHubOwner.md b/src/Security/Security/help/Get-AzSecurityConnectorGitHubOwner.md new file mode 100644 index 000000000000..595aece2d5b6 --- /dev/null +++ b/src/Security/Security/help/Get-AzSecurityConnectorGitHubOwner.md @@ -0,0 +1,178 @@ +--- +external help file: Az.Security-help.xml +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorgithubowner +schema: 2.0.0 +--- + +# Get-AzSecurityConnectorGitHubOwner + +## SYNOPSIS +Returns a monitored GitHub owner. + +## SYNTAX + +### List (Default) +``` +Get-AzSecurityConnectorGitHubOwner -ResourceGroupName -SecurityConnectorName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzSecurityConnectorGitHubOwner -OwnerName -ResourceGroupName + -SecurityConnectorName [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### GetViaIdentity +``` +Get-AzSecurityConnectorGitHubOwner -InputObject [-DefaultProfile ] + [] +``` + +## DESCRIPTION +Returns a monitored GitHub owner. + +## EXAMPLES + +### EXAMPLE 1 +``` +Get-AzSecurityConnectorGitHubOwner -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-gh-01 -OwnerName dfdsdktests +``` + +### EXAMPLE 2 +``` +Get-AzSecurityConnectorGitHubOwner -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-gh-01 +``` + +## PARAMETERS + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +. + +```yaml +Type: ISecurityIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -OwnerName +The GitHub owner name. + +```yaml +Type: String +Parameter Sets: Get +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: String +Parameter Sets: List, Get +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SecurityConnectorName +The security connector name. + +```yaml +Type: String +Parameter Sets: List, Get +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure subscription ID + +```yaml +Type: String[] +Parameter Sets: List, Get +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwner +## NOTES +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. +For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT \: Identity Parameter + \[ApiId \\]: API revision identifier. +Must be unique in the API Management service instance. +Non-current revision has ;rev=n as a suffix where n is the revision number. + \[GroupFqName \\]: The GitLab group fully-qualified name. + \[Id \\]: Resource identity path + \[OperationResultId \\]: The operation result Id. + \[OrgName \\]: The Azure DevOps organization name. + \[OwnerName \\]: The GitHub owner name. + \[ProjectName \\]: The project name. + \[RepoName \\]: The repository name. + \[ResourceGroupName \\]: The name of the resource group within the user's subscription. +The name is case insensitive. + \[SecurityConnectorName \\]: The security connector name. + \[ServiceName \\]: The name of the API Management service. + \[SubscriptionId \\]: Azure subscription ID + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorgithubowner](https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorgithubowner) + diff --git a/src/Security/Security/help/Get-AzSecurityConnectorGitHubOwnerAvailable.md b/src/Security/Security/help/Get-AzSecurityConnectorGitHubOwnerAvailable.md new file mode 100644 index 000000000000..08687fded762 --- /dev/null +++ b/src/Security/Security/help/Get-AzSecurityConnectorGitHubOwnerAvailable.md @@ -0,0 +1,138 @@ +--- +external help file: Az.Security-help.xml +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorgithubowneravailable +schema: 2.0.0 +--- + +# Get-AzSecurityConnectorGitHubOwnerAvailable + +## SYNOPSIS +Returns a list of all GitHub owners accessible by the user token consumed by the connector. + +## SYNTAX + +``` +Get-AzSecurityConnectorGitHubOwnerAvailable -ResourceGroupName -SecurityConnectorName + [-SubscriptionId ] [-DefaultProfile ] [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION +Returns a list of all GitHub owners accessible by the user token consumed by the connector. + +## EXAMPLES + +### EXAMPLE 1 +``` +Get-AzSecurityConnectorGitHubOwnerAvailable -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-gh-01 +``` + +## PARAMETERS + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SecurityConnectorName +The security connector name. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure subscription ID + +```yaml +Type: String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubOwnerListResponse +## NOTES + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorgithubowneravailable](https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorgithubowneravailable) + diff --git a/src/Security/Security/help/Get-AzSecurityConnectorGitHubRepo.md b/src/Security/Security/help/Get-AzSecurityConnectorGitHubRepo.md new file mode 100644 index 000000000000..6b24823dcf35 --- /dev/null +++ b/src/Security/Security/help/Get-AzSecurityConnectorGitHubRepo.md @@ -0,0 +1,193 @@ +--- +external help file: Az.Security-help.xml +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorgithubrepo +schema: 2.0.0 +--- + +# Get-AzSecurityConnectorGitHubRepo + +## SYNOPSIS +Returns a monitored GitHub repository. + +## SYNTAX + +### List (Default) +``` +Get-AzSecurityConnectorGitHubRepo -OwnerName -ResourceGroupName + -SecurityConnectorName [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzSecurityConnectorGitHubRepo -OwnerName -RepoName -ResourceGroupName + -SecurityConnectorName [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### GetViaIdentity +``` +Get-AzSecurityConnectorGitHubRepo -InputObject [-DefaultProfile ] + [] +``` + +## DESCRIPTION +Returns a monitored GitHub repository. + +## EXAMPLES + +### EXAMPLE 1 +``` +Get-AzSecurityConnectorGitHubRepo -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-gh-01 -OwnerName dfdsdktests -RepoName TestApp0 +``` + +### EXAMPLE 2 +``` +Get-AzSecurityConnectorGitHubRepo -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-gh-01 -OwnerName dfdsdktests +``` + +## PARAMETERS + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +. + +```yaml +Type: ISecurityIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -OwnerName +The GitHub owner name. + +```yaml +Type: String +Parameter Sets: List, Get +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -RepoName +The repository name. + +```yaml +Type: String +Parameter Sets: Get +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: String +Parameter Sets: List, Get +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SecurityConnectorName +The security connector name. + +```yaml +Type: String +Parameter Sets: List, Get +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure subscription ID + +```yaml +Type: String[] +Parameter Sets: List, Get +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitHubRepository +## NOTES +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. +For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT \: Identity Parameter + \[ApiId \\]: API revision identifier. +Must be unique in the API Management service instance. +Non-current revision has ;rev=n as a suffix where n is the revision number. + \[GroupFqName \\]: The GitLab group fully-qualified name. + \[Id \\]: Resource identity path + \[OperationResultId \\]: The operation result Id. + \[OrgName \\]: The Azure DevOps organization name. + \[OwnerName \\]: The GitHub owner name. + \[ProjectName \\]: The project name. + \[RepoName \\]: The repository name. + \[ResourceGroupName \\]: The name of the resource group within the user's subscription. +The name is case insensitive. + \[SecurityConnectorName \\]: The security connector name. + \[ServiceName \\]: The name of the API Management service. + \[SubscriptionId \\]: Azure subscription ID + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorgithubrepo](https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorgithubrepo) + diff --git a/src/Security/Security/help/Get-AzSecurityConnectorGitLabGroup.md b/src/Security/Security/help/Get-AzSecurityConnectorGitLabGroup.md new file mode 100644 index 000000000000..ee7b79706fe3 --- /dev/null +++ b/src/Security/Security/help/Get-AzSecurityConnectorGitLabGroup.md @@ -0,0 +1,178 @@ +--- +external help file: Az.Security-help.xml +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorgitlabgroup +schema: 2.0.0 +--- + +# Get-AzSecurityConnectorGitLabGroup + +## SYNOPSIS +Returns a monitored GitLab Group resource for a given fully-qualified name. + +## SYNTAX + +### List (Default) +``` +Get-AzSecurityConnectorGitLabGroup -ResourceGroupName -SecurityConnectorName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzSecurityConnectorGitLabGroup -GroupFqName -ResourceGroupName + -SecurityConnectorName [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### GetViaIdentity +``` +Get-AzSecurityConnectorGitLabGroup -InputObject [-DefaultProfile ] + [] +``` + +## DESCRIPTION +Returns a monitored GitLab Group resource for a given fully-qualified name. + +## EXAMPLES + +### EXAMPLE 1 +``` +Get-AzSecurityConnectorGitLabGroup -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-gl-01 -GroupFqName dfdsdktests +``` + +### EXAMPLE 2 +``` +Get-AzSecurityConnectorGitLabGroup -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-gl-01 +``` + +## PARAMETERS + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -GroupFqName +The GitLab group fully-qualified name. + +```yaml +Type: String +Parameter Sets: Get +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +. + +```yaml +Type: ISecurityIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: String +Parameter Sets: List, Get +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SecurityConnectorName +The security connector name. + +```yaml +Type: String +Parameter Sets: List, Get +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure subscription ID + +```yaml +Type: String[] +Parameter Sets: List, Get +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroup +## NOTES +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. +For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT \: Identity Parameter + \[ApiId \\]: API revision identifier. +Must be unique in the API Management service instance. +Non-current revision has ;rev=n as a suffix where n is the revision number. + \[GroupFqName \\]: The GitLab group fully-qualified name. + \[Id \\]: Resource identity path + \[OperationResultId \\]: The operation result Id. + \[OrgName \\]: The Azure DevOps organization name. + \[OwnerName \\]: The GitHub owner name. + \[ProjectName \\]: The project name. + \[RepoName \\]: The repository name. + \[ResourceGroupName \\]: The name of the resource group within the user's subscription. +The name is case insensitive. + \[SecurityConnectorName \\]: The security connector name. + \[ServiceName \\]: The name of the API Management service. + \[SubscriptionId \\]: Azure subscription ID + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorgitlabgroup](https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorgitlabgroup) + diff --git a/src/Security/Security/help/Get-AzSecurityConnectorGitLabGroupAvailable.md b/src/Security/Security/help/Get-AzSecurityConnectorGitLabGroupAvailable.md new file mode 100644 index 000000000000..570b1cb87684 --- /dev/null +++ b/src/Security/Security/help/Get-AzSecurityConnectorGitLabGroupAvailable.md @@ -0,0 +1,138 @@ +--- +external help file: Az.Security-help.xml +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorgitlabgroupavailable +schema: 2.0.0 +--- + +# Get-AzSecurityConnectorGitLabGroupAvailable + +## SYNOPSIS +Returns a list of all GitLab groups accessible by the user token consumed by the connector. + +## SYNTAX + +``` +Get-AzSecurityConnectorGitLabGroupAvailable -ResourceGroupName -SecurityConnectorName + [-SubscriptionId ] [-DefaultProfile ] [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION +Returns a list of all GitLab groups accessible by the user token consumed by the connector. + +## EXAMPLES + +### EXAMPLE 1 +``` +Get-AzSecurityConnectorGitLabGroupAvailable -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-gl-01 +``` + +## PARAMETERS + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SecurityConnectorName +The security connector name. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure subscription ID + +```yaml +Type: String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupListResponse +## NOTES + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorgitlabgroupavailable](https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorgitlabgroupavailable) + diff --git a/src/Security/Security/help/Get-AzSecurityConnectorGitLabProject.md b/src/Security/Security/help/Get-AzSecurityConnectorGitLabProject.md new file mode 100644 index 000000000000..8de7be305cc5 --- /dev/null +++ b/src/Security/Security/help/Get-AzSecurityConnectorGitLabProject.md @@ -0,0 +1,193 @@ +--- +external help file: Az.Security-help.xml +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorgitlabproject +schema: 2.0.0 +--- + +# Get-AzSecurityConnectorGitLabProject + +## SYNOPSIS +Returns a monitored GitLab Project resource for a given fully-qualified group name and project name. + +## SYNTAX + +### List (Default) +``` +Get-AzSecurityConnectorGitLabProject -GroupFqName -ResourceGroupName + -SecurityConnectorName [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzSecurityConnectorGitLabProject -GroupFqName -ProjectName -ResourceGroupName + -SecurityConnectorName [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### GetViaIdentity +``` +Get-AzSecurityConnectorGitLabProject -InputObject [-DefaultProfile ] + [] +``` + +## DESCRIPTION +Returns a monitored GitLab Project resource for a given fully-qualified group name and project name. + +## EXAMPLES + +### EXAMPLE 1 +``` +Get-AzSecurityConnectorGitLabProject -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-gl-01 -GroupFqName dfdsdktests -ProjectName testapp0 +``` + +### EXAMPLE 2 +``` +Get-AzSecurityConnectorGitLabProject -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-gl-01 -GroupFqName dfdsdktests +``` + +## PARAMETERS + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -GroupFqName +The GitLab group fully-qualified name. + +```yaml +Type: String +Parameter Sets: List, Get +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +. + +```yaml +Type: ISecurityIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -ProjectName +The project name. + +```yaml +Type: String +Parameter Sets: Get +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: String +Parameter Sets: List, Get +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SecurityConnectorName +The security connector name. + +```yaml +Type: String +Parameter Sets: List, Get +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure subscription ID + +```yaml +Type: String[] +Parameter Sets: List, Get +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabProject +## NOTES +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. +For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT \: Identity Parameter + \[ApiId \\]: API revision identifier. +Must be unique in the API Management service instance. +Non-current revision has ;rev=n as a suffix where n is the revision number. + \[GroupFqName \\]: The GitLab group fully-qualified name. + \[Id \\]: Resource identity path + \[OperationResultId \\]: The operation result Id. + \[OrgName \\]: The Azure DevOps organization name. + \[OwnerName \\]: The GitHub owner name. + \[ProjectName \\]: The project name. + \[RepoName \\]: The repository name. + \[ResourceGroupName \\]: The name of the resource group within the user's subscription. +The name is case insensitive. + \[SecurityConnectorName \\]: The security connector name. + \[ServiceName \\]: The name of the API Management service. + \[SubscriptionId \\]: Azure subscription ID + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorgitlabproject](https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorgitlabproject) + diff --git a/src/Security/Security/help/Get-AzSecurityConnectorGitLabSubgroup.md b/src/Security/Security/help/Get-AzSecurityConnectorGitLabSubgroup.md new file mode 100644 index 000000000000..11fdc5a24395 --- /dev/null +++ b/src/Security/Security/help/Get-AzSecurityConnectorGitLabSubgroup.md @@ -0,0 +1,154 @@ +--- +external help file: Az.Security-help.xml +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorgitlabsubgroup +schema: 2.0.0 +--- + +# Get-AzSecurityConnectorGitLabSubgroup + +## SYNOPSIS +Gets nested subgroups of given GitLab Group which are onboarded to the connector. + +## SYNTAX + +``` +Get-AzSecurityConnectorGitLabSubgroup -GroupFqName -ResourceGroupName + -SecurityConnectorName [-SubscriptionId ] [-DefaultProfile ] [-WhatIf] [-Confirm] + [] +``` + +## DESCRIPTION +Gets nested subgroups of given GitLab Group which are onboarded to the connector. + +## EXAMPLES + +### EXAMPLE 1 +``` +Get-AzSecurityConnectorGitLabSubgroup -ResourceGroupName dfdtest-sdk -SecurityConnectorName dfdsdktests-gl-01 -GroupFqName dfdsdktests +``` + +## PARAMETERS + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -GroupFqName +The GitLab group fully-qualified name. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SecurityConnectorName +The security connector name. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure subscription ID + +```yaml +Type: String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IGitLabGroupListResponse +## NOTES + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorgitlabsubgroup](https://learn.microsoft.com/powershell/module/az.security/get-azsecurityconnectorgitlabsubgroup) + diff --git a/src/Security/Security/help/Get-AzSecuritySolution.md b/src/Security/Security/help/Get-AzSecuritySolution.md index 706040a1efba..33c093aaeb3c 100644 --- a/src/Security/Security/help/Get-AzSecuritySolution.md +++ b/src/Security/Security/help/Get-AzSecuritySolution.md @@ -17,6 +17,17 @@ Get Security Solutions Get-AzSecuritySolution [-DefaultProfile ] [] ``` +### ResourceGroupLevelResource +``` +Get-AzSecuritySolution -ResourceGroupName -Name -Location + [-DefaultProfile ] [] +``` + +### ResourceId +``` +Get-AzSecuritySolution -ResourceId [-DefaultProfile ] [] +``` + ## DESCRIPTION Get Security Solutions @@ -62,6 +73,66 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -Location +Location. + +```yaml +Type: System.String +Parameter Sets: ResourceGroupLevelResource +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +Resource name. + +```yaml +Type: System.String +Parameter Sets: ResourceGroupLevelResource +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +Resource group name. + +```yaml +Type: System.String +Parameter Sets: ResourceGroupLevelResource +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceId +ID of the security resource that you want to invoke the command on. + +```yaml +Type: System.String +Parameter Sets: ResourceId +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + ### CommonParameters This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). @@ -75,4 +146,6 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## NOTES -## RELATED LINKS \ No newline at end of file +## RELATED LINKS + +## RELATED LINKS diff --git a/src/Security/Security/help/Get-AzSecuritySolutionsReferenceData.md b/src/Security/Security/help/Get-AzSecuritySolutionsReferenceData.md index c8d540e25c31..697cbdec80a4 100644 --- a/src/Security/Security/help/Get-AzSecuritySolutionsReferenceData.md +++ b/src/Security/Security/help/Get-AzSecuritySolutionsReferenceData.md @@ -17,6 +17,18 @@ Get Security Solutions Reference Data Get-AzSecuritySolutionsReferenceData [-DefaultProfile ] [] ``` +### SubscriptionLevelResource +``` +Get-AzSecuritySolutionsReferenceData -ResourceId [-DefaultProfile ] + [] +``` + +### ResourceId +``` +Get-AzSecuritySolutionsReferenceData -ResourceId [-DefaultProfile ] + [] +``` + ## DESCRIPTION Get Security Solutions Reference Data @@ -70,6 +82,33 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -ResourceId +Resource name. + +```yaml +Type: System.String +Parameter Sets: SubscriptionLevelResource +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +```yaml +Type: System.String +Parameter Sets: ResourceId +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### CommonParameters This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). diff --git a/src/Security/Security/help/Invoke-AzSecurityApiCollectionApimOffboard.md b/src/Security/Security/help/Invoke-AzSecurityApiCollectionApimOffboard.md new file mode 100644 index 000000000000..89288b39303b --- /dev/null +++ b/src/Security/Security/help/Invoke-AzSecurityApiCollectionApimOffboard.md @@ -0,0 +1,217 @@ +--- +external help file: Az.Security-help.xml +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/az.security/invoke-azsecurityapicollectionapimoffboard +schema: 2.0.0 +--- + +# Invoke-AzSecurityApiCollectionApimOffboard + +## SYNOPSIS +Offboard an Azure API Management API from Microsoft Defender for APIs. +The system will stop monitoring the operations within the Azure API Management API for intrusive behaviors. + +## SYNTAX + +### Delete (Default) +``` +Invoke-AzSecurityApiCollectionApimOffboard -ApiId -ResourceGroupName -ServiceName + [-SubscriptionId ] [-DefaultProfile ] [-PassThru] [-WhatIf] [-Confirm] [] +``` + +### DeleteViaIdentity +``` +Invoke-AzSecurityApiCollectionApimOffboard -InputObject [-DefaultProfile ] + [-PassThru] [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION +Offboard an Azure API Management API from Microsoft Defender for APIs. +The system will stop monitoring the operations within the Azure API Management API for intrusive behaviors. + +## EXAMPLES + +### EXAMPLE 1 +``` +Invoke-AzSecurityApiCollectionApimOffboard -ResourceGroupName "apicollectionstests" -ServiceName "demoapimservice2" -ApiId "echo-api-2" +``` + +## PARAMETERS + +### -ApiId +API revision identifier. +Must be unique in the API Management service instance. +Non-current revision has ;rev=n as a suffix where n is the revision number. + +```yaml +Type: String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +. + +```yaml +Type: ISecurityIdentity +Parameter Sets: DeleteViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -PassThru +Returns true when the command succeeds + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ServiceName +The name of the API Management service. + +```yaml +Type: String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure subscription ID + +```yaml +Type: String +Parameter Sets: Delete +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +## OUTPUTS + +### System.Boolean +## NOTES +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. +For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT \: Identity Parameter + \[ApiId \\]: API revision identifier. +Must be unique in the API Management service instance. +Non-current revision has ;rev=n as a suffix where n is the revision number. + \[GroupFqName \\]: The GitLab group fully-qualified name. + \[Id \\]: Resource identity path + \[OperationResultId \\]: The operation result Id. + \[OrgName \\]: The Azure DevOps organization name. + \[OwnerName \\]: The GitHub owner name. + \[ProjectName \\]: The project name. + \[RepoName \\]: The repository name. + \[ResourceGroupName \\]: The name of the resource group within the user's subscription. +The name is case insensitive. + \[SecurityConnectorName \\]: The security connector name. + \[ServiceName \\]: The name of the API Management service. + \[SubscriptionId \\]: Azure subscription ID + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/az.security/invoke-azsecurityapicollectionapimoffboard](https://learn.microsoft.com/powershell/module/az.security/invoke-azsecurityapicollectionapimoffboard) + diff --git a/src/Security/Security/help/Invoke-AzSecurityApiCollectionApimOnboard.md b/src/Security/Security/help/Invoke-AzSecurityApiCollectionApimOnboard.md new file mode 100644 index 000000000000..d0ffc80d7dfb --- /dev/null +++ b/src/Security/Security/help/Invoke-AzSecurityApiCollectionApimOnboard.md @@ -0,0 +1,233 @@ +--- +external help file: Az.Security-help.xml +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/az.security/invoke-azsecurityapicollectionapimonboard +schema: 2.0.0 +--- + +# Invoke-AzSecurityApiCollectionApimOnboard + +## SYNOPSIS +Onboard an Azure API Management API to Microsoft Defender for APIs. +The system will start monitoring the operations within the Azure Management API for intrusive behaviors and provide alerts for attacks that have been detected. + +## SYNTAX + +### Azure (Default) +``` +Invoke-AzSecurityApiCollectionApimOnboard -ApiId -ResourceGroupName -ServiceName + [-SubscriptionId ] [-DefaultProfile ] [-AsJob] [-NoWait] [-WhatIf] [-Confirm] + [] +``` + +### AzureViaIdentity +``` +Invoke-AzSecurityApiCollectionApimOnboard -InputObject [-DefaultProfile ] + [-AsJob] [-NoWait] [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION +Onboard an Azure API Management API to Microsoft Defender for APIs. +The system will start monitoring the operations within the Azure Management API for intrusive behaviors and provide alerts for attacks that have been detected. + +## EXAMPLES + +### EXAMPLE 1 +``` +Invoke-AzSecurityApiCollectionApimOnboard -ResourceGroupName "apicollectionstests" -ServiceName "demoapimservice2" -ApiId "echo-api-2" +``` + +## PARAMETERS + +### -ApiId +API revision identifier. +Must be unique in the API Management service instance. +Non-current revision has ;rev=n as a suffix where n is the revision number. + +```yaml +Type: String +Parameter Sets: Azure +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -AsJob +Run the command as a job + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +. + +```yaml +Type: ISecurityIdentity +Parameter Sets: AzureViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: String +Parameter Sets: Azure +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ServiceName +The name of the API Management service. + +```yaml +Type: String +Parameter Sets: Azure +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure subscription ID + +```yaml +Type: String +Parameter Sets: Azure +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IApiCollection +## NOTES +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. +For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT \: Identity Parameter + \[ApiId \\]: API revision identifier. +Must be unique in the API Management service instance. +Non-current revision has ;rev=n as a suffix where n is the revision number. + \[GroupFqName \\]: The GitLab group fully-qualified name. + \[Id \\]: Resource identity path + \[OperationResultId \\]: The operation result Id. + \[OrgName \\]: The Azure DevOps organization name. + \[OwnerName \\]: The GitHub owner name. + \[ProjectName \\]: The project name. + \[RepoName \\]: The repository name. + \[ResourceGroupName \\]: The name of the resource group within the user's subscription. +The name is case insensitive. + \[SecurityConnectorName \\]: The security connector name. + \[ServiceName \\]: The name of the API Management service. + \[SubscriptionId \\]: Azure subscription ID + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/az.security/invoke-azsecurityapicollectionapimonboard](https://learn.microsoft.com/powershell/module/az.security/invoke-azsecurityapicollectionapimonboard) + diff --git a/src/Security/Security/help/New-AzSecurityAutomationActionObject.md b/src/Security/Security/help/New-AzSecurityAutomationActionObject.md index 88ec32d92d41..7e5cb165720b 100644 --- a/src/Security/Security/help/New-AzSecurityAutomationActionObject.md +++ b/src/Security/Security/help/New-AzSecurityAutomationActionObject.md @@ -62,7 +62,7 @@ Creates new security automation action with even-hub type The target Event Hub connection string ```yaml -Type: String +Type: System.String Parameter Sets: SecurityAutomationActionEventHub Aliases: @@ -77,7 +77,7 @@ Accept wildcard characters: False The credentials, account, tenant, and subscription used for communication with Azure. ```yaml -Type: IAzureContextContainer +Type: Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer Parameter Sets: (All) Aliases: AzContext, AzureRmContext, AzureCredential @@ -92,7 +92,7 @@ Accept wildcard characters: False The target Event Hub Azure Resource ID ```yaml -Type: String +Type: System.String Parameter Sets: SecurityAutomationActionEventHub Aliases: @@ -108,7 +108,7 @@ The triggered Logic App Azure Resource ID. This can also reside on other subscriptions, given that you have permissions to trigger the Logic App ```yaml -Type: String +Type: System.String Parameter Sets: SecurityAutomationActionLogicApp Aliases: @@ -123,7 +123,7 @@ Accept wildcard characters: False The target Event Hub SAS policy name ```yaml -Type: String +Type: System.String Parameter Sets: SecurityAutomationActionEventHub Aliases: @@ -138,7 +138,7 @@ Accept wildcard characters: False The Logic App trigger URI endpoint (it will not be included in any response) ```yaml -Type: String +Type: System.String Parameter Sets: SecurityAutomationActionLogicApp Aliases: @@ -153,7 +153,7 @@ Accept wildcard characters: False The fully qualified Log Analytics Workspace Azure Resource ID ```yaml -Type: String +Type: System.String Parameter Sets: SecurityAutomationActionWorkspace Aliases: diff --git a/src/Security/Security/help/New-AzSecurityAutomationRuleObject.md b/src/Security/Security/help/New-AzSecurityAutomationRuleObject.md index 12ae641a033e..69fe83d5c23d 100644 --- a/src/Security/Security/help/New-AzSecurityAutomationRuleObject.md +++ b/src/Security/Security/help/New-AzSecurityAutomationRuleObject.md @@ -35,7 +35,7 @@ Creates security automation rule object that filters messages that with "High" s The credentials, account, tenant, and subscription used for communication with Azure. ```yaml -Type: IAzureContextContainer +Type: Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer Parameter Sets: (All) Aliases: AzContext, AzureRmContext, AzureCredential @@ -50,7 +50,7 @@ Accept wildcard characters: False The expected value ```yaml -Type: String +Type: System.String Parameter Sets: (All) Aliases: @@ -66,7 +66,7 @@ A valid comparer operator to use. A case-insensitive comparison will be applied for String PropertyType ```yaml -Type: String +Type: System.String Parameter Sets: (All) Aliases: @@ -81,7 +81,7 @@ Accept wildcard characters: False The JPath of the entity model property that should be checked ```yaml -Type: String +Type: System.String Parameter Sets: (All) Aliases: @@ -96,7 +96,7 @@ Accept wildcard characters: False The data type of the compared operands (string, integer, floating point number or a boolean \[true/false\]\] ```yaml -Type: String +Type: System.String Parameter Sets: (All) Aliases: diff --git a/src/Security/Security/help/New-AzSecurityAutomationRuleSetObject.md b/src/Security/Security/help/New-AzSecurityAutomationRuleSetObject.md index cdd907fb1042..3f235bdd7253 100644 --- a/src/Security/Security/help/New-AzSecurityAutomationRuleSetObject.md +++ b/src/Security/Security/help/New-AzSecurityAutomationRuleSetObject.md @@ -13,7 +13,7 @@ Creates security automation rule set object ## SYNTAX ``` -New-AzSecurityAutomationRuleSetObject -Rules +New-AzSecurityAutomationRuleSetObject -Rule [-DefaultProfile ] [] ``` @@ -35,7 +35,7 @@ Creates security automation rule set object The credentials, account, tenant, and subscription used for communication with Azure. ```yaml -Type: IAzureContextContainer +Type: Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer Parameter Sets: (All) Aliases: AzContext, AzureRmContext, AzureCredential @@ -46,13 +46,11 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -Rules -A rule which is evaluated upon event interception. -The rule is configured by comparing a specific value from the event model to an expected value. -This comparison is done by using one of the supported operators set +### -Rule +A rule which is evaluated upon event interception. The rule is configured by comparing a specific value from the event model to an expected value. This comparison is done by using one of the supported operators set ```yaml -Type: PSSecurityAutomationTriggeringRule[] +Type: Microsoft.Azure.Commands.Security.Models.Automations.PSSecurityAutomationTriggeringRule[] Parameter Sets: (All) Aliases: diff --git a/src/Security/Security/help/New-AzSecurityAutomationScopeObject.md b/src/Security/Security/help/New-AzSecurityAutomationScopeObject.md index 90ac9625c068..e5fb316ed7ad 100644 --- a/src/Security/Security/help/New-AzSecurityAutomationScopeObject.md +++ b/src/Security/Security/help/New-AzSecurityAutomationScopeObject.md @@ -35,7 +35,7 @@ Creates security automation scope object The credentials, account, tenant, and subscription used for communication with Azure. ```yaml -Type: IAzureContextContainer +Type: Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer Parameter Sets: (All) Aliases: AzContext, AzureRmContext, AzureCredential @@ -50,7 +50,7 @@ Accept wildcard characters: False The resources scope description ```yaml -Type: String +Type: System.String Parameter Sets: (All) Aliases: @@ -66,7 +66,7 @@ The resources scope path. Can be the subscription on which the automation is defined on or a resource group under that subscription (fully qualified Azure resource IDs) ```yaml -Type: String +Type: System.String Parameter Sets: (All) Aliases: diff --git a/src/Security/Security/help/New-AzSecurityAutomationSourceObject.md b/src/Security/Security/help/New-AzSecurityAutomationSourceObject.md index 2fe245725365..838b80b997bb 100644 --- a/src/Security/Security/help/New-AzSecurityAutomationSourceObject.md +++ b/src/Security/Security/help/New-AzSecurityAutomationSourceObject.md @@ -19,7 +19,7 @@ New-AzSecurityAutomationSourceObject [-DefaultProfile ] ### SecurityAutomationActionLogicApp ``` -New-AzSecurityAutomationSourceObject -EventSource -RuleSets +New-AzSecurityAutomationSourceObject -EventSource -RuleSet [-DefaultProfile ] [] ``` @@ -41,7 +41,7 @@ Creates security automation source object The credentials, account, tenant, and subscription used for communication with Azure. ```yaml -Type: IAzureContextContainer +Type: Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer Parameter Sets: (All) Aliases: AzContext, AzureRmContext, AzureCredential @@ -57,7 +57,7 @@ The triggered Logic App Azure Resource ID. This can also reside on other subscriptions, given that you have permissions to trigger the Logic App ```yaml -Type: String +Type: System.String Parameter Sets: SecurityAutomationActionLogicApp Aliases: @@ -68,11 +68,11 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -RuleSets +### -RuleSet The Logic App trigger URI endpoint (it will not be included in any response) ```yaml -Type: PSSecurityAutomationRuleSet[] +Type: Microsoft.Azure.Commands.Security.Models.Automations.PSSecurityAutomationRuleSet[] Parameter Sets: SecurityAutomationActionLogicApp Aliases: diff --git a/src/Security/Security/help/New-AzSecurityAwsEnvironmentObject.md b/src/Security/Security/help/New-AzSecurityAwsEnvironmentObject.md new file mode 100644 index 000000000000..15165fd73208 --- /dev/null +++ b/src/Security/Security/help/New-AzSecurityAwsEnvironmentObject.md @@ -0,0 +1,107 @@ +--- +external help file: Az.Security-help.xml +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/Az.Security/new-azsecurityawsenvironmentobject +schema: 2.0.0 +--- + +# New-AzSecurityAwsEnvironmentObject + +## SYNOPSIS +Create an in-memory object for AwsEnvironment. + +## SYNTAX + +``` +New-AzSecurityAwsEnvironmentObject [-OrganizationalData ] [-Region ] + [-ScanInterval ] [] +``` + +## DESCRIPTION +Create an in-memory object for AwsEnvironment. + +## EXAMPLES + +### EXAMPLE 1 +``` +$member = New-AzSecurityAwsOrganizationalDataMemberObject -ParentHierarchyId "123" +``` + +New-AzSecurityAwsEnvironmentObject -Region "Central US" -ScanInterval 24 -OrganizationalData $member + +### EXAMPLE 2 +``` +$organization = New-AzSecurityAwsOrganizationalDataMasterObject -StacksetName "myAwsStackSet" -ExcludedAccountId "123456789012" +``` + +New-AzSecurityAwsEnvironmentObject -Region "Central US" -ScanInterval 24 -OrganizationalData $organization + +## PARAMETERS + +### -OrganizationalData +The AWS account's organizational data. +. + +```yaml +Type: IAwsOrganizationalData +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Region +list of regions to scan. + +```yaml +Type: String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ScanInterval +Scan interval in hours (value should be between 1-hour to 24-hours). + +```yaml +Type: Int64 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: 0 +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AwsEnvironment +## NOTES +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. +For information on hash tables, run Get-Help about_Hash_Tables. + +ORGANIZATIONALDATA \: The AWS account's organizational data. + OrganizationMembershipType \: The multi cloud account's membership type in the organization + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/Az.Security/new-azsecurityawsenvironmentobject](https://learn.microsoft.com/powershell/module/Az.Security/new-azsecurityawsenvironmentobject) + diff --git a/src/Security/Security/help/New-AzSecurityAwsOrganizationalDataMasterObject.md b/src/Security/Security/help/New-AzSecurityAwsOrganizationalDataMasterObject.md new file mode 100644 index 000000000000..94534801aa36 --- /dev/null +++ b/src/Security/Security/help/New-AzSecurityAwsOrganizationalDataMasterObject.md @@ -0,0 +1,75 @@ +--- +external help file: Az.Security-help.xml +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/Az.Security/new-azsecurityawsorganizationaldatamasterobject +schema: 2.0.0 +--- + +# New-AzSecurityAwsOrganizationalDataMasterObject + +## SYNOPSIS +Create an in-memory object for AwsOrganizationalDataMaster. + +## SYNTAX + +``` +New-AzSecurityAwsOrganizationalDataMasterObject [-ExcludedAccountId ] [-StacksetName ] + [] +``` + +## DESCRIPTION +Create an in-memory object for AwsOrganizationalDataMaster. + +## EXAMPLES + +### EXAMPLE 1 +``` +New-AzSecurityAwsOrganizationalDataMasterObject -StacksetName "myAwsStackSet" -ExcludedAccountId "123456789012" +``` + +## PARAMETERS + +### -ExcludedAccountId +If the multi cloud account is of membership type organization, list of accounts excluded from offering. + +```yaml +Type: String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -StacksetName +If the multi cloud account is of membership type organization, this will be the name of the onboarding stackset. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AwsOrganizationalDataMaster +## NOTES + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/Az.Security/new-azsecurityawsorganizationaldatamasterobject](https://learn.microsoft.com/powershell/module/Az.Security/new-azsecurityawsorganizationaldatamasterobject) + diff --git a/src/Security/Security/help/New-AzSecurityAwsOrganizationalDataMemberObject.md b/src/Security/Security/help/New-AzSecurityAwsOrganizationalDataMemberObject.md new file mode 100644 index 000000000000..ed4e70d86c5b --- /dev/null +++ b/src/Security/Security/help/New-AzSecurityAwsOrganizationalDataMemberObject.md @@ -0,0 +1,59 @@ +--- +external help file: Az.Security-help.xml +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/Az.Security/new-azsecurityawsorganizationaldatamemberobject +schema: 2.0.0 +--- + +# New-AzSecurityAwsOrganizationalDataMemberObject + +## SYNOPSIS +Create an in-memory object for AwsOrganizationalDataMember. + +## SYNTAX + +``` +New-AzSecurityAwsOrganizationalDataMemberObject [-ParentHierarchyId ] [] +``` + +## DESCRIPTION +Create an in-memory object for AwsOrganizationalDataMember. + +## EXAMPLES + +### EXAMPLE 1 +``` +New-AzSecurityAwsOrganizationalDataMemberObject -ParentHierarchyId "123" +``` + +## PARAMETERS + +### -ParentHierarchyId +If the multi cloud account is not of membership type organization, this will be the ID of the account's parent. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AwsOrganizationalDataMember +## NOTES + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/Az.Security/new-azsecurityawsorganizationaldatamemberobject](https://learn.microsoft.com/powershell/module/Az.Security/new-azsecurityawsorganizationaldatamemberobject) + diff --git a/src/Security/Security/help/New-AzSecurityAzureDevOpsScopeEnvironmentObject.md b/src/Security/Security/help/New-AzSecurityAzureDevOpsScopeEnvironmentObject.md new file mode 100644 index 000000000000..2105d9381c6b --- /dev/null +++ b/src/Security/Security/help/New-AzSecurityAzureDevOpsScopeEnvironmentObject.md @@ -0,0 +1,44 @@ +--- +external help file: Az.Security-help.xml +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/Az.Security/new-azsecurityazuredevopsscopeenvironmentobject +schema: 2.0.0 +--- + +# New-AzSecurityAzureDevOpsScopeEnvironmentObject + +## SYNOPSIS +Create an in-memory object for AzureDevOpsScopeEnvironment. + +## SYNTAX + +``` +New-AzSecurityAzureDevOpsScopeEnvironmentObject [] +``` + +## DESCRIPTION +Create an in-memory object for AzureDevOpsScopeEnvironment. + +## EXAMPLES + +### EXAMPLE 1 +``` +New-AzSecurityAzureDevOpsScopeEnvironmentObject +``` + +## PARAMETERS + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.AzureDevOpsScopeEnvironment +## NOTES + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/Az.Security/new-azsecurityazuredevopsscopeenvironmentobject](https://learn.microsoft.com/powershell/module/Az.Security/new-azsecurityazuredevopsscopeenvironmentobject) + diff --git a/src/Security/Security/help/New-AzSecurityConnector.md b/src/Security/Security/help/New-AzSecurityConnector.md new file mode 100644 index 000000000000..9786b47724e7 --- /dev/null +++ b/src/Security/Security/help/New-AzSecurityConnector.md @@ -0,0 +1,355 @@ +--- +external help file: Az.Security-help.xml +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/az.security/new-azsecurityconnector +schema: 2.0.0 +--- + +# New-AzSecurityConnector + +## SYNOPSIS +Create a security connector. +If a security connector is already created and a subsequent request is issued for the same security connector id, then it will be updated. + +## SYNTAX + +``` +New-AzSecurityConnector -Name -ResourceGroupName [-SubscriptionId ] + [-EnvironmentData ] [-EnvironmentName ] [-Etag ] + [-HierarchyIdentifier ] [-Kind ] [-Location ] [-Offering ] + [-Tag ] [-DefaultProfile ] [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION +Create a security connector. +If a security connector is already created and a subsequent request is issued for the same security connector id, then it will be updated. + +## EXAMPLES + +### EXAMPLE 1 +``` +$account = "891376984375" +``` + +$arnPrefix = "arn:aws:iam::$($account):role" + +$cspmMonitorOffering = New-AzSecurityCspmMonitorAwsOfferingObject -NativeCloudConnectionCloudRoleArn "$arnPrefix/CspmMonitorAws" + +$dcspmOffering = New-AzSecurityDefenderCspmAwsOfferingObject \` + -VMScannerEnabled $true -ConfigurationScanningMode Default -ConfigurationCloudRoleArn "$arnPrefix/DefenderForCloud-AgentlessScanner" \` + -DataSensitivityDiscoveryEnabled $true -DataSensitivityDiscoveryCloudRoleArn "$arnPrefix/SensitiveDataDiscovery" \` + -DatabaseDspmEnabled $true -DatabaseDspmCloudRoleArn "$arnPrefix/DefenderForCloud-DataSecurityPostureDB" \` + -CiemDiscoveryCloudRoleArn "$arnPrefix/DefenderForCloud-Ciem" -CiemOidcAzureActiveDirectoryAppName "mciem-aws-oidc-connector" -CiemOidcCloudRoleArn "$arnPrefix/DefenderForCloud-OidcCiem" \` + -MdcContainerImageAssessmentEnabled $true -MdcContainerImageAssessmentCloudRoleArn "$arnPrefix/MDCContainersImageAssessmentRole" \` + -MdcContainerAgentlessDiscoveryK8SEnabled $true -MdcContainerAgentlessDiscoveryK8SCloudRoleArn "$arnPrefix/MDCContainersAgentlessDiscoveryK8sRole" + +$defenderForContainersOffering = New-AzSecurityDefenderForContainersAwsOfferingObject \` + -AutoProvisioning $true -KuberneteServiceCloudRoleArn "$arnPrefix/DefenderForCloud-Containers-K8s" -KuberneteScubaReaderCloudRoleArn "$arnPrefix/DefenderForCloud-DataCollection" \` + -KinesiToS3CloudRoleArn "$arnPrefix/DefenderForCloud-Containers-K8s-kinesis-to-s3" -CloudWatchToKinesiCloudRoleArn "$arnPrefix/DefenderForCloud-Containers-K8s-cloudwatch-to-kinesis" \` + -KubeAuditRetentionTime 30 -ScubaExternalId "a47ae0a2-7bf7-482a-897a-7a139d30736c" \` + -MdcContainerAgentlessDiscoveryK8SEnabled $true -MdcContainerAgentlessDiscoveryK8SCloudRoleArn "$arnPrefix/MDCContainersAgentlessDiscoveryK8sRole" \` + -MdcContainerImageAssessmentEnabled $true -MdcContainerImageAssessmentCloudRoleArn "$arnPrefix/MDCContainersImageAssessmentRole" \` + -EnableContainerVulnerabilityAssessment $false + +$environment = New-AzSecurityAwsEnvironmentObject -ScanInterval 24 + +New-AzSecurityConnector -Name "aws-sdktest01" -ResourceGroupName "securityConnectors-tests" \` + -EnvironmentData $environment -EnvironmentName AWS -HierarchyIdentifier "$account" \` + -Offering @($cspmMonitorOffering, $dcspmOffering, $defenderForContainersOffering) \` + -Location "CentralUS" + +### EXAMPLE 2 +``` +$account = "843025268399" +``` + +$emailSuffix = "myproject.iam.gserviceaccount.com" +$cspmMonitorOffering = New-AzSecurityCspmMonitorGcpOfferingObject -NativeCloudConnectionServiceAccountEmailAddress "microsoft-defender-cspm@$emailSuffix" -NativeCloudConnectionWorkloadIdentityProviderId "cspm" + +$dcspmOffering = New-AzSecurityDefenderCspmGcpOfferingObject \` + -VMScannerEnabled $true -ConfigurationScanningMode Default -ConfigurationExclusionTag @{key="value"} \` + -MdcContainerAgentlessDiscoveryK8SEnabled $true -MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress "mdc-containers-k8s-operator@$emailSuffix" -MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId "containers" \` + -MdcContainerImageAssessmentEnabled $true -MdcContainerImageAssessmentServiceAccountEmailAddress "mdc-containers-artifact-assess@$emailSuffix" -MdcContainerImageAssessmentWorkloadIdentityProviderId "containers" \` + -DataSensitivityDiscoveryEnabled $true -DataSensitivityDiscoveryServiceAccountEmailAddress "mdc-data-sec-posture-storage@$emailSuffix" -DataSensitivityDiscoveryWorkloadIdentityProviderId "data-security-posture-storage" \` + -CiemDiscoveryServiceAccountEmailAddress "microsoft-defender-ciem@$emailSuffix" -CiemDiscoveryAzureActiveDirectoryAppName "mciem-gcp-oidc-app" -CiemDiscoveryWorkloadIdentityProviderId "ciem-discovery" + +$defenderForContainersOffering = New-AzSecurityDefenderForContainersGcpOfferingObject \` + -NativeCloudConnectionServiceAccountEmailAddress "microsoft-defender-containers@$emailSuffix" -NativeCloudConnectionWorkloadIdentityProviderId "containers" \` + -DataPipelineNativeCloudConnectionServiceAccountEmailAddress "ms-defender-containers-stream@$emailSuffix" -DataPipelineNativeCloudConnectionWorkloadIdentityProviderId "containers-streams" \` + -AuditLogsAutoProvisioningFlag $true -DefenderAgentAutoProvisioningFlag $true -PolicyAgentAutoProvisioningFlag $true \` + -MdcContainerAgentlessDiscoveryK8SEnabled $true -MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId "containers" -MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress "mdc-containers-k8s-operator@$emailSuffix" \` + -MdcContainerImageAssessmentEnabled $true -MdcContainerImageAssessmentWorkloadIdentityProviderId "containers" -MdcContainerImageAssessmentServiceAccountEmailAddress "mdc-containers-artifact-assess@$emailSuffix" + +$environment = New-AzSecurityGcpProjectEnvironmentObject -ScanInterval 24 -ProjectDetailProjectId "asc-sdk-samples" -ProjectDetailProjectNumber "$account" + +New-AzSecurityConnector -Name "gcp-sdktest01" -ResourceGroupName "securityConnectors-tests" -EnvironmentData $environment -EnvironmentName GCP -HierarchyIdentifier "$account" \` + -Offering @($cspmMonitorOffering, $dcspmOffering, $defenderForContainersOffering) -Location "CentralUS" + +### EXAMPLE 3 +``` +New-AzSecurityConnector -ResourceGroupName "securityConnectors-pwsh-tmp" -Name "ado-sdk-pwsh-test03" ` +``` + +-EnvironmentName AzureDevOps -EnvironmentData (New-AzSecurityAzureDevOpsScopeEnvironmentObject) \` + -HierarchyIdentifier (\[guid\]::NewGuid().ToString()) -Location "CentralUS" \` + -Offering @(New-AzSecurityCspmMonitorAzureDevOpsOfferingObject) + +### EXAMPLE 4 +``` +New-AzSecurityConnector -ResourceGroupName "securityConnectors-pwsh-tmp" -Name "gh-sdk-pwsh-test03" ` +``` + +-EnvironmentName GitHub -EnvironmentData (New-AzSecurityGitHubScopeEnvironmentObject) \` + -HierarchyIdentifier (\[guid\]::NewGuid().ToString()) -Location "CentralUS" \` + -Offering @(New-AzSecurityCspmMonitorGithubOfferingObject) + +### EXAMPLE 5 +``` +New-AzSecurityConnector -ResourceGroupName "securityConnectors-pwsh-tmp" -Name "gl-sdk-pwsh-test03" ` +``` + +-EnvironmentName GitLab -EnvironmentData (New-AzSecurityGitLabScopeEnvironmentObject) \` + -HierarchyIdentifier (\[guid\]::NewGuid().ToString()) -Location "CentralUS" \` + -Offering @(New-AzSecurityCspmMonitorGitLabOfferingObject) + +## PARAMETERS + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -EnvironmentData +The security connector environment data. +. + +```yaml +Type: ISecurityConnectorEnvironment +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -EnvironmentName +The multi cloud resource's cloud name. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Etag +Entity tag is used for comparing two or more entities from the same requested resource. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -HierarchyIdentifier +The multi cloud resource identifier (account id in case of AWS connector, project number in case of GCP connector). + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Kind +Kind of the resource + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Location +Location where the resource is stored + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +The security connector name. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: SecurityConnectorName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Offering +A collection of offerings for the security connector. +. + +```yaml +Type: ICloudOffering[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group within the user's subscription. +The name is case insensitive. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure subscription ID + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Tag +A list of key value pairs that describe the resource. + +```yaml +Type: Hashtable +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnector +## NOTES +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. +For information on hash tables, run Get-Help about_Hash_Tables. + +ENVIRONMENTDATA \: The security connector environment data. + EnvironmentType \: The type of the environment data. + +OFFERING \: A collection of offerings for the security connector. + OfferingType \: The type of the security offering. + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/az.security/new-azsecurityconnector](https://learn.microsoft.com/powershell/module/az.security/new-azsecurityconnector) + diff --git a/src/Security/Security/help/New-AzSecurityConnectorActionableRemediationObject.md b/src/Security/Security/help/New-AzSecurityConnectorActionableRemediationObject.md new file mode 100644 index 000000000000..4da377ce852f --- /dev/null +++ b/src/Security/Security/help/New-AzSecurityConnectorActionableRemediationObject.md @@ -0,0 +1,136 @@ +--- +external help file: Az.Security-help.xml +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/Az.Security/new-azsecurityconnectoractionableremediationobject +schema: 2.0.0 +--- + +# New-AzSecurityConnectorActionableRemediationObject + +## SYNOPSIS +Create an in-memory object for ActionableRemediation. + +## SYNTAX + +``` +New-AzSecurityConnectorActionableRemediationObject [-BranchConfiguration ] + [-CategoryConfiguration ] [-InheritFromParentState ] [-State ] + [] +``` + +## DESCRIPTION +Create an in-memory object for ActionableRemediation. + +## EXAMPLES + +### EXAMPLE 1 +``` +New-AzSecurityConnectorActionableRemediationObject -State Enabled -InheritFromParentState Disabled ` +``` + +-BranchConfiguration @{AnnotateDefaultBranch="Enabled"; branchName=@("main", "hotfix")} -CategoryConfiguration @( @{category="First"; minimumSeverityLevel="High"}, @{category="Second"; minimumSeverityLevel="Low"}) + +## PARAMETERS + +### -BranchConfiguration +Repository branch configuration for PR Annotations. +. + +```yaml +Type: ITargetBranchConfiguration +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -CategoryConfiguration +Gets or sets list of categories and severity levels. +. + +```yaml +Type: ICategoryConfiguration[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InheritFromParentState +Update Settings. + + Enabled - Resource should inherit configurations from parent. + Disabled - Resource should not inherit configurations from parent. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -State +ActionableRemediation Setting. + None - the setting was never set. + Enabled - ActionableRemediation is enabled. + Disabled - ActionableRemediation is disabled. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ActionableRemediation +## NOTES +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. +For information on hash tables, run Get-Help about_Hash_Tables. + +BRANCHCONFIGURATION \: Repository branch configuration for PR Annotations. + \[AnnotateDefaultBranch \\]: Configuration of PR Annotations on default branch. +Enabled - PR Annotations are enabled on the resource's default branch. +Disabled - PR Annotations are disabled on the resource's default branch. + \[BranchName \\>\]: Gets or sets branches that should have annotations. + +CATEGORYCONFIGURATION \: Gets or sets list of categories and severity levels. + \[Category \\]: Rule categories. +Code - code scanning results. +Artifact scanning results. +Dependencies scanning results. +IaC results. +Secrets scanning results. +Container scanning results. + \[MinimumSeverityLevel \\]: Gets or sets minimum severity level for a given category. + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/Az.Security/new-azsecurityconnectoractionableremediationobject](https://learn.microsoft.com/powershell/module/Az.Security/new-azsecurityconnectoractionableremediationobject) + diff --git a/src/Security/Security/help/New-AzSecurityConnectorDevOpsConfiguration.md b/src/Security/Security/help/New-AzSecurityConnectorDevOpsConfiguration.md new file mode 100644 index 000000000000..56cc94e2e233 --- /dev/null +++ b/src/Security/Security/help/New-AzSecurityConnectorDevOpsConfiguration.md @@ -0,0 +1,216 @@ +--- +external help file: Az.Security-help.xml +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/az.security/new-azsecurityconnectordevopsconfiguration +schema: 2.0.0 +--- + +# New-AzSecurityConnectorDevOpsConfiguration + +## SYNOPSIS +Create a DevOps Configuration. + +## SYNTAX + +``` +New-AzSecurityConnectorDevOpsConfiguration -ResourceGroupName -SecurityConnectorName + [-SubscriptionId ] [-AuthorizationCode ] [-AutoDiscovery ] + [-TopLevelInventoryList ] [-DefaultProfile ] [-AsJob] [-NoWait] [-WhatIf] [-Confirm] + [] +``` + +## DESCRIPTION +Create a DevOps Configuration. + +## EXAMPLES + +### EXAMPLE 1 +``` +New-AzSecurityConnectorDevOpsConfiguration -ResourceGroupName "securityconnectors-pwsh-tmp" -SecurityConnectorName "ado-sdk-pwsh-test03" -AutoDiscovery Disabled -TopLevelInventoryList @("org1", "org2") -AuthorizationCode "myAuthorizationCode" +``` + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -AuthorizationCode +Gets or sets one-time OAuth code to exchange for refresh and access tokens.Only used during PUT/PATCH operations. +The secret is cleared during GET. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -AutoDiscovery +AutoDiscovery states. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SecurityConnectorName +The security connector name. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure subscription ID + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TopLevelInventoryList +List of top-level inventory to select when AutoDiscovery is disabled.This field is ignored when AutoDiscovery is enabled. + +```yaml +Type: String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfiguration +## NOTES + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/az.security/new-azsecurityconnectordevopsconfiguration](https://learn.microsoft.com/powershell/module/az.security/new-azsecurityconnectordevopsconfiguration) + diff --git a/src/Security/Security/help/New-AzSecurityCspmMonitorAwsOfferingObject.md b/src/Security/Security/help/New-AzSecurityCspmMonitorAwsOfferingObject.md new file mode 100644 index 000000000000..77ae81a78c54 --- /dev/null +++ b/src/Security/Security/help/New-AzSecurityCspmMonitorAwsOfferingObject.md @@ -0,0 +1,59 @@ +--- +external help file: Az.Security-help.xml +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritycspmmonitorawsofferingobject +schema: 2.0.0 +--- + +# New-AzSecurityCspmMonitorAwsOfferingObject + +## SYNOPSIS +Create an in-memory object for CspmMonitorAwsOffering. + +## SYNTAX + +``` +New-AzSecurityCspmMonitorAwsOfferingObject [-NativeCloudConnectionCloudRoleArn ] [] +``` + +## DESCRIPTION +Create an in-memory object for CspmMonitorAwsOffering. + +## EXAMPLES + +### EXAMPLE 1 +``` +New-AzSecurityCspmMonitorAwsOfferingObject -NativeCloudConnectionCloudRoleArn "arn:aws:iam::123456789012:role/CspmMonitorAws" +``` + +## PARAMETERS + +### -NativeCloudConnectionCloudRoleArn +The cloud role ARN in AWS for this feature. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CspmMonitorAwsOffering +## NOTES + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritycspmmonitorawsofferingobject](https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritycspmmonitorawsofferingobject) + diff --git a/src/Security/Security/help/New-AzSecurityCspmMonitorAzureDevOpsOfferingObject.md b/src/Security/Security/help/New-AzSecurityCspmMonitorAzureDevOpsOfferingObject.md new file mode 100644 index 000000000000..add88d14f1c4 --- /dev/null +++ b/src/Security/Security/help/New-AzSecurityCspmMonitorAzureDevOpsOfferingObject.md @@ -0,0 +1,44 @@ +--- +external help file: Az.Security-help.xml +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritycspmmonitorazuredevopsofferingobject +schema: 2.0.0 +--- + +# New-AzSecurityCspmMonitorAzureDevOpsOfferingObject + +## SYNOPSIS +Create an in-memory object for CspmMonitorAzureDevOpsOffering. + +## SYNTAX + +``` +New-AzSecurityCspmMonitorAzureDevOpsOfferingObject [] +``` + +## DESCRIPTION +Create an in-memory object for CspmMonitorAzureDevOpsOffering. + +## EXAMPLES + +### EXAMPLE 1 +``` +New-AzSecurityCspmMonitorAzureDevOpsOfferingObject +``` + +## PARAMETERS + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CspmMonitorAzureDevOpsOffering +## NOTES + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritycspmmonitorazuredevopsofferingobject](https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritycspmmonitorazuredevopsofferingobject) + diff --git a/src/Security/Security/help/New-AzSecurityCspmMonitorGcpOfferingObject.md b/src/Security/Security/help/New-AzSecurityCspmMonitorGcpOfferingObject.md new file mode 100644 index 000000000000..c445b0c44144 --- /dev/null +++ b/src/Security/Security/help/New-AzSecurityCspmMonitorGcpOfferingObject.md @@ -0,0 +1,75 @@ +--- +external help file: Az.Security-help.xml +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritycspmmonitorgcpofferingobject +schema: 2.0.0 +--- + +# New-AzSecurityCspmMonitorGcpOfferingObject + +## SYNOPSIS +Create an in-memory object for CspmMonitorGcpOffering. + +## SYNTAX + +``` +New-AzSecurityCspmMonitorGcpOfferingObject [-NativeCloudConnectionServiceAccountEmailAddress ] + [-NativeCloudConnectionWorkloadIdentityProviderId ] [] +``` + +## DESCRIPTION +Create an in-memory object for CspmMonitorGcpOffering. + +## EXAMPLES + +### EXAMPLE 1 +``` +New-AzSecurityCspmMonitorGcpOfferingObject -NativeCloudConnectionServiceAccountEmailAddress "microsoft-defender-cspm@asc-sdk-samples.iam.gserviceaccount.com" -NativeCloudConnectionWorkloadIdentityProviderId "cspm" +``` + +## PARAMETERS + +### -NativeCloudConnectionServiceAccountEmailAddress +The service account email address in GCP for this offering. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NativeCloudConnectionWorkloadIdentityProviderId +The GCP workload identity provider id for the offering. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CspmMonitorGcpOffering +## NOTES + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritycspmmonitorgcpofferingobject](https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritycspmmonitorgcpofferingobject) + diff --git a/src/Security/Security/help/New-AzSecurityCspmMonitorGitLabOfferingObject.md b/src/Security/Security/help/New-AzSecurityCspmMonitorGitLabOfferingObject.md new file mode 100644 index 000000000000..b4522393ec48 --- /dev/null +++ b/src/Security/Security/help/New-AzSecurityCspmMonitorGitLabOfferingObject.md @@ -0,0 +1,44 @@ +--- +external help file: Az.Security-help.xml +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritycspmmonitorgitlabofferingobject +schema: 2.0.0 +--- + +# New-AzSecurityCspmMonitorGitLabOfferingObject + +## SYNOPSIS +Create an in-memory object for CspmMonitorGitLabOffering. + +## SYNTAX + +``` +New-AzSecurityCspmMonitorGitLabOfferingObject [] +``` + +## DESCRIPTION +Create an in-memory object for CspmMonitorGitLabOffering. + +## EXAMPLES + +### EXAMPLE 1 +``` +New-AzSecurityCspmMonitorGitLabOfferingObject +``` + +## PARAMETERS + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CspmMonitorGitLabOffering +## NOTES + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritycspmmonitorgitlabofferingobject](https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritycspmmonitorgitlabofferingobject) + diff --git a/src/Security/Security/help/New-AzSecurityCspmMonitorGithubOfferingObject.md b/src/Security/Security/help/New-AzSecurityCspmMonitorGithubOfferingObject.md new file mode 100644 index 000000000000..f7e07a6849fb --- /dev/null +++ b/src/Security/Security/help/New-AzSecurityCspmMonitorGithubOfferingObject.md @@ -0,0 +1,44 @@ +--- +external help file: Az.Security-help.xml +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritycspmmonitorgithubofferingobject +schema: 2.0.0 +--- + +# New-AzSecurityCspmMonitorGithubOfferingObject + +## SYNOPSIS +Create an in-memory object for CspmMonitorGithubOffering. + +## SYNTAX + +``` +New-AzSecurityCspmMonitorGithubOfferingObject [] +``` + +## DESCRIPTION +Create an in-memory object for CspmMonitorGithubOffering. + +## EXAMPLES + +### EXAMPLE 1 +``` +New-AzSecurityCspmMonitorGithubOfferingObject +``` + +## PARAMETERS + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.CspmMonitorGithubOffering +## NOTES + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritycspmmonitorgithubofferingobject](https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritycspmmonitorgithubofferingobject) + diff --git a/src/Security/Security/help/New-AzSecurityDefenderCspmAwsOfferingObject.md b/src/Security/Security/help/New-AzSecurityDefenderCspmAwsOfferingObject.md new file mode 100644 index 000000000000..e0289502d0a9 --- /dev/null +++ b/src/Security/Security/help/New-AzSecurityDefenderCspmAwsOfferingObject.md @@ -0,0 +1,293 @@ +--- +external help file: Az.Security-help.xml +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritydefendercspmawsofferingobject +schema: 2.0.0 +--- + +# New-AzSecurityDefenderCspmAwsOfferingObject + +## SYNOPSIS +Create an in-memory object for DefenderCspmAwsOffering. + +## SYNTAX + +``` +New-AzSecurityDefenderCspmAwsOfferingObject [-CiemDiscoveryCloudRoleArn ] + [-CiemOidcAzureActiveDirectoryAppName ] [-CiemOidcCloudRoleArn ] + [-ConfigurationCloudRoleArn ] + [-ConfigurationExclusionTag ] + [-ConfigurationScanningMode ] [-DataSensitivityDiscoveryCloudRoleArn ] + [-DataSensitivityDiscoveryEnabled ] [-DatabaseDspmCloudRoleArn ] + [-DatabaseDspmEnabled ] [-MdcContainerAgentlessDiscoveryK8SCloudRoleArn ] + [-MdcContainerAgentlessDiscoveryK8SEnabled ] [-MdcContainerImageAssessmentCloudRoleArn ] + [-MdcContainerImageAssessmentEnabled ] [-VMScannerEnabled ] [] +``` + +## DESCRIPTION +Create an in-memory object for DefenderCspmAwsOffering. + +## EXAMPLES + +### EXAMPLE 1 +``` +$arnPrefix = "arn:aws:iam::123456789012:role" +``` + +New-AzSecurityDefenderCspmAwsOfferingObject \` + -VMScannerEnabled $true -ConfigurationScanningMode Default -ConfigurationCloudRoleArn "$arnPrefix/DefenderForCloud-AgentlessScanner" -ConfigurationExclusionTag @{key="value"} \` + -DataSensitivityDiscoveryEnabled $true -DataSensitivityDiscoveryCloudRoleArn "$arnPrefix/SensitiveDataDiscovery" \` + -DatabaseDspmEnabled $true -DatabaseDspmCloudRoleArn "$arnPrefix/DefenderForCloud-DataSecurityPostureDB" \` + -CiemDiscoveryCloudRoleArn "$arnPrefix/DefenderForCloud-Ciem" -CiemOidcAzureActiveDirectoryAppName "mciem-aws-oidc-connector" -CiemOidcCloudRoleArn "$arnPrefix/DefenderForCloud-OidcCiem" \` + -MdcContainerImageAssessmentEnabled $true -MdcContainerImageAssessmentCloudRoleArn "$arnPrefix/MDCContainersImageAssessmentRole" \` + -MdcContainerAgentlessDiscoveryK8SEnabled $true -MdcContainerAgentlessDiscoveryK8SCloudRoleArn "$arnPrefix/MDCContainersAgentlessDiscoveryK8sRole" + +## PARAMETERS + +### -CiemDiscoveryCloudRoleArn +The cloud role ARN in AWS for CIEM discovery. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -CiemOidcAzureActiveDirectoryAppName +the azure active directory app name used of authenticating against AWS. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -CiemOidcCloudRoleArn +The cloud role ARN in AWS for CIEM oidc connection. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ConfigurationCloudRoleArn +The cloud role ARN in AWS for this feature. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ConfigurationExclusionTag +VM tags that indicates that VM should not be scanned. +. + +```yaml +Type: IDefenderCspmAwsOfferingVMScannersConfigurationExclusionTags +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ConfigurationScanningMode +The scanning mode for the VM scan. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DatabaseDspmCloudRoleArn +The cloud role ARN in AWS for this feature. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DatabaseDspmEnabled +Is databases DSPM protection enabled. + +```yaml +Type: Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DataSensitivityDiscoveryCloudRoleArn +The cloud role ARN in AWS for this feature. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DataSensitivityDiscoveryEnabled +Is Microsoft Defender Data Sensitivity discovery enabled. + +```yaml +Type: Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -MdcContainerAgentlessDiscoveryK8SCloudRoleArn +The cloud role ARN in AWS for this feature. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -MdcContainerAgentlessDiscoveryK8SEnabled +Is Microsoft Defender container agentless discovery K8s enabled. + +```yaml +Type: Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -MdcContainerImageAssessmentCloudRoleArn +The cloud role ARN in AWS for this feature. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -MdcContainerImageAssessmentEnabled +Is Microsoft Defender container image assessment enabled. + +```yaml +Type: Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -VMScannerEnabled +Is Microsoft Defender for Server VM scanning enabled. + +```yaml +Type: Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmAwsOffering +## NOTES +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. +For information on hash tables, run Get-Help about_Hash_Tables. + +CONFIGURATIONEXCLUSIONTAG \: VM tags that indicates that VM should not be scanned. + \[(Any) \\]: This indicates any property can be added to this object. + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritydefendercspmawsofferingobject](https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritydefendercspmawsofferingobject) + diff --git a/src/Security/Security/help/New-AzSecurityDefenderCspmGcpOfferingObject.md b/src/Security/Security/help/New-AzSecurityDefenderCspmGcpOfferingObject.md new file mode 100644 index 000000000000..8af913f5bf09 --- /dev/null +++ b/src/Security/Security/help/New-AzSecurityDefenderCspmGcpOfferingObject.md @@ -0,0 +1,296 @@ +--- +external help file: Az.Security-help.xml +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritydefendercspmgcpofferingobject +schema: 2.0.0 +--- + +# New-AzSecurityDefenderCspmGcpOfferingObject + +## SYNOPSIS +Create an in-memory object for DefenderCspmGcpOffering. + +## SYNTAX + +``` +New-AzSecurityDefenderCspmGcpOfferingObject [-CiemDiscoveryAzureActiveDirectoryAppName ] + [-CiemDiscoveryServiceAccountEmailAddress ] [-CiemDiscoveryWorkloadIdentityProviderId ] + [-ConfigurationExclusionTag ] + [-ConfigurationScanningMode ] [-DataSensitivityDiscoveryEnabled ] + [-DataSensitivityDiscoveryServiceAccountEmailAddress ] + [-DataSensitivityDiscoveryWorkloadIdentityProviderId ] + [-MdcContainerAgentlessDiscoveryK8SEnabled ] + [-MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress ] + [-MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId ] + [-MdcContainerImageAssessmentEnabled ] + [-MdcContainerImageAssessmentServiceAccountEmailAddress ] + [-MdcContainerImageAssessmentWorkloadIdentityProviderId ] [-VMScannerEnabled ] + [] +``` + +## DESCRIPTION +Create an in-memory object for DefenderCspmGcpOffering. + +## EXAMPLES + +### EXAMPLE 1 +``` +$emailSuffix = "myproject.iam.gserviceaccount.com" +``` + +New-AzSecurityDefenderCspmGcpOfferingObject \` + -VMScannerEnabled $true -ConfigurationScanningMode Default -ConfigurationExclusionTag @{key="value"} \` + -MdcContainerAgentlessDiscoveryK8SEnabled $true -MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress "mdc-containers-k8s-operator@$emailSuffix" -MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId "containers" \` + -MdcContainerImageAssessmentEnabled $true -MdcContainerImageAssessmentServiceAccountEmailAddress "mdc-containers-artifact-assess@$emailSuffix" -MdcContainerImageAssessmentWorkloadIdentityProviderId "containers" \` + -DataSensitivityDiscoveryEnabled $true -DataSensitivityDiscoveryServiceAccountEmailAddress "mdc-data-sec-posture-storage@$emailSuffix" -DataSensitivityDiscoveryWorkloadIdentityProviderId "data-security-posture-storage" \` + -CiemDiscoveryServiceAccountEmailAddress "microsoft-defender-ciem@$emailSuffix" -CiemDiscoveryAzureActiveDirectoryAppName "mciem-gcp-oidc-app" -CiemDiscoveryWorkloadIdentityProviderId "ciem-discovery" + +## PARAMETERS + +### -CiemDiscoveryAzureActiveDirectoryAppName +the azure active directory app name used of authenticating against GCP workload identity federation. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -CiemDiscoveryServiceAccountEmailAddress +The service account email address in GCP for CIEM discovery offering. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -CiemDiscoveryWorkloadIdentityProviderId +The GCP workload identity provider id for CIEM discovery offering. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ConfigurationExclusionTag +VM tags that indicates that VM should not be scanned. +. + +```yaml +Type: IDefenderCspmGcpOfferingVMScannersConfigurationExclusionTags +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ConfigurationScanningMode +The scanning mode for the VM scan. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DataSensitivityDiscoveryEnabled +Is Microsoft Defender Data Sensitivity discovery enabled. + +```yaml +Type: Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DataSensitivityDiscoveryServiceAccountEmailAddress +The service account email address in GCP for this feature. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DataSensitivityDiscoveryWorkloadIdentityProviderId +The workload identity provider id in GCP for this feature. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -MdcContainerAgentlessDiscoveryK8SEnabled +Is Microsoft Defender container agentless discovery enabled. + +```yaml +Type: Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress +The service account email address in GCP for this feature. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId +The workload identity provider id in GCP for this feature. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -MdcContainerImageAssessmentEnabled +Is Microsoft Defender container image assessment enabled. + +```yaml +Type: Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -MdcContainerImageAssessmentServiceAccountEmailAddress +The service account email address in GCP for this feature. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -MdcContainerImageAssessmentWorkloadIdentityProviderId +The workload identity provider id in GCP for this feature. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -VMScannerEnabled +Is Microsoft Defender for Server VM scanning enabled. + +```yaml +Type: Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderCspmGcpOffering +## NOTES +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. +For information on hash tables, run Get-Help about_Hash_Tables. + +CONFIGURATIONEXCLUSIONTAG \: VM tags that indicates that VM should not be scanned. + \[(Any) \\]: This indicates any property can be added to this object. + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritydefendercspmgcpofferingobject](https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritydefendercspmgcpofferingobject) + diff --git a/src/Security/Security/help/New-AzSecurityDefenderForContainersAwsOfferingObject.md b/src/Security/Security/help/New-AzSecurityDefenderForContainersAwsOfferingObject.md new file mode 100644 index 000000000000..abedb57af0e9 --- /dev/null +++ b/src/Security/Security/help/New-AzSecurityDefenderForContainersAwsOfferingObject.md @@ -0,0 +1,269 @@ +--- +external help file: Az.Security-help.xml +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritydefenderforcontainersawsofferingobject +schema: 2.0.0 +--- + +# New-AzSecurityDefenderForContainersAwsOfferingObject + +## SYNOPSIS +Create an in-memory object for DefenderForContainersAwsOffering. + +## SYNTAX + +``` +New-AzSecurityDefenderForContainersAwsOfferingObject [-AutoProvisioning ] + [-CloudWatchToKinesiCloudRoleArn ] [-ContainerVulnerabilityAssessmentCloudRoleArn ] + [-ContainerVulnerabilityAssessmentTaskCloudRoleArn ] + [-EnableContainerVulnerabilityAssessment ] [-KinesiToS3CloudRoleArn ] + [-KubeAuditRetentionTime ] [-KuberneteScubaReaderCloudRoleArn ] + [-KuberneteServiceCloudRoleArn ] [-MdcContainerAgentlessDiscoveryK8SCloudRoleArn ] + [-MdcContainerAgentlessDiscoveryK8SEnabled ] [-MdcContainerImageAssessmentCloudRoleArn ] + [-MdcContainerImageAssessmentEnabled ] [-ScubaExternalId ] [] +``` + +## DESCRIPTION +Create an in-memory object for DefenderForContainersAwsOffering. + +## EXAMPLES + +### EXAMPLE 1 +``` +$arnPrefix = "arn:aws:iam::123456789012:role" +``` + +New-AzSecurityDefenderForContainersAwsOfferingObject \` + -AutoProvisioning $true -KuberneteServiceCloudRoleArn "$arnPrefix/DefenderForCloud-Containers-K8s" -KuberneteScubaReaderCloudRoleArn "$arnPrefix/DefenderForCloud-DataCollection" \` + -KinesiToS3CloudRoleArn "$arnPrefix/DefenderForCloud-Containers-K8s-kinesis-to-s3" -CloudWatchToKinesiCloudRoleArn "$arnPrefix/DefenderForCloud-Containers-K8s-cloudwatch-to-kinesis" \` + -KubeAuditRetentionTime 30 -ScubaExternalId "a47ae0a2-7bf7-482a-897a-7a139d30736c" \` + -MdcContainerAgentlessDiscoveryK8SEnabled $true -MdcContainerAgentlessDiscoveryK8SCloudRoleArn "$arnPrefix/MDCContainersAgentlessDiscoveryK8sRole" \` + -MdcContainerImageAssessmentEnabled $true -MdcContainerImageAssessmentCloudRoleArn "$arnPrefix/MDCContainersImageAssessmentRole" \` + -EnableContainerVulnerabilityAssessment $false + +## PARAMETERS + +### -AutoProvisioning +Is audit logs pipeline auto provisioning enabled. + +```yaml +Type: Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -CloudWatchToKinesiCloudRoleArn +The cloud role ARN in AWS used by CloudWatch to transfer data into Kinesis. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ContainerVulnerabilityAssessmentCloudRoleArn +The cloud role ARN in AWS for this feature. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ContainerVulnerabilityAssessmentTaskCloudRoleArn +The cloud role ARN in AWS for this feature. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -EnableContainerVulnerabilityAssessment +Enable container vulnerability assessment feature. + +```yaml +Type: Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -KinesiToS3CloudRoleArn +The cloud role ARN in AWS used by Kinesis to transfer data into S3. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -KubeAuditRetentionTime +The retention time in days of kube audit logs set on the CloudWatch log group. + +```yaml +Type: Int64 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: 0 +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -KuberneteScubaReaderCloudRoleArn +The cloud role ARN in AWS for this feature used for reading data. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -KuberneteServiceCloudRoleArn +The cloud role ARN in AWS for this feature used for provisioning resources. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -MdcContainerAgentlessDiscoveryK8SCloudRoleArn +The cloud role ARN in AWS for this feature. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -MdcContainerAgentlessDiscoveryK8SEnabled +Is Microsoft Defender container agentless discovery K8s enabled. + +```yaml +Type: Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -MdcContainerImageAssessmentCloudRoleArn +The cloud role ARN in AWS for this feature. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -MdcContainerImageAssessmentEnabled +Is Microsoft Defender container image assessment enabled. + +```yaml +Type: Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ScubaExternalId +The externalId used by the data reader to prevent the confused deputy attack. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersAwsOffering +## NOTES + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritydefenderforcontainersawsofferingobject](https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritydefenderforcontainersawsofferingobject) + diff --git a/src/Security/Security/help/New-AzSecurityDefenderForContainersGcpOfferingObject.md b/src/Security/Security/help/New-AzSecurityDefenderForContainersGcpOfferingObject.md new file mode 100644 index 000000000000..891cccbe4d07 --- /dev/null +++ b/src/Security/Security/help/New-AzSecurityDefenderForContainersGcpOfferingObject.md @@ -0,0 +1,257 @@ +--- +external help file: Az.Security-help.xml +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritydefenderforcontainersgcpofferingobject +schema: 2.0.0 +--- + +# New-AzSecurityDefenderForContainersGcpOfferingObject + +## SYNOPSIS +Create an in-memory object for DefenderForContainersGcpOffering. + +## SYNTAX + +``` +New-AzSecurityDefenderForContainersGcpOfferingObject [-AuditLogsAutoProvisioningFlag ] + [-DataPipelineNativeCloudConnectionServiceAccountEmailAddress ] + [-DataPipelineNativeCloudConnectionWorkloadIdentityProviderId ] + [-DefenderAgentAutoProvisioningFlag ] [-MdcContainerAgentlessDiscoveryK8SEnabled ] + [-MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress ] + [-MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId ] + [-MdcContainerImageAssessmentEnabled ] + [-MdcContainerImageAssessmentServiceAccountEmailAddress ] + [-MdcContainerImageAssessmentWorkloadIdentityProviderId ] + [-NativeCloudConnectionServiceAccountEmailAddress ] + [-NativeCloudConnectionWorkloadIdentityProviderId ] [-PolicyAgentAutoProvisioningFlag ] + [] +``` + +## DESCRIPTION +Create an in-memory object for DefenderForContainersGcpOffering. + +## EXAMPLES + +### EXAMPLE 1 +``` +$emailSuffix = "myproject.iam.gserviceaccount.com" +``` + +New-AzSecurityDefenderForContainersGcpOfferingObject \` + -NativeCloudConnectionServiceAccountEmailAddress "microsoft-defender-containers@$emailSuffix" -NativeCloudConnectionWorkloadIdentityProviderId "containers" \` + -DataPipelineNativeCloudConnectionServiceAccountEmailAddress "ms-defender-containers-stream@$emailSuffix" -DataPipelineNativeCloudConnectionWorkloadIdentityProviderId "containers-streams" \` + -AuditLogsAutoProvisioningFlag $true -DefenderAgentAutoProvisioningFlag $true -PolicyAgentAutoProvisioningFlag $true \` + -MdcContainerAgentlessDiscoveryK8SEnabled $true -MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId "containers" -MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress "mdc-containers-k8s-operator@$emailSuffix" \` + -MdcContainerImageAssessmentEnabled $true -MdcContainerImageAssessmentWorkloadIdentityProviderId "containers" -MdcContainerImageAssessmentServiceAccountEmailAddress "mdc-containers-artifact-assess@$emailSuffix" + +## PARAMETERS + +### -AuditLogsAutoProvisioningFlag +Is audit logs data collection enabled. + +```yaml +Type: Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DataPipelineNativeCloudConnectionServiceAccountEmailAddress +The data collection service account email address in GCP for this offering. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DataPipelineNativeCloudConnectionWorkloadIdentityProviderId +The data collection GCP workload identity provider id for this offering. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefenderAgentAutoProvisioningFlag +Is Microsoft Defender for Cloud Kubernetes agent auto provisioning enabled. + +```yaml +Type: Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -MdcContainerAgentlessDiscoveryK8SEnabled +Is Microsoft Defender container agentless discovery enabled. + +```yaml +Type: Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -MdcContainerAgentlessDiscoveryK8SServiceAccountEmailAddress +The service account email address in GCP for this feature. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -MdcContainerAgentlessDiscoveryK8SWorkloadIdentityProviderId +The workload identity provider id in GCP for this feature. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -MdcContainerImageAssessmentEnabled +Is Microsoft Defender container image assessment enabled. + +```yaml +Type: Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -MdcContainerImageAssessmentServiceAccountEmailAddress +The service account email address in GCP for this feature. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -MdcContainerImageAssessmentWorkloadIdentityProviderId +The workload identity provider id in GCP for this feature. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NativeCloudConnectionServiceAccountEmailAddress +The service account email address in GCP for this offering. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NativeCloudConnectionWorkloadIdentityProviderId +The GCP workload identity provider id for this offering. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PolicyAgentAutoProvisioningFlag +Is Policy Kubernetes agent auto provisioning enabled. + +```yaml +Type: Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForContainersGcpOffering +## NOTES + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritydefenderforcontainersgcpofferingobject](https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritydefenderforcontainersgcpofferingobject) + diff --git a/src/Security/Security/help/New-AzSecurityDefenderForDatabasesAwsOfferingObject.md b/src/Security/Security/help/New-AzSecurityDefenderForDatabasesAwsOfferingObject.md new file mode 100644 index 000000000000..fceb2ff0e80c --- /dev/null +++ b/src/Security/Security/help/New-AzSecurityDefenderForDatabasesAwsOfferingObject.md @@ -0,0 +1,171 @@ +--- +external help file: Az.Security-help.xml +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritydefenderfordatabasesawsofferingobject +schema: 2.0.0 +--- + +# New-AzSecurityDefenderForDatabasesAwsOfferingObject + +## SYNOPSIS +Create an in-memory object for DefenderForDatabasesAwsOffering. + +## SYNTAX + +``` +New-AzSecurityDefenderForDatabasesAwsOfferingObject [-ArcAutoProvisioningCloudRoleArn ] + [-ArcAutoProvisioningEnabled ] [-ConfigurationPrivateLinkScope ] + [-ConfigurationProxy ] [-DatabaseDspmCloudRoleArn ] [-DatabaseDspmEnabled ] + [-RdCloudRoleArn ] [-RdEnabled ] [] +``` + +## DESCRIPTION +Create an in-memory object for DefenderForDatabasesAwsOffering. + +## EXAMPLES + +### EXAMPLE 1 +``` +$arnPrefix = "arn:aws:iam::123456789012:role" +``` + +New-AzSecurityDefenderForDatabasesAwsOfferingObject \` + -ArcAutoProvisioningEnabled $true -ArcAutoProvisioningCloudRoleArn "$arnPrefix/DefenderForCloud-ArcAutoProvisioning" \` + -DatabaseDspmEnabled $true -DatabaseDspmCloudRoleArn "$arnPrefix/DefenderForCloud-DataSecurityPostureDB" + +## PARAMETERS + +### -ArcAutoProvisioningCloudRoleArn +The cloud role ARN in AWS for this feature. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ArcAutoProvisioningEnabled +Is arc auto provisioning enabled. + +```yaml +Type: Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ConfigurationPrivateLinkScope +Optional Arc private link scope resource id to link the Arc agent. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ConfigurationProxy +Optional http proxy endpoint to use for the Arc agent. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DatabaseDspmCloudRoleArn +The cloud role ARN in AWS for this feature. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DatabaseDspmEnabled +Is databases data security posture management (DSPM) protection enabled. + +```yaml +Type: Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -RdCloudRoleArn +The cloud role ARN in AWS for this feature. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -RdEnabled +Is RDS protection enabled. + +```yaml +Type: Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForDatabasesAwsOffering +## NOTES + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritydefenderfordatabasesawsofferingobject](https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritydefenderfordatabasesawsofferingobject) + diff --git a/src/Security/Security/help/New-AzSecurityDefenderForDatabasesGcpOfferingObject.md b/src/Security/Security/help/New-AzSecurityDefenderForDatabasesGcpOfferingObject.md new file mode 100644 index 000000000000..a5d316c37e3d --- /dev/null +++ b/src/Security/Security/help/New-AzSecurityDefenderForDatabasesGcpOfferingObject.md @@ -0,0 +1,126 @@ +--- +external help file: Az.Security-help.xml +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritydefenderfordatabasesgcpofferingobject +schema: 2.0.0 +--- + +# New-AzSecurityDefenderForDatabasesGcpOfferingObject + +## SYNOPSIS +Create an in-memory object for DefenderForDatabasesGcpOffering. + +## SYNTAX + +``` +New-AzSecurityDefenderForDatabasesGcpOfferingObject [-ArcAutoProvisioningEnabled ] + [-ConfigurationPrivateLinkScope ] [-ConfigurationProxy ] + [-DefenderForDatabaseArcAutoProvisioningServiceAccountEmailAddress ] + [-DefenderForDatabaseArcAutoProvisioningWorkloadIdentityProviderId ] [] +``` + +## DESCRIPTION +Create an in-memory object for DefenderForDatabasesGcpOffering. + +## EXAMPLES + +### EXAMPLE 1 +``` +$emailSuffix = "myproject.iam.gserviceaccount.com" +``` + +New-AzSecurityDefenderForDatabasesGcpOfferingObject \` + -ArcAutoProvisioningEnabled $true \` + -DefenderForDatabaseArcAutoProvisioningServiceAccountEmailAddress "microsoft-databases-arc-ap@" -DefenderForDatabaseArcAutoProvisioningWorkloadIdentityProviderId "defender-for-databases-arc-ap" + +## PARAMETERS + +### -ArcAutoProvisioningEnabled +Is arc auto provisioning enabled. + +```yaml +Type: Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ConfigurationPrivateLinkScope +Optional Arc private link scope resource id to link the Arc agent. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ConfigurationProxy +Optional http proxy endpoint to use for the Arc agent. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefenderForDatabaseArcAutoProvisioningServiceAccountEmailAddress +The service account email address in GCP for this offering. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefenderForDatabaseArcAutoProvisioningWorkloadIdentityProviderId +The GCP workload identity provider id for this offering. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForDatabasesGcpOffering +## NOTES + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritydefenderfordatabasesgcpofferingobject](https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritydefenderfordatabasesgcpofferingobject) + diff --git a/src/Security/Security/help/New-AzSecurityDefenderForServersAwsOfferingObject.md b/src/Security/Security/help/New-AzSecurityDefenderForServersAwsOfferingObject.md new file mode 100644 index 000000000000..0baaad07ee71 --- /dev/null +++ b/src/Security/Security/help/New-AzSecurityDefenderForServersAwsOfferingObject.md @@ -0,0 +1,277 @@ +--- +external help file: Az.Security-help.xml +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritydefenderforserversawsofferingobject +schema: 2.0.0 +--- + +# New-AzSecurityDefenderForServersAwsOfferingObject + +## SYNOPSIS +Create an in-memory object for DefenderForServersAwsOffering. + +## SYNTAX + +``` +New-AzSecurityDefenderForServersAwsOfferingObject [-ArcAutoProvisioningCloudRoleArn ] + [-ArcAutoProvisioningEnabled ] [-ConfigurationCloudRoleArn ] + [-ConfigurationExclusionTag ] + [-ConfigurationPrivateLinkScope ] [-ConfigurationProxy ] [-ConfigurationScanningMode ] + [-ConfigurationType ] [-DefenderForServerCloudRoleArn ] + [-MdeAutoProvisioningConfiguration ] [-MdeAutoProvisioningEnabled ] [-SubPlanType ] + [-VMScannerEnabled ] [-VaAutoProvisioningEnabled ] [] +``` + +## DESCRIPTION +Create an in-memory object for DefenderForServersAwsOffering. + +## EXAMPLES + +### EXAMPLE 1 +``` +$arnPrefix = "arn:aws:iam::123456789012:role" +``` + +New-AzSecurityDefenderForServersAwsOfferingObject \` + -DefenderForServerCloudRoleArn "$arnPrefix/DefenderForCloud-DefenderForServers" \` + -ArcAutoProvisioningEnabled $true -ArcAutoProvisioningCloudRoleArn "$arnPrefix/DefenderForCloud-ArcAutoProvisioning" \` + -MdeAutoProvisioningEnabled $true \` + -VaAutoProvisioningEnabled $true -ConfigurationType TVM \` + -VMScannerEnabled $true -ConfigurationCloudRoleArn "$arnPrefix/DefenderForCloud-AgentlessScanner" -ConfigurationScanningMode Default \` + -SubPlanType P2 + +## PARAMETERS + +### -ArcAutoProvisioningCloudRoleArn +The cloud role ARN in AWS for this feature. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ArcAutoProvisioningEnabled +Is arc auto provisioning enabled. + +```yaml +Type: Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ConfigurationCloudRoleArn +The cloud role ARN in AWS for this feature. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ConfigurationExclusionTag +VM tags that indicates that VM should not be scanned. +. + +```yaml +Type: IDefenderForServersAwsOfferingVMScannersConfigurationExclusionTags +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ConfigurationPrivateLinkScope +Optional Arc private link scope resource id to link the Arc agent. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ConfigurationProxy +Optional HTTP proxy endpoint to use for the Arc agent. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ConfigurationScanningMode +The scanning mode for the VM scan. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ConfigurationType +The Vulnerability Assessment solution to be provisioned. +Can be either 'TVM' or 'Qualys'. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefenderForServerCloudRoleArn +The cloud role ARN in AWS for this feature. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -MdeAutoProvisioningConfiguration +configuration for Microsoft Defender for Endpoint autoprovisioning. + +```yaml +Type: IAny +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -MdeAutoProvisioningEnabled +Is Microsoft Defender for Endpoint auto provisioning enabled. + +```yaml +Type: Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubPlanType +The available sub plans. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -VaAutoProvisioningEnabled +Is Vulnerability Assessment auto provisioning enabled. + +```yaml +Type: Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -VMScannerEnabled +Is Microsoft Defender for Server VM scanning enabled. + +```yaml +Type: Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersAwsOffering +## NOTES +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. +For information on hash tables, run Get-Help about_Hash_Tables. + +CONFIGURATIONEXCLUSIONTAG \: VM tags that indicates that VM should not be scanned. + \[(Any) \\]: This indicates any property can be added to this object. + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritydefenderforserversawsofferingobject](https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritydefenderforserversawsofferingobject) + diff --git a/src/Security/Security/help/New-AzSecurityDefenderForServersGcpOfferingObject.md b/src/Security/Security/help/New-AzSecurityDefenderForServersGcpOfferingObject.md new file mode 100644 index 000000000000..65237450abf7 --- /dev/null +++ b/src/Security/Security/help/New-AzSecurityDefenderForServersGcpOfferingObject.md @@ -0,0 +1,260 @@ +--- +external help file: Az.Security-help.xml +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritydefenderforserversgcpofferingobject +schema: 2.0.0 +--- + +# New-AzSecurityDefenderForServersGcpOfferingObject + +## SYNOPSIS +Create an in-memory object for DefenderForServersGcpOffering. + +## SYNTAX + +``` +New-AzSecurityDefenderForServersGcpOfferingObject [-ArcAutoProvisioningEnabled ] + [-ConfigurationExclusionTag ] + [-ConfigurationPrivateLinkScope ] [-ConfigurationProxy ] [-ConfigurationScanningMode ] + [-ConfigurationType ] [-DefenderForServerServiceAccountEmailAddress ] + [-DefenderForServerWorkloadIdentityProviderId ] [-MdeAutoProvisioningConfiguration ] + [-MdeAutoProvisioningEnabled ] [-SubPlanType ] [-VMScannerEnabled ] + [-VaAutoProvisioningEnabled ] [] +``` + +## DESCRIPTION +Create an in-memory object for DefenderForServersGcpOffering. + +## EXAMPLES + +### EXAMPLE 1 +``` +$emailSuffix = "myproject.iam.gserviceaccount.com" +``` + +New-AzSecurityDefenderForServersGcpOfferingObject \` + -DefenderForServerServiceAccountEmailAddress "microsoft-defender-for-servers@$emailSuffix" -DefenderForServerWorkloadIdentityProviderId "defender-for-servers" \` + -ArcAutoProvisioningEnabled $true -MdeAutoProvisioningEnabled $true -VaAutoProvisioningEnabled $true -ConfigurationType TVM \` + -VMScannerEnabled $true -ConfigurationScanningMode Default \` + -SubPlanType P2 + +## PARAMETERS + +### -ArcAutoProvisioningEnabled +Is arc auto provisioning enabled. + +```yaml +Type: Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ConfigurationExclusionTag +VM tags that indicate that VM should not be scanned. +. + +```yaml +Type: IDefenderForServersGcpOfferingVMScannersConfigurationExclusionTags +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ConfigurationPrivateLinkScope +Optional Arc private link scope resource id to link the Arc agent. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ConfigurationProxy +Optional HTTP proxy endpoint to use for the Arc agent. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ConfigurationScanningMode +The scanning mode for the VM scan. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ConfigurationType +The Vulnerability Assessment solution to be provisioned. +Can be either 'TVM' or 'Qualys'. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefenderForServerServiceAccountEmailAddress +The service account email address in GCP for this feature. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefenderForServerWorkloadIdentityProviderId +The workload identity provider id in GCP for this feature. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -MdeAutoProvisioningConfiguration +configuration for Microsoft Defender for Endpoint autoprovisioning. + +```yaml +Type: IAny +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -MdeAutoProvisioningEnabled +Is Microsoft Defender for Endpoint auto provisioning enabled. + +```yaml +Type: Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubPlanType +The available sub plans. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -VaAutoProvisioningEnabled +Is Vulnerability Assessment auto provisioning enabled. + +```yaml +Type: Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -VMScannerEnabled +Is Microsoft Defender for Server VM scanning enabled. + +```yaml +Type: Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.DefenderForServersGcpOffering +## NOTES +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. +For information on hash tables, run Get-Help about_Hash_Tables. + +CONFIGURATIONEXCLUSIONTAG \: VM tags that indicate that VM should not be scanned. + \[(Any) \\]: This indicates any property can be added to this object. + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritydefenderforserversgcpofferingobject](https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritydefenderforserversgcpofferingobject) + diff --git a/src/Security/Security/help/New-AzSecurityGcpOrganizationalDataMemberObject.md b/src/Security/Security/help/New-AzSecurityGcpOrganizationalDataMemberObject.md new file mode 100644 index 000000000000..67ce394c68b4 --- /dev/null +++ b/src/Security/Security/help/New-AzSecurityGcpOrganizationalDataMemberObject.md @@ -0,0 +1,75 @@ +--- +external help file: Az.Security-help.xml +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritygcporganizationaldatamemberobject +schema: 2.0.0 +--- + +# New-AzSecurityGcpOrganizationalDataMemberObject + +## SYNOPSIS +Create an in-memory object for GcpOrganizationalDataMember. + +## SYNTAX + +``` +New-AzSecurityGcpOrganizationalDataMemberObject [-ManagementProjectNumber ] + [-ParentHierarchyId ] [] +``` + +## DESCRIPTION +Create an in-memory object for GcpOrganizationalDataMember. + +## EXAMPLES + +### EXAMPLE 1 +``` +New-AzSecurityGcpOrganizationalDataMemberObject -ManagementProjectNumber "12345" -ParentHierarchyId "00000" +``` + +## PARAMETERS + +### -ManagementProjectNumber +The GCP management project number from organizational onboarding. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ParentHierarchyId +If the multi cloud account is not of membership type organization, this will be the ID of the project's parent. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GcpOrganizationalDataMember +## NOTES + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritygcporganizationaldatamemberobject](https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritygcporganizationaldatamemberobject) + diff --git a/src/Security/Security/help/New-AzSecurityGcpOrganizationalDataOrganizationObject.md b/src/Security/Security/help/New-AzSecurityGcpOrganizationalDataOrganizationObject.md new file mode 100644 index 000000000000..63069e877dd6 --- /dev/null +++ b/src/Security/Security/help/New-AzSecurityGcpOrganizationalDataOrganizationObject.md @@ -0,0 +1,90 @@ +--- +external help file: Az.Security-help.xml +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritygcporganizationaldataorganizationobject +schema: 2.0.0 +--- + +# New-AzSecurityGcpOrganizationalDataOrganizationObject + +## SYNOPSIS +Create an in-memory object for GcpOrganizationalDataOrganization. + +## SYNTAX + +``` +New-AzSecurityGcpOrganizationalDataOrganizationObject [-ExcludedProjectNumber ] + [-ServiceAccountEmailAddress ] [-WorkloadIdentityProviderId ] [] +``` + +## DESCRIPTION +Create an in-memory object for GcpOrganizationalDataOrganization. + +## EXAMPLES + +### EXAMPLE 1 +``` +New-AzSecurityGcpOrganizationalDataOrganizationObject -WorkloadIdentityProviderId "provider" -ServiceAccountEmailAddress "my@email.com" -ExcludedProjectNumber @(1,2) +``` + +## PARAMETERS + +### -ExcludedProjectNumber +If the multi cloud account is of membership type organization, list of accounts excluded from offering. + +```yaml +Type: String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ServiceAccountEmailAddress +The service account email address which represents the organization level permissions container. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WorkloadIdentityProviderId +The GCP workload identity provider id which represents the permissions required to auto provision security connectors. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GcpOrganizationalDataOrganization +## NOTES + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritygcporganizationaldataorganizationobject](https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritygcporganizationaldataorganizationobject) + diff --git a/src/Security/Security/help/New-AzSecurityGcpProjectEnvironmentObject.md b/src/Security/Security/help/New-AzSecurityGcpProjectEnvironmentObject.md new file mode 100644 index 000000000000..12e075677513 --- /dev/null +++ b/src/Security/Security/help/New-AzSecurityGcpProjectEnvironmentObject.md @@ -0,0 +1,116 @@ +--- +external help file: Az.Security-help.xml +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritygcpprojectenvironmentobject +schema: 2.0.0 +--- + +# New-AzSecurityGcpProjectEnvironmentObject + +## SYNOPSIS +Create an in-memory object for GcpProjectEnvironment. + +## SYNTAX + +``` +New-AzSecurityGcpProjectEnvironmentObject [-OrganizationalData ] + [-ProjectDetailProjectId ] [-ProjectDetailProjectNumber ] [-ScanInterval ] + [] +``` + +## DESCRIPTION +Create an in-memory object for GcpProjectEnvironment. + +## EXAMPLES + +### EXAMPLE 1 +``` +$orgData = New-AzSecurityGcpOrganizationalDataOrganizationObject -WorkloadIdentityProviderId "provider" -ServiceAccountEmailAddress "my@email.com" -ExcludedProjectNumber @(1,2) +``` + +New-AzSecurityGcpProjectEnvironmentObject -ProjectDetailProjectId "asc-sdk-samples" -ScanInterval 24 -OrganizationalData $orgData -ProjectDetailProjectNumber "1234" + +## PARAMETERS + +### -OrganizationalData +The Gcp project's organizational data. +. + +```yaml +Type: IGcpOrganizationalData +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProjectDetailProjectId +The GCP Project id. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProjectDetailProjectNumber +The unique GCP Project number. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ScanInterval +Scan interval in hours (value should be between 1-hour to 24-hours). + +```yaml +Type: Int64 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: 0 +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GcpProjectEnvironment +## NOTES +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. +For information on hash tables, run Get-Help about_Hash_Tables. + +ORGANIZATIONALDATA \: The Gcp project's organizational data. + OrganizationMembershipType \: The multi cloud account's membership type in the organization + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritygcpprojectenvironmentobject](https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritygcpprojectenvironmentobject) + diff --git a/src/Security/Security/help/New-AzSecurityGitHubScopeEnvironmentObject.md b/src/Security/Security/help/New-AzSecurityGitHubScopeEnvironmentObject.md new file mode 100644 index 000000000000..101426b1293d --- /dev/null +++ b/src/Security/Security/help/New-AzSecurityGitHubScopeEnvironmentObject.md @@ -0,0 +1,44 @@ +--- +external help file: Az.Security-help.xml +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritygithubscopeenvironmentobject +schema: 2.0.0 +--- + +# New-AzSecurityGitHubScopeEnvironmentObject + +## SYNOPSIS +Create an in-memory object for GitHubScopeEnvironment. + +## SYNTAX + +``` +New-AzSecurityGitHubScopeEnvironmentObject [] +``` + +## DESCRIPTION +Create an in-memory object for GitHubScopeEnvironment. + +## EXAMPLES + +### EXAMPLE 1 +``` +New-AzSecurityGitHubScopeEnvironmentObject +``` + +## PARAMETERS + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitHubScopeEnvironment +## NOTES + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritygithubscopeenvironmentobject](https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritygithubscopeenvironmentobject) + diff --git a/src/Security/Security/help/New-AzSecurityGitLabScopeEnvironmentObject.md b/src/Security/Security/help/New-AzSecurityGitLabScopeEnvironmentObject.md new file mode 100644 index 000000000000..82865ef349ef --- /dev/null +++ b/src/Security/Security/help/New-AzSecurityGitLabScopeEnvironmentObject.md @@ -0,0 +1,44 @@ +--- +external help file: Az.Security-help.xml +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritygitlabscopeenvironmentobject +schema: 2.0.0 +--- + +# New-AzSecurityGitLabScopeEnvironmentObject + +## SYNOPSIS +Create an in-memory object for GitLabScopeEnvironment. + +## SYNTAX + +``` +New-AzSecurityGitLabScopeEnvironmentObject [] +``` + +## DESCRIPTION +Create an in-memory object for GitLabScopeEnvironment. + +## EXAMPLES + +### EXAMPLE 1 +``` +New-AzSecurityGitLabScopeEnvironmentObject +``` + +## PARAMETERS + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.GitLabScopeEnvironment +## NOTES + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritygitlabscopeenvironmentobject](https://learn.microsoft.com/powershell/module/Az.Security/new-azsecuritygitlabscopeenvironmentobject) + diff --git a/src/Security/Security/help/New-AzSecurityInformationProtectionAwsOfferingObject.md b/src/Security/Security/help/New-AzSecurityInformationProtectionAwsOfferingObject.md new file mode 100644 index 000000000000..b3e7a5e9f154 --- /dev/null +++ b/src/Security/Security/help/New-AzSecurityInformationProtectionAwsOfferingObject.md @@ -0,0 +1,60 @@ +--- +external help file: Az.Security-help.xml +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/Az.Security/new-azsecurityinformationprotectionawsofferingobject +schema: 2.0.0 +--- + +# New-AzSecurityInformationProtectionAwsOfferingObject + +## SYNOPSIS +Create an in-memory object for InformationProtectionAwsOffering. + +## SYNTAX + +``` +New-AzSecurityInformationProtectionAwsOfferingObject [-InformationProtectionCloudRoleArn ] + [] +``` + +## DESCRIPTION +Create an in-memory object for InformationProtectionAwsOffering. + +## EXAMPLES + +### EXAMPLE 1 +``` +New-AzSecurityInformationProtectionAwsOfferingObject -InformationProtectionCloudRoleArn "arn:aws:iam::123456789012:role/myRole" +``` + +## PARAMETERS + +### -InformationProtectionCloudRoleArn +The cloud role ARN in AWS for this feature. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.InformationProtectionAwsOffering +## NOTES + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/Az.Security/new-azsecurityinformationprotectionawsofferingobject](https://learn.microsoft.com/powershell/module/Az.Security/new-azsecurityinformationprotectionawsofferingobject) + diff --git a/src/Security/Security/help/Remove-AzSecurityConnector.md b/src/Security/Security/help/Remove-AzSecurityConnector.md new file mode 100644 index 000000000000..b5d148adaa29 --- /dev/null +++ b/src/Security/Security/help/Remove-AzSecurityConnector.md @@ -0,0 +1,198 @@ +--- +external help file: Az.Security-help.xml +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/az.security/remove-azsecurityconnector +schema: 2.0.0 +--- + +# Remove-AzSecurityConnector + +## SYNOPSIS +Deletes a security connector. + +## SYNTAX + +### Delete (Default) +``` +Remove-AzSecurityConnector -Name -ResourceGroupName [-SubscriptionId ] + [-DefaultProfile ] [-PassThru] [-WhatIf] [-Confirm] [] +``` + +### DeleteViaIdentity +``` +Remove-AzSecurityConnector -InputObject [-DefaultProfile ] [-PassThru] [-WhatIf] + [-Confirm] [] +``` + +## DESCRIPTION +Deletes a security connector. + +## EXAMPLES + +### EXAMPLE 1 +``` +Remove-AzSecurityConnector -ResourceGroupName "securityconnectors-pwsh-tmp" -Name "ado-sdk-pwsh-test03" +``` + +## PARAMETERS + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +. + +```yaml +Type: ISecurityIdentity +Parameter Sets: DeleteViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Name +The security connector name. + +```yaml +Type: String +Parameter Sets: Delete +Aliases: SecurityConnectorName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PassThru +Returns true when the command succeeds + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group within the user's subscription. +The name is case insensitive. + +```yaml +Type: String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure subscription ID + +```yaml +Type: String +Parameter Sets: Delete +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +## OUTPUTS + +### System.Boolean +## NOTES +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. +For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT \: Identity Parameter + \[ApiId \\]: API revision identifier. +Must be unique in the API Management service instance. +Non-current revision has ;rev=n as a suffix where n is the revision number. + \[GroupFqName \\]: The GitLab group fully-qualified name. + \[Id \\]: Resource identity path + \[OperationResultId \\]: The operation result Id. + \[OrgName \\]: The Azure DevOps organization name. + \[OwnerName \\]: The GitHub owner name. + \[ProjectName \\]: The project name. + \[RepoName \\]: The repository name. + \[ResourceGroupName \\]: The name of the resource group within the user's subscription. +The name is case insensitive. + \[SecurityConnectorName \\]: The security connector name. + \[ServiceName \\]: The name of the API Management service. + \[SubscriptionId \\]: Azure subscription ID + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/az.security/remove-azsecurityconnector](https://learn.microsoft.com/powershell/module/az.security/remove-azsecurityconnector) + diff --git a/src/Security/Security/help/Remove-AzSecurityConnectorDevOpsConfiguration.md b/src/Security/Security/help/Remove-AzSecurityConnectorDevOpsConfiguration.md new file mode 100644 index 000000000000..06435a17ab41 --- /dev/null +++ b/src/Security/Security/help/Remove-AzSecurityConnectorDevOpsConfiguration.md @@ -0,0 +1,229 @@ +--- +external help file: Az.Security-help.xml +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/az.security/remove-azsecurityconnectordevopsconfiguration +schema: 2.0.0 +--- + +# Remove-AzSecurityConnectorDevOpsConfiguration + +## SYNOPSIS +Deletes a DevOps Connector. + +## SYNTAX + +### Delete (Default) +``` +Remove-AzSecurityConnectorDevOpsConfiguration -ResourceGroupName -SecurityConnectorName + [-SubscriptionId ] [-DefaultProfile ] [-AsJob] [-NoWait] [-PassThru] [-WhatIf] [-Confirm] + [] +``` + +### DeleteViaIdentity +``` +Remove-AzSecurityConnectorDevOpsConfiguration -InputObject [-DefaultProfile ] + [-AsJob] [-NoWait] [-PassThru] [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION +Deletes a DevOps Connector. + +## EXAMPLES + +### EXAMPLE 1 +``` +Remove-AzSecurityConnectorDevOpsConfiguration -ResourceGroupName "securityconnectors-pwsh-tmp" -SecurityConnectorName "ado-sdk-pwsh-test03" +``` + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +. + +```yaml +Type: ISecurityIdentity +Parameter Sets: DeleteViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PassThru +Returns true when the command succeeds + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SecurityConnectorName +The security connector name. + +```yaml +Type: String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure subscription ID + +```yaml +Type: String +Parameter Sets: Delete +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +## OUTPUTS + +### System.Boolean +## NOTES +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. +For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT \: Identity Parameter + \[ApiId \\]: API revision identifier. +Must be unique in the API Management service instance. +Non-current revision has ;rev=n as a suffix where n is the revision number. + \[GroupFqName \\]: The GitLab group fully-qualified name. + \[Id \\]: Resource identity path + \[OperationResultId \\]: The operation result Id. + \[OrgName \\]: The Azure DevOps organization name. + \[OwnerName \\]: The GitHub owner name. + \[ProjectName \\]: The project name. + \[RepoName \\]: The repository name. + \[ResourceGroupName \\]: The name of the resource group within the user's subscription. +The name is case insensitive. + \[SecurityConnectorName \\]: The security connector name. + \[ServiceName \\]: The name of the API Management service. + \[SubscriptionId \\]: Azure subscription ID + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/az.security/remove-azsecurityconnectordevopsconfiguration](https://learn.microsoft.com/powershell/module/az.security/remove-azsecurityconnectordevopsconfiguration) + diff --git a/src/Security/Security/help/Update-AzSecurityConnector.md b/src/Security/Security/help/Update-AzSecurityConnector.md new file mode 100644 index 000000000000..fa3d8886bba8 --- /dev/null +++ b/src/Security/Security/help/Update-AzSecurityConnector.md @@ -0,0 +1,315 @@ +--- +external help file: Az.Security-help.xml +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/az.security/update-azsecurityconnector +schema: 2.0.0 +--- + +# Update-AzSecurityConnector + +## SYNOPSIS +Updates a security connector + +## SYNTAX + +### UpdateExpanded (Default) +``` +Update-AzSecurityConnector -Name -ResourceGroupName [-SubscriptionId ] + [-EnvironmentData ] [-EnvironmentName ] [-Etag ] + [-HierarchyIdentifier ] [-Kind ] [-Location ] [-Offering ] + [-Tag ] [-DefaultProfile ] [-WhatIf] [-Confirm] [] +``` + +### UpdateViaIdentityExpanded +``` +Update-AzSecurityConnector -InputObject [-EnvironmentData ] + [-EnvironmentName ] [-Etag ] [-HierarchyIdentifier ] [-Kind ] + [-Location ] [-Offering ] [-Tag ] [-DefaultProfile ] [-WhatIf] + [-Confirm] [] +``` + +## DESCRIPTION +Updates a security connector + +## EXAMPLES + +### EXAMPLE 1 +``` +Update-AzSecurityConnector -ResourceGroupName "securityConnectors-pwsh-tmp" -Name "ado-sdk-pwsh-test03" -Tag @{myTag="v1"} +``` + +## PARAMETERS + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -EnvironmentData +The security connector environment data. +. + +```yaml +Type: ISecurityConnectorEnvironment +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -EnvironmentName +The multi cloud resource's cloud name. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Etag +Entity tag is used for comparing two or more entities from the same requested resource. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -HierarchyIdentifier +The multi cloud resource identifier (account id in case of AWS connector, project number in case of GCP connector). + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +. + +```yaml +Type: ISecurityIdentity +Parameter Sets: UpdateViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Kind +Kind of the resource + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Location +Location where the resource is stored + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +The security connector name. + +```yaml +Type: String +Parameter Sets: UpdateExpanded +Aliases: SecurityConnectorName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Offering +A collection of offerings for the security connector. +. + +```yaml +Type: ICloudOffering[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group within the user's subscription. +The name is case insensitive. + +```yaml +Type: String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure subscription ID + +```yaml +Type: String +Parameter Sets: UpdateExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Tag +A list of key value pairs that describe the resource. + +```yaml +Type: Hashtable +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityConnector +## NOTES +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. +For information on hash tables, run Get-Help about_Hash_Tables. + +ENVIRONMENTDATA \: The security connector environment data. + EnvironmentType \: The type of the environment data. + +INPUTOBJECT \: Identity Parameter + \[ApiId \\]: API revision identifier. +Must be unique in the API Management service instance. +Non-current revision has ;rev=n as a suffix where n is the revision number. + \[GroupFqName \\]: The GitLab group fully-qualified name. + \[Id \\]: Resource identity path + \[OperationResultId \\]: The operation result Id. + \[OrgName \\]: The Azure DevOps organization name. + \[OwnerName \\]: The GitHub owner name. + \[ProjectName \\]: The project name. + \[RepoName \\]: The repository name. + \[ResourceGroupName \\]: The name of the resource group within the user's subscription. +The name is case insensitive. + \[SecurityConnectorName \\]: The security connector name. + \[ServiceName \\]: The name of the API Management service. + \[SubscriptionId \\]: Azure subscription ID + +OFFERING \: A collection of offerings for the security connector. + OfferingType \: The type of the security offering. + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/az.security/update-azsecurityconnector](https://learn.microsoft.com/powershell/module/az.security/update-azsecurityconnector) + diff --git a/src/Security/Security/help/Update-AzSecurityConnectorAzureDevOpsOrg.md b/src/Security/Security/help/Update-AzSecurityConnectorAzureDevOpsOrg.md new file mode 100644 index 000000000000..404dd7716407 --- /dev/null +++ b/src/Security/Security/help/Update-AzSecurityConnectorAzureDevOpsOrg.md @@ -0,0 +1,271 @@ +--- +external help file: Az.Security-help.xml +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/az.security/update-azsecurityconnectorazuredevopsorg +schema: 2.0.0 +--- + +# Update-AzSecurityConnectorAzureDevOpsOrg + +## SYNOPSIS +Updates monitored Azure DevOps organization details. + +## SYNTAX + +### UpdateExpanded (Default) +``` +Update-AzSecurityConnectorAzureDevOpsOrg -OrgName -ResourceGroupName + -SecurityConnectorName [-SubscriptionId ] [-ActionableRemediation ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-WhatIf] [-Confirm] [] +``` + +### UpdateViaIdentityExpanded +``` +Update-AzSecurityConnectorAzureDevOpsOrg -InputObject + [-ActionableRemediation ] [-DefaultProfile ] [-AsJob] [-NoWait] [-WhatIf] + [-Confirm] [] +``` + +## DESCRIPTION +Updates monitored Azure DevOps organization details. + +## EXAMPLES + +### EXAMPLE 1 +``` +$config = New-AzSecurityConnectorActionableRemediationObject -State Enabled -InheritFromParentState Disabled -CategoryConfiguration @( @{category="IaC"; minimumSeverityLevel="High"}) +``` + +Update-AzSecurityConnectorAzureDevOpsOrg -ResourceGroupName "securityConnectors-pwsh-tmp" -SecurityConnectorName "ado-sdk-pwsh-test03" -OrgName "org1" -ActionableRemediation $config + +## PARAMETERS + +### -ActionableRemediation +Configuration payload for PR Annotations. +. + +```yaml +Type: IActionableRemediation +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -AsJob +Run the command as a job + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +. + +```yaml +Type: ISecurityIdentity +Parameter Sets: UpdateViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -OrgName +The Azure DevOps organization name. + +```yaml +Type: String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SecurityConnectorName +The security connector name. + +```yaml +Type: String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure subscription ID + +```yaml +Type: String +Parameter Sets: UpdateExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsOrg +## NOTES +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. +For information on hash tables, run Get-Help about_Hash_Tables. + +ACTIONABLEREMEDIATION \: Configuration payload for PR Annotations. + \[BranchConfiguration \\]: Repository branch configuration for PR Annotations. + \[AnnotateDefaultBranch \\]: Configuration of PR Annotations on default branch. +Enabled - PR Annotations are enabled on the resource's default branch. +Disabled - PR Annotations are disabled on the resource's default branch. + \[BranchName \\>\]: Gets or sets branches that should have annotations. + \[CategoryConfiguration \\>\]: Gets or sets list of categories and severity levels. + \[Category \\]: Rule categories. +Code - code scanning results. +Artifact scanning results. +Dependencies scanning results. +IaC results. +Secrets scanning results. +Container scanning results. + \[MinimumSeverityLevel \\]: Gets or sets minimum severity level for a given category. + \[InheritFromParentState \\]: Update Settings. +Enabled - Resource should inherit configurations from parent. +Disabled - Resource should not inherit configurations from parent. + \[State \\]: ActionableRemediation Setting. +None - the setting was never set. +Enabled - ActionableRemediation is enabled. +Disabled - ActionableRemediation is disabled. + +INPUTOBJECT \: Identity Parameter + \[ApiId \\]: API revision identifier. +Must be unique in the API Management service instance. +Non-current revision has ;rev=n as a suffix where n is the revision number. + \[GroupFqName \\]: The GitLab group fully-qualified name. + \[Id \\]: Resource identity path + \[OperationResultId \\]: The operation result Id. + \[OrgName \\]: The Azure DevOps organization name. + \[OwnerName \\]: The GitHub owner name. + \[ProjectName \\]: The project name. + \[RepoName \\]: The repository name. + \[ResourceGroupName \\]: The name of the resource group within the user's subscription. +The name is case insensitive. + \[SecurityConnectorName \\]: The security connector name. + \[ServiceName \\]: The name of the API Management service. + \[SubscriptionId \\]: Azure subscription ID + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/az.security/update-azsecurityconnectorazuredevopsorg](https://learn.microsoft.com/powershell/module/az.security/update-azsecurityconnectorazuredevopsorg) + diff --git a/src/Security/Security/help/Update-AzSecurityConnectorAzureDevOpsProject.md b/src/Security/Security/help/Update-AzSecurityConnectorAzureDevOpsProject.md new file mode 100644 index 000000000000..df4b8365e0ab --- /dev/null +++ b/src/Security/Security/help/Update-AzSecurityConnectorAzureDevOpsProject.md @@ -0,0 +1,302 @@ +--- +external help file: Az.Security-help.xml +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/az.security/update-azsecurityconnectorazuredevopsproject +schema: 2.0.0 +--- + +# Update-AzSecurityConnectorAzureDevOpsProject + +## SYNOPSIS +Updates a monitored Azure DevOps project resource. + +## SYNTAX + +### UpdateExpanded (Default) +``` +Update-AzSecurityConnectorAzureDevOpsProject -OrgName -ProjectName + -ResourceGroupName -SecurityConnectorName [-SubscriptionId ] + [-ActionableRemediation ] [-ParentOrgName ] [-DefaultProfile ] + [-AsJob] [-NoWait] [-WhatIf] [-Confirm] [] +``` + +### UpdateViaIdentityExpanded +``` +Update-AzSecurityConnectorAzureDevOpsProject -InputObject + [-ActionableRemediation ] [-ParentOrgName ] [-DefaultProfile ] + [-AsJob] [-NoWait] [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION +Updates a monitored Azure DevOps project resource. + +## EXAMPLES + +### EXAMPLE 1 +``` +$config = New-AzSecurityConnectorActionableRemediationObject -State Disabled -InheritFromParentState Disabled -CategoryConfiguration @( @{category="IaC"; minimumSeverityLevel="Low"}) +``` + +Update-AzSecurityConnectorAzureDevOpsProject -ResourceGroupName "securityConnectors-pwsh-tmp" -SecurityConnectorName "ado-sdk-pwsh-test03" -OrgName "org1" -ProjectName "Build" -ActionableRemediation $config + +## PARAMETERS + +### -ActionableRemediation +Configuration payload for PR Annotations. +. + +```yaml +Type: IActionableRemediation +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -AsJob +Run the command as a job + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +. + +```yaml +Type: ISecurityIdentity +Parameter Sets: UpdateViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -OrgName +The Azure DevOps organization name. + +```yaml +Type: String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ParentOrgName +Gets or sets parent Azure DevOps Organization name. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProjectName +The project name. + +```yaml +Type: String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SecurityConnectorName +The security connector name. + +```yaml +Type: String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure subscription ID + +```yaml +Type: String +Parameter Sets: UpdateExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsProject +## NOTES +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. +For information on hash tables, run Get-Help about_Hash_Tables. + +ACTIONABLEREMEDIATION \: Configuration payload for PR Annotations. + \[BranchConfiguration \\]: Repository branch configuration for PR Annotations. + \[AnnotateDefaultBranch \\]: Configuration of PR Annotations on default branch. +Enabled - PR Annotations are enabled on the resource's default branch. +Disabled - PR Annotations are disabled on the resource's default branch. + \[BranchName \\>\]: Gets or sets branches that should have annotations. + \[CategoryConfiguration \\>\]: Gets or sets list of categories and severity levels. + \[Category \\]: Rule categories. +Code - code scanning results. +Artifact scanning results. +Dependencies scanning results. +IaC results. +Secrets scanning results. +Container scanning results. + \[MinimumSeverityLevel \\]: Gets or sets minimum severity level for a given category. + \[InheritFromParentState \\]: Update Settings. +Enabled - Resource should inherit configurations from parent. +Disabled - Resource should not inherit configurations from parent. + \[State \\]: ActionableRemediation Setting. +None - the setting was never set. +Enabled - ActionableRemediation is enabled. +Disabled - ActionableRemediation is disabled. + +INPUTOBJECT \: Identity Parameter + \[ApiId \\]: API revision identifier. +Must be unique in the API Management service instance. +Non-current revision has ;rev=n as a suffix where n is the revision number. + \[GroupFqName \\]: The GitLab group fully-qualified name. + \[Id \\]: Resource identity path + \[OperationResultId \\]: The operation result Id. + \[OrgName \\]: The Azure DevOps organization name. + \[OwnerName \\]: The GitHub owner name. + \[ProjectName \\]: The project name. + \[RepoName \\]: The repository name. + \[ResourceGroupName \\]: The name of the resource group within the user's subscription. +The name is case insensitive. + \[SecurityConnectorName \\]: The security connector name. + \[ServiceName \\]: The name of the API Management service. + \[SubscriptionId \\]: Azure subscription ID + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/az.security/update-azsecurityconnectorazuredevopsproject](https://learn.microsoft.com/powershell/module/az.security/update-azsecurityconnectorazuredevopsproject) + diff --git a/src/Security/Security/help/Update-AzSecurityConnectorAzureDevOpsRepo.md b/src/Security/Security/help/Update-AzSecurityConnectorAzureDevOpsRepo.md new file mode 100644 index 000000000000..73f688fb34da --- /dev/null +++ b/src/Security/Security/help/Update-AzSecurityConnectorAzureDevOpsRepo.md @@ -0,0 +1,332 @@ +--- +external help file: Az.Security-help.xml +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/az.security/update-azsecurityconnectorazuredevopsrepo +schema: 2.0.0 +--- + +# Update-AzSecurityConnectorAzureDevOpsRepo + +## SYNOPSIS +Updates a monitored Azure DevOps repository resource. + +## SYNTAX + +### UpdateExpanded (Default) +``` +Update-AzSecurityConnectorAzureDevOpsRepo -OrgName -ProjectName -RepoName + -ResourceGroupName -SecurityConnectorName [-SubscriptionId ] + [-ActionableRemediation ] [-ParentOrgName ] [-ParentProjectName ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-WhatIf] [-Confirm] [] +``` + +### UpdateViaIdentityExpanded +``` +Update-AzSecurityConnectorAzureDevOpsRepo -InputObject + [-ActionableRemediation ] [-ParentOrgName ] [-ParentProjectName ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION +Updates a monitored Azure DevOps repository resource. + +## EXAMPLES + +### EXAMPLE 1 +``` +$config = New-AzSecurityConnectorActionableRemediationObject -State Enabled -InheritFromParentState Disabled -CategoryConfiguration @( @{category="IaC"; minimumSeverityLevel="Low"} ) +``` + +Update-AzSecurityConnectorAzureDevOpsRepo -ResourceGroupName "securityConnectors-pwsh-tmp" -SecurityConnectorName "ado-sdk-pwsh-test03" -OrgName "org1" -ProjectName "Build" -RepoName "Build" -ActionableRemediation $config + +## PARAMETERS + +### -ActionableRemediation +Configuration payload for PR Annotations. +. + +```yaml +Type: IActionableRemediation +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -AsJob +Run the command as a job + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +. + +```yaml +Type: ISecurityIdentity +Parameter Sets: UpdateViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -OrgName +The Azure DevOps organization name. + +```yaml +Type: String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ParentOrgName +Gets or sets parent Azure DevOps Organization name. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ParentProjectName +Gets or sets parent Azure DevOps Project name. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProjectName +The project name. + +```yaml +Type: String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -RepoName +The repository name. + +```yaml +Type: String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SecurityConnectorName +The security connector name. + +```yaml +Type: String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure subscription ID + +```yaml +Type: String +Parameter Sets: UpdateExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IAzureDevOpsRepository +## NOTES +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. +For information on hash tables, run Get-Help about_Hash_Tables. + +ACTIONABLEREMEDIATION \: Configuration payload for PR Annotations. + \[BranchConfiguration \\]: Repository branch configuration for PR Annotations. + \[AnnotateDefaultBranch \\]: Configuration of PR Annotations on default branch. +Enabled - PR Annotations are enabled on the resource's default branch. +Disabled - PR Annotations are disabled on the resource's default branch. + \[BranchName \\>\]: Gets or sets branches that should have annotations. + \[CategoryConfiguration \\>\]: Gets or sets list of categories and severity levels. + \[Category \\]: Rule categories. +Code - code scanning results. +Artifact scanning results. +Dependencies scanning results. +IaC results. +Secrets scanning results. +Container scanning results. + \[MinimumSeverityLevel \\]: Gets or sets minimum severity level for a given category. + \[InheritFromParentState \\]: Update Settings. +Enabled - Resource should inherit configurations from parent. +Disabled - Resource should not inherit configurations from parent. + \[State \\]: ActionableRemediation Setting. +None - the setting was never set. +Enabled - ActionableRemediation is enabled. +Disabled - ActionableRemediation is disabled. + +INPUTOBJECT \: Identity Parameter + \[ApiId \\]: API revision identifier. +Must be unique in the API Management service instance. +Non-current revision has ;rev=n as a suffix where n is the revision number. + \[GroupFqName \\]: The GitLab group fully-qualified name. + \[Id \\]: Resource identity path + \[OperationResultId \\]: The operation result Id. + \[OrgName \\]: The Azure DevOps organization name. + \[OwnerName \\]: The GitHub owner name. + \[ProjectName \\]: The project name. + \[RepoName \\]: The repository name. + \[ResourceGroupName \\]: The name of the resource group within the user's subscription. +The name is case insensitive. + \[SecurityConnectorName \\]: The security connector name. + \[ServiceName \\]: The name of the API Management service. + \[SubscriptionId \\]: Azure subscription ID + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/az.security/update-azsecurityconnectorazuredevopsrepo](https://learn.microsoft.com/powershell/module/az.security/update-azsecurityconnectorazuredevopsrepo) + diff --git a/src/Security/Security/help/Update-AzSecurityConnectorDevOpsConfiguration.md b/src/Security/Security/help/Update-AzSecurityConnectorDevOpsConfiguration.md new file mode 100644 index 000000000000..ab637297c95c --- /dev/null +++ b/src/Security/Security/help/Update-AzSecurityConnectorDevOpsConfiguration.md @@ -0,0 +1,262 @@ +--- +external help file: Az.Security-help.xml +Module Name: Az.Security +online version: https://learn.microsoft.com/powershell/module/az.security/update-azsecurityconnectordevopsconfiguration +schema: 2.0.0 +--- + +# Update-AzSecurityConnectorDevOpsConfiguration + +## SYNOPSIS +Updates a DevOps Configuration. + +## SYNTAX + +### UpdateExpanded (Default) +``` +Update-AzSecurityConnectorDevOpsConfiguration -ResourceGroupName -SecurityConnectorName + [-SubscriptionId ] [-AuthorizationCode ] [-AutoDiscovery ] + [-TopLevelInventoryList ] [-DefaultProfile ] [-AsJob] [-NoWait] [-WhatIf] [-Confirm] + [] +``` + +### UpdateViaIdentityExpanded +``` +Update-AzSecurityConnectorDevOpsConfiguration -InputObject [-AuthorizationCode ] + [-AutoDiscovery ] [-TopLevelInventoryList ] [-DefaultProfile ] [-AsJob] [-NoWait] + [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION +Updates a DevOps Configuration. + +## EXAMPLES + +### EXAMPLE 1 +``` +Update-AzSecurityConnectorDevOpsConfiguration -ResourceGroupName "securityConnectors-pwsh-tmp" -SecurityConnectorName "ado-sdk-pwsh-test03" -AutoDiscovery Enabled +``` + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -AuthorizationCode +Gets or sets one-time OAuth code to exchange for refresh and access tokens.Only used during PUT/PATCH operations. +The secret is cleared during GET. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -AutoDiscovery +AutoDiscovery states. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +. + +```yaml +Type: ISecurityIdentity +Parameter Sets: UpdateViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SecurityConnectorName +The security connector name. + +```yaml +Type: String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure subscription ID + +```yaml +Type: String +Parameter Sets: UpdateExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TopLevelInventoryList +List of top-level inventory to select when AutoDiscovery is disabled.This field is ignored when AutoDiscovery is enabled. + +```yaml +Type: String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.ISecurityIdentity +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Security.Models.IDevOpsConfiguration +## NOTES +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. +For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT \: Identity Parameter + \[ApiId \\]: API revision identifier. +Must be unique in the API Management service instance. +Non-current revision has ;rev=n as a suffix where n is the revision number. + \[GroupFqName \\]: The GitLab group fully-qualified name. + \[Id \\]: Resource identity path + \[OperationResultId \\]: The operation result Id. + \[OrgName \\]: The Azure DevOps organization name. + \[OwnerName \\]: The GitHub owner name. + \[ProjectName \\]: The project name. + \[RepoName \\]: The repository name. + \[ResourceGroupName \\]: The name of the resource group within the user's subscription. +The name is case insensitive. + \[SecurityConnectorName \\]: The security connector name. + \[ServiceName \\]: The name of the API Management service. + \[SubscriptionId \\]: Azure subscription ID + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/az.security/update-azsecurityconnectordevopsconfiguration](https://learn.microsoft.com/powershell/module/az.security/update-azsecurityconnectordevopsconfiguration) +